Pythonic wrappers for SQL?
wleftwich at gmail.com
Tue Jan 17 01:02:53 CET 2006
Steve Holden wrote:
> SQLObject is a very popuar object-relational mapper that works with a
> range of databases including SQLite.
> But SQL isn't actually that complicated to someone who's already learned
> Python! I maintain this page for students on the classes I teach, and it
> has some useful pointers:
With all the buzz about ORM these days, you don't hear much about good
old DBAPI. Maybe it's a matter of what's currently hip, or maybe DBAPI
has not achieved a consistent interface across adapters (e.g. ? vs %s
for placeholders). But it seems like to some extent the ORMs achieve
back end interchangeability by limiting what you can say.
Or maybe that's just my frustration because I am a beginner with
SQLObject, using it on a rewrite of an old (1999 or so) application
that has a lot of MSSQL-specific SQL expressed via mxODBC. I keep
catching myself working backward from what I want the SQL statement to
be, which is not very object-oriented on my part. I suppose it's a
matter of learning a new language, after a while you stop mentally
translating. However, I agree with the earlier comment that you'd
better be comfortable with SQL before you start trying to make sense of
an ORM, especially for data structures more complicated than you see in
a 20 minute screencast.
I am persevering with SQLObject, having faith that the extra work I'm
putting in to design my table classes will pay off in a more robust and
portable application. The module itself is elegant and well written,
and it uses metaclasses to boot.
-- Wade Leftwich
More information about the Python-list