Python Webpages

Paul Boddie paul at boddie.net
Mon Apr 29 04:56:28 EDT 2002


Gerhard Häring <gerhard at bigfoot.de> wrote in message news:<mailman.1020024831.2366.python-list at python.org>...
>  
> The more I think about it, the less I get the point of object-relational
> mappers like MiddleKit. Especially the ones that require you to rebuild
> the database schema every time you change the object schema. AFAIC
> MiddleKit falls into this category.

That's the way I've perceived it as well, thus explaining my
indifference to MiddleKit, but then I must confess that I don't do any
real work with Webware at the moment.

> I think I'd prefer going either straight SQL with a dictionary mapper
> (pyPgSQL's PgResultSet has such a thing built in [1]) or using an object
> database like ZODB.

I can see substantial advantages in using an object-relational mapper
because it avoids the need to write and maintain near-trivial (and
thus highly tedious) database access code.

> [1] in pyPgSQL, you can say, for example:
> cursor.execute("select id, name from test")
> print cursor.id, cursor.name
> print cursor['id'], cursor['name']
> print cursor[0], cursor[1]
> 
> All forms are equivalent, but only the last one is DB-API2 compliant.

The second one is present in JDBC, at least, but I'm currently unsure
as to how it is guaranteed to behave when there are table qualifiers
or aliases in the query.

Paul



More information about the Python-list mailing list