[mod_python] SQL question

Luis M. Gonzalez luismg at gmx.net
Wed Feb 1 11:06:37 EST 2006

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060201/d2b00a06/attachment.html

More information about the Mod_python mailing list