Confused about PyGreSQL

Gerhard Häring gh_pythonlist at gmx.de
Mon Jan 14 01:13:46 EST 2002


Le 13/01/02 à 21:09, Tim Roberts écrivit:
> I think I'm confused about what, exactly, constitutes PyGreSQL.  I'm hoping
> someone can clear up my confusion.
> 
> What *I* use to access Postgres from Python is in a Python module called
> pg.py.

This is a PyGreSQL specific interface which is *not* DB-API compliant
but has one or two convenient functions.

> This is basically a thin wrapper around "import _pg", which is
> contained in _pgmodule.so.  I believe this is, in fact, what gets
> built as part of the standard Postgres 7.x build procedure.  Is this
> PyGreSQL?

Yes, PyGreSQL is part of the PostgreSQL tree nowadays.

> I also find a module called pgdb.py in my site-packages, which claims to
> offer a DB-API 2.0 compliant interface to Postgres. Is this ALSO PyGreSQL?

Yes, pgdb.py is the DB-API wrapper around the proprietary pg.py
interface.

> If BOTH are PyGreSQL, is there any particular reason to prefer one
> interface over the other?  pg.py seems like a very thin layer, and as
> a result is rather easy to understand.

I try only to use a DB-API interface unless there is a very good reason
not to (like performance). For PostgreSQL, I prefer pyPgSQL. pyPgSQL
also works fine on Windows :-)

If you want to use PyGreSQL, use at least the one from PostgreSQL 7.1.3
(the stuff on Darcy's site was still quite outdated last time I
checked), because 7.1.3 onwards contain a fix from me for the
longstanding cursor problem.

> Am I a dinosaur?

If you're called Tim rather than Bob, I think the answer is "no" :-)

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))




More information about the Python-list mailing list