Pygresql classic vs DB-API interface

S

Steve Bergman

I am relatively new to python and am developing an application using
mod_python/pygresql/postgresql.

Being attracted to the idea of database portability, I started out using
the DB-API 2.0 compliant pgdb module. However, I am finding it to be
pretty clunky compared to the classic pg interface.
It just doesn't seem "pythonic" to me. Chief among my concerns is the
way it won't return results as a dictionary, so I have to address the
data using cryptic numeric indeces. To be fair, the 3rd party dtuple
module lets me use dictionaries, but it still seems a bit clunky. Also,
insertion into a table seems unnecessarily ugly. With the classic
interface, I just pass a tablename and a dictionary and let the
interface deal with it. With pgdb, if I want to do something like that
I've got to write my own code to do it. Or does DB-API and pyformat
allow me to do this in a more elegant way of which I am unaware?

I still like the portability of pgdb though. So, does anyone have any
recommendations? Perhaps a module that does for inserts and updates
kind of what dtuple does for selects?

Thank you for any guidance.

Steve Bergman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top