[Tutor] Database Table Primary Keys

Glenn T Norton gtnorton at earthlink.net
Wed Nov 22 04:58:55 CET 2006


Tod Haren wrote:

>Using a DBAPI 2.0 module such as ADODBAPI, how can a I identify the
>primary key fields of a table.  cursor.desctription doesn't hold this
>info, unless I'm missing something.  I just don't see it in the
>documentation.  Maybe there's an SQL statement I haven't found yet.
>
>Is this even possible?  I'm sure I could get this info from ADOX and
>win32com, but that seems a little excessive at this stage.
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>  
>
Hi Tod,
When I need any kind of table meta data, I use "describe"
cursor.execute("DESCRIBE table")
I'm sure there are many different ways, but that's what I use.

Good Luck,
Glenn

-- 
"Ketchup. For the good times... " - Ketchup Advisory Board 
Glenn Norton
Application Developer
Nebraska.gov
1-402-471-2777
glenn at nebraska.gov



More information about the Tutor mailing list