Is there something easier than ORM?

Robert Kern robert.kern at
Tue Feb 17 12:10:25 EST 2009

On 2009-02-17 10:52, andrew cooke wrote:
> 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).

Me, too! I have often used SQLAlchemy as "a better DB-API" even if I don't touch 
its ORM. I really don't know what I would have done in my past projects without 
SQLAlchemy's table reflection and metadata introspection capabilities.

It does suffer some from TMTOWTDI, but there's usually a valid use case floating 
around somewhere for each WTDI.

Its public image definitely suffers from the impression that it's "an ORM" that 
can be compared on equal terms with packages that actually are just ORMs. I 
describe it as a very powerful toolkit for solving a wide variety of problems 
involving SQL databases. One of those tools happens to be an ORM.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list