[DB-SIG] Remaining issues with DB API 2.0

Greg Stein gstein@lyra.org
Wed, 31 Mar 1999 17:52:45 -0800

Andy Dustman wrote:
> Even so, I'm not sure how we would wrap dbm, gdbm, or bsddb to be
> compatible with the API, as they have no query language, no (or one)
> table, and no columns! Perhaps the wrapper could parse a little SQL,
> ignore the specified columns, and just pickle whatever parameters it
> finds. It'd be tough, though. I think I'd stick with the shelf
> interface... (I actually have a module, SQLDict, that wraps a
> dictionary-like interface around a DBI-compatible connection object...
> That direction of abstraction is a little easier to do...)

"SIG on Tabular Databases in Python

This list is intended to work through and resolve issues related to
tabular database access from Python. Being somewhat related, this list
may also cover persistency issues in Python."

If somebody wants to build a little tabular database on top of *dbm,
then DBAPI is fine. Note that DBIAPI actually does not require the use
of SQL. The execute() method refers to "operation object".

db = gjsdbm.connect('myfile')
curs = db.cursor()
op = gjsdbm.KeyLookup(key='id')
count = curs.execute(op, (123,))
print '123:', count
count = curs.execute(op, (456,))
print '456:', count

This is all quite valid using the DBAPI :-).


Greg Stein, http://www.lyra.org/