I've some huge text files to process and make sense out of the data. Part of the task is to save this data into a database. I want to use Ruby, with postgres or mysql, postgres being the first choice. What libraries should I include? There is no model, its going to be plain SQL statements. How to do this without rails?
A:
You're after ActiveRecord, which supplies the database connectivity. A quick google search suggested this might be a good place to start.
Peter
2010-02-11 04:28:17
Nope, I dont want to use ORM (activerecord is ORM, right?) I want to write my own SQL statements, like the way we do with mysql_query, mysql_connect etc in PHP.
2010-02-11 04:35:29
Yes, ActiveRecord is an ORM, and is overkill for executing plain SQL statements.
Alison R.
2010-02-11 04:37:55
still and orm but its light and faaast http://datamapper.org/getting-started.html - datamapper. its also easy to use outside rails
ADAM
2010-02-11 08:41:04
+3
A:
For PostgreSQL, you want ruby-pg. It supplies your basic database connection with the ability to query it. The documentation is sparse, but there are plenty of code samples in the source tree. Here's a fairly straightforward one:
http://bitbucket.org/ged/ruby-pg/src/tip/sample/test1.rb
Edit: The MySQL site lists a few options for connecting to MySQL.
Alison R.
2010-02-11 04:36:27
A:
Sequel - sequel.rubyforge.org - is great as well. Using the core library (not the Sequel::Model ORM) you can write SQL like queries/statements using Ruby syntax.
Farrel
2010-02-11 09:21:30