Is there something easier than ORM?

andrew cooke andrew at acooke.org
Tue Feb 17 11:52:56 EST 2009


Philip Semanchuk wrote:
> In short, I gather that others on this list are a lot more fond of
> SqlAlchemy and ORMs in general than I am. Granted, my experience is
> very limited. I tried to integrate SqlAlchemy in one project,
> struggled for a long time to express how I wanted my tables joined,
> and finally found that performance was bad compared to our homegrown
> SQL. My boss and I were both very comfortable with SQL and were happy
> to go back to writing our own SQL statements and coding a data access
> layer.
>
> I don't intend this as a criticism of SqlAlchemy. On the contrary I am
> impressed by what it does. But I often see people promoting ORM as the
> solution to all database access problems, and I certainly don't feel
> like it is.

the reason i, at least, like sqlalchemy so much is for exactly the reasons
you outlined.  unlike other orm solutions it doesn't force you to use orm.
 you can also use sql directly - either as simple strings or by
constructing it via python methods (which can be a very powerful way of
programatically constructing sql commands that would be a nightmare to
write by hand).  that gives you the flexibility to deal with each problem
in the way that feels most natural, without having to switch between tools
(in fact, i have mixed orm and "direct" sql in a single project with no
problems using sqlalchemy - reading from one database using sql and
writing to another using objects).

andrew





More information about the Python-list mailing list