Ruby external SQL module

Any recommendations for a module that stores SQL queries external to the application for Ruby programs? I try to avoid hard-coding SQL queries and possibly support multiple SQL databases in a set of programs that make direct SQL queries (that is, not indirectly through ORM).

Hyopthetically:

# Production system is pg, dev environment is sqlite
sql_book = What::Module::Here.load( a_file,
                                    ENV['DEVEL'] ? 'PostgreSQL' : 'SQLite3' )

# Okay, now get all Widget IDs
r = db_handle.execute( :load_all_widget_ids )

In perl, I can use Data::Phrasebook::SQLor something more exotic, for example CAM::SQLManager.

+5
source share
1 answer

Sequel is lighter and more flexible than other ORMs like ActiveRecord and DataMapper:

http://sequel.rubyforge.org/

or you can use Ruby DBI:

https://github.com/RDBI/rdbi ()

, , .

+4

All Articles