[PEAK] Cross-platform stored-procedure support

Ulrich Eck ueck at net-labs.de
Fri Dec 12 04:23:00 EST 2003


Hi Phillip,

> From my point of view, the ideal interface would be to access something 
> like 'db.procs.someProcName(foo,bar=baz)' and get back whatever it is I'm 
> looking for, which might or might not include a cursor to get results 
> from.  I'd like positional and keyword parameters to be possible on input, 
> and I'd like to receive only relevant results on output.
> 
> This doesn't seem possible to do in the general case.  First, we'd have to 
> be able to know -- for each procedure -- which parameters were input 
> parameters, and which parameters were output parameters.  We'd need to know 
> what order the parameters were in, and what their default values should 
> be.  And, for the crazy databases that want their output parameters passed 
> *in*, we'd need to know where to stick those parameters into the input.

most databases support introspection, can't we use it to find out the
signatures of dbprocs to generate the function-wrappers with correct
paramters and return values ?
(introspection for dbprocs works for sapdb, others i don't know well
enough)

about half a year ago i started to work on a SQL-Schema Model for peak.

http://cvs.net-labs.de/cgi-bin/viewcvs.cgi/libs/nll/src/nll/database/schema/sqlschema.py

I implemented the QueryDM's for the schema-model classes for sapdb
(similar to oracle introspection) and I'm about to do the same for
postgres. It represents Tables, Columns, Indexes, Constraints, Sequences
in a hopefully ansi compliant way.

http://cvs.net-labs.de/cgi-bin/viewcvs.cgi/libs/nll/src/nll/database/sapdb/schema.py

these packages are surely not yet ready to use for platform independent
use - they have only been tested with sapdb for now. But with some
normalization i think sql-schema could used for the following jobs:

 - Generate Function-Wrappers for DBProcs
 - Generate Model-Classes and configured EntityDM-Classes for the schema
   (TableDM/SQLEntityDM + generator script which i have as well)
 - could be used in the peak.query package to represent Tables/Colums
 - in future versions support creating/altering schema-elements 
   through the DM's interface

what do you think?

Ulrich

> 
> _______________________________________________
> PEAK mailing list
> PEAK at eby-sarna.com
> http://www.eby-sarna.com/mailman/listinfo/peak




More information about the PEAK mailing list