[Chicago] Yet another ORM for Python

Chris McAvoy chris.mcavoy at gmail.com
Tue Jul 10 20:08:41 CEST 2007


On 7/10/07, David Terrell <dbt at meat.net> wrote:
> On Tue, Jul 10, 2007 at 12:31:48PM -0500, Brantley Harris wrote:
> > I'm not really sure what it adds to the landscape...
> >
>
> I'm not a big fan of ruby, but the RoR method of interrogating the
> database seems vastly superior to the java-ish "define all your
> database columns in code even though we don't have a good method
> to apply changes to the database when you change your code" method

I would have agreed with you a few months ago, but nowadays I'm a fan
of explicitly mapping database columns to objects.  It helps when you
want to change the database schema but don't want to track down all
the bits in your code you need to flip to make that happen.

I'm a big fan of the Django ORM, it has all the benefits of
ActiveRecord, with some of the flexibility of a DataMapper.  I've made
a few tries at SqlAlchemy, but I don't need the power it offers (at
least for now).  Plus, I'm a gigantic fan of the Django query api,
CoffeeMug.objects,filter(color='green').filter(handle='large')[0:10]
fits my brain like a really soft blanket.  Add to it list
comprehensions, like [mug.contents for mug in
CoffeeMug.objects,filter(color='green').filter(handle='large')[0:10]]
and you've just set me up for a week of gurgling happiness.  Great
stuff.

Plus, just as a bonus, I get really frustrated when working with Rails
and having to continually refer to a schema dump to know what my
object data methods are.  I like the explicitness of mapping.

That said, RoR ActiveRecord is really nice.  Especially the whole
'has_many :liquids', that's very cool.  And the RoR migrations are
seriously great.  I love them.

Anywho...ORM's are neat.  I wish the Django ORM were a teeny bit
easier to use outside of a Django app.  It's not impossible, and it's
not really "hard" its just kind of hacky feeling.  Purely an aesthetic
thing.

Chris


More information about the Chicago mailing list