[DB-SIG] Oracle tables encapsulation
Stuart 'Zen' Bishop
Mon, 6 Dec 1999 11:54:27 +1100 (EST)
On Fri, 3 Dec 1999, M.-A. Lemburg wrote:
> Stuart 'Zen' Bishop wrote:
> > I've attached some code I've been playing with.
> > ...
> > Its currently Oracle specific, since there is no generic method of
> > binding parameters that I know of making it rather difficult to write
> > cross platform database stuff using Python at the moment.
> What about cursor.execute('select * from MyTable where id=?',(1,)) ?
> Or did you mean the parameter marks in the SQL statement ? Note
> that DBAPI 2.0 compatible interfaces will provide a flag that
> indicates what mark to use: paramstyle.
Yes - I meant the parameter marks in the SQL statement.
The best solution I can come up with would be a module which
provides a thin level of abstraction to DBAPI 2.0 interfaces.
Initial implementation could be identical to DBAPI 2.0, except that
the connect method would require a DBAPI module name.
common autocommit mode
common thread safety (if the driver doesn't support the required level,
a seperate thread could be spawned and all transactions are passed to
this thread for execution. Or it could just throw an exception if calls
are made from unsupported threads if we are feeling lazy).
ability to write 'generic' SQL and distribute product where the
end user can easily select the DBMS
ability to fatten the API with useful helper functions, without
requiring everyone to reinvent their wheels or cut&paste code
Could be incorporated into the python distribution, possibly
with Gadfly or PostgreSQL if the licences are compatible.
A generic Zope DA could possibly be written to have Zope support
// Zen (alias Stuart Bishop) Work: firstname.lastname@example.org
// E N Senior Systems Alchemist Play: email@example.com
//__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen