SQLObject or SQLAlchemy?

Jorge Godoy jgodoy at gmail.com
Thu Aug 31 23:57:33 EDT 2006


"Jorge Vargas" <jorge.vargas at gmail.com> writes:

> for example SA wins at using an existing db
> but SO wins at not worring about the db structure

That's not entirely true.  Some things are impossible with SQL Object alone.
You have to, at least, make use of sqlbuilder.  And these aren't hard things,
mind you: performing joins, filtering data accordingly to N:N relationships,
etc. 

> SO demands tables to have a primary single col int key which is manage
> by the API, while SA lets you mess with it a bit more.

SQL Objects allows for an str primary key as well.  You're not tied to
integers only.

> so you could say that SO takes care about many things so you don't
> have to worry about them, or other may say SO is too intrusive.

As has been said, it's approach to mapping the database is a subset from SQL
Alchemy.  This makes it better in some cases -- simpler, at least -- and worse
in other cases -- inefficient, impossible to use, etc.

> In my experience SO is great for new projects and if you don't want to
> mess/optimize with the actual SQL queries (which is great for an ORM because
> IMO that is the main goal of ORMing)

It is good for simple projects.  If you need more performance then you'll have
lots of troubles optimizing things with SQL Object in mind.  Also it will
force you to work directly on the database more often than SQL Alchemy to
squeeze more performance from it.

I'm converting an application from SQL Object -- that's what I've been using
for a while -- to SQL Alchemy -- this will be my first production application
with it -- and I'm liking the possibilities and extendability of SQL Alchemy. 

A lot of things that I did in the database are possible with my declarations
in SQL Alchemy, so I have a map that's more "real" with regards to what's in
the database.

> Now if you need to mess a lot with the db (either a existing one or
> need optimized queries) then SA is worth the extra effort, since
> making those things on SO is going uphill.

It isn't too hard to use SA for simple things.  I dare to say that with
ActiveMapper it is just a bit more verbose than SQL Object, but not too much. 

-- 
Jorge Godoy      <jgodoy at gmail.com>



More information about the Python-list mailing list