Options for working with PostgreSQL?

Hi,

I'm going to be working on a Ruby project that needs to access
and update an existing PostgreSQL database.

I'd like to hear from people who have done or are doing this
about their choice of Ruby access method to PostgreSQL. There
seems to be DBI, Og, ActiveRecord, and others?

Any advice much appreciated!

Fab

Fab,

It all depends on how you want to access your database and what you
wish to do with it.

DBI - Driect SQL Access. Database Independent. Similar to Perl::DBI.

Postgres - Direct SQL Access. Specifically for PostgreSQL. DBI uses this module.

Og - Object-Relational Mapping. Generates SQL statements. You can have
direct SQL access with Og, but that's not what it's meant for. This
one is my favourite.

ActiveRecord - This is used by Rails. I haven't worked with it much,
but I believe it's similar to Og.

Anyhow, if all you want to do is throw a few SQL statements together,
you're probably better off with DBI or Postgres. I'd pick the former
mainly because it would _try to_ keep you from doing Postgres specific
things; easing a port to another db, if ever needed.

If you're building a database driven application, I'd strongly
recommend that you investigate Og. Og lets you continue to think in
terms of classes and objects, while it takes care of the database side
of things (Generating the database model, SQL queries etc.)

It certainly eases development effort considerably; and also leads to
cleaner more-manageable code.

The only negatives with Og, IMO, is the lack of good documentation.

I haven't worked with ActiveRecord much, but I'm sure someone here
will help you with that.

Mohit.

···

On 8/20/05, Fab <fab002@pobox.com> wrote:

Hi,

I'm going to be working on a Ruby project that needs to access
and update an existing PostgreSQL database.

I'd like to hear from people who have done or are doing this
about their choice of Ruby access method to PostgreSQL. There
seems to be DBI, Og, ActiveRecord, and others?

Any advice much appreciated!

Fab

--
Mohit Muthanna [mohit (at) muthanna (uhuh) com]
"There are 10 types of people. Those who understand binary, and those
who don't."

Og - Object-Relational Mapping. Generates SQL statements. You can have
direct SQL access with Og, but that's not what it's meant for. This
one is my favourite.

Allow me to add that the latest version of Og can also 'reverse
engineer' a legacy database schema and provide an OO view of your
tables.

regards,
George

···

--
http://www.gmosx.com

http://www.navel.gr