[mod_python] SQL question

Nick nick at dd.revealed.net
Wed Feb 1 12:09:51 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Unlike jdbc, the Python DB API spec has only very basic metadata
information available in the description attribute of a cursor object.
Most SQL databases have their metadata available in some way, but it's
different for almost every vendor out there.  It'd be a great
contribution if someone could make a library that implements this for
some of the most popular vendors in Python.

Nick

Luis M. Gonzalez wrote:
|
| Hi folks,
|
| First of all, let me apologize for asking a question that is not
| specific to mod_python,
| but I think that it could be of interest to many of you:
|
| I wrote a script that creates authomatic administration pages for
| databases.
| For a given database, whose name is pased as parameter to the script, a
| fully functional administration interface is created.
| This interface allows me to insert, update or delete records in any
| table of the database, and all these actions are accessed through a web
| page with links
| to each of the database's tables.
|
| There's only one problem with it.
| The script assumes that the first field of each table is a primary key,
| and this is necessary for performing updates on the table.
| In those cases where the tables don't have a primary key, or when the
| primary key is composed of two fields, the update cannot be performed
| correctly.
|
| The question is:
| Is there any way to figure out the primary key of a table?
| Perhaps through a special type of query or function?
| I've been reading the mysql documentation but I couldn't find any
| solution, although I'm sure there might be a simple way to do it...
|
| Any hint would be highly appreciated...
| If anyone wants to check the script, I'd be glad to send it by email.
|
| Regards,
| Luis
|
|
| ------------------------------------------------------------------------
|
| _______________________________________________
| Mod_python mailing list
| Mod_python at modpython.org
| http://mailman.modpython.org/mailman/listinfo/mod_python
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD4Otfv4zJ7LQ+i84RAqjGAJ4l1piJ0CMnP8DdXLHMVLi2D18XAQCg3Pv0
Yh+pZi1GzD6mzKwcvCSysFc=
=LDLg
-----END PGP SIGNATURE-----


More information about the Mod_python mailing list