> I've been looking at the various interfaces PyGreSQL offers, and it
> seems that the best course of action would be to use pg.DB() as the
> equivalent of our current 'connection' objects, and connection.source()
> as the equivalent of our current cursor objects (we don't call the pgdb
> DB-API functions directly, so the fact that DB and source objects don't
> implement the DB-API methods does not worry me).
The source object actually belongs to the low-level _pg library which is
not documented, but underlying both the pg and pgdb interfaces. You can
use it directly like that:
import _pg
db = _pg.connect('test')
source = db.source()
source.execute("select 1+1")
result = source.fetch()[0][0]
source.close()
The DB class is a wrapper class proxying all the low-level methods of
the connection object, therefore you were able to access the underlying
source object via the source() method.
The _pg library has been pretty stable for many years now. There will be
a few additions and improvements, but the basic functionality and
methods will probably not be rewritten or renamed in the near future.
But D'Arcy should comment on that, too.
My recommendation is that you write your own Python API module according
to your needs based on top of _pg. You can take pg or pgdb as a starting
point. If there will be major changes in _pg, then you only have to
adapt your API module, not your whole application.
-- Chris
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql