Re: Example of what describeTable should return?

Jacob Smullyan <[email protected]> Wed, 3 Aug 2005 19:26:08 -0400
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
On Wed, Aug 03, 2005 at 08:06:37PM +0100, Hamish Lawson wrote:
> I'm looking to implement describeTable for the Oracle driver and I'm
> trying to get my head around what's meant to be returned. Could you
> give me an example that might help me understand the docstring better?

Sure -- I'm excited that you are implementing it, even though I won't
be able to use it myself (at least for now)!  The docstring is:

  for the given table, returns a 2-tuple: a dict of Field objects
  keyed by name, and list of multi-column unique constraints (sets of
  Fields)). The Field instances should contain information about whether
  they are unique or sequenced.

In other words, describeTable comes up with suitable values for the
"fields" and "unique" attributes that you might declare manually
(except that "fields" is a dictionary, not a tuple, and the values
must be Field instances, not strings or other values that in the
fields tuple might be coerced into Fields).  Non-nullable
single-column unique constraints and sequences can be recorded in the
field dictionary; use the second item of the returned 2-tuple just for
non-nullable multi-column unique constraints. 

At the moment, describeTable doesn't figure out foreign keys or other
associations between tables.

BTW, listTables should include both tables and views.

I'd guess that the old PyDO oracle genscript contains more or less all
the SQL necessary for this, albeit in different form.  Also, take a
look at the other drivers that implement it; the SQL will be different
but the purpose and effect the same.

Cheers,

js


-- 
Jacob Smullyan
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC8VKQuqamFyFXXLIRAgfIAKCXhfCJpFni1PW3TEhyWDh01+ckeQCfbhNL
OpKtOxue51GWv0Wu1z1N+Sk=
=qCEv
-----END PGP SIGNATURE-----