> I'm a little bit confused here.  I've thought you switched to psycopg
> recently and now you are reporting you want to stay with pyPgSQL.
> I'm not biased here because I do not know the internals of both
> adapters, but please clarify which is the adapter to use ...
A while ago I recommended psycopg based on the technical
merits I deduced from their documentation. It proved to be a
PITA to install on anything but Debian. Further review of
options showed pyPgSQL coming out on top, sort of. So, that's
the preferred adapter-of-the-day :-)

The relevant code code goes something like this:

#3rd party dependencies
# first, do we have the preferred postgres-python library available ?
try:
        import pyPgSQL.PgSQL # try preferred backend library
        dbapi = pyPgSQL.PgSQL
        _isPGDB = 0
        #<DEBUG>
        #print 'USING PYPGSQL!!!'
        #</DEBUG>
except ImportError:
        try:
        # well, well, no such luck - fall back to stock pgdb library
                import psycopg # try Zope library
                dbapi = psycopg
                _isPGDB = 0
                #<DEBUG>
                #print 'USING PSYCOPG'
                #</DEBUG>
        except ImportError:
                try:
                        import pgdb # try standard Postgres binding
                        dbapi = pgdb
                        _isPGDB = 1
                        #<DEBUG>
                        #print 'USING PGDB'
                        #</DEBUG>
                except ImportError:
                        print "Cannot find any Python module for connecting to 
the database server. Program halted."
                        _log.LogException("No Python database adapter found.", 
sys.exc_info(), fatal=1)
                        raise

# FIXME: DBMS should eventually be configurable
__backend = 'Postgres'

_log.Log(gmLog.lInfo, 'DBMS "%s" via DB-API module "%s": API level %s, thread 
safety %s, parameter style "%s"' % (__backend, dbapi, dbapi.apilevel, 
dbapi.threadsafety, dbapi.paramstyle))

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

Reply via email to