[DB-SIG] Proposal: model database metadata from JDBC

M.-A. Lemburg mal@lemburg.com
Mon, 14 Jan 2002 11:16:41 +0100


"Dittmar, Daniel" wrote:
> 
> I would like to propose that any metadata facilities for the Python
> DB API follow the interface specified by JDBC:DatabaseMetadata:
> http://java.sun.com/j2se/1.4/docs/api/java/sql/DatabaseMetaData.html
> 
> Advantages:
> - covers a lot of ground
> - can be easily tested (depending on the quality of the JDBC driver)
> 
> The archive http://home.snafu.de/~dittmar/downloads/genMetadataClass.tgz
> contains a python script which generates such a class complete with doc
> strings (well, javadoc strings).  If a JDBC driver is available and the
> script is executed using Jython, then some of the methods are generated
> using information from the JDBC driver.
> 
> Of course, using ODBC as a model would have the same advantages. Perhaps
> someone with some knowledge of ODBC and some time could write a similar
> script. I haven't really looked into the ODBC documentation, but as I
> use in the SAP DB JDBC driver the same views the ODBC driver uses, I
> guess the two API are quite close in functionality.

JDBC was modelled after ODBC, so all information available in JDBC
is also available in ODBC (early JDBC drivers were really only
thin wrappers around existing ODBC drivers). Since JDBC was
designed much later, it doesn't suffer of all the problems
that ODBC has though and in general, I think that the JDBC
interface has a much better design than ODBC's convoluted
structure. <enough ranting ;-)>

About the interface: I suppose we could develop a JDBC like
interface on top of the existing DB API. The class would not
have to be generated though, but instead get it's information 
from a passed in connection object.

Database module wanting to support this interface would then
have to define a DatabaseMetaData class at module level
and users could then instantiate it with connection objects.

How does that sound ?

Later on, we might extend this wrapper to cover more of
the JDBC interface as front-end to the various databases
out there.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/