Find out the schema with psycopg?

survivalist at gmail.com survivalist at gmail.com
Wed Dec 21 22:25:42 EST 2005


I am trying to discover the schema of a PostgreSQL database
programatically at runtime.

I'm using psycopg (I assume that's still the best library).  Is there a
way to query the schema other than opening a system pipe like "psql -d
'\d'", "psql -d '\d tablename'", etc.?

DBIAPI 2.0 shows that the Cursor object has a .description method that
describes rows, and there's the Type object.  But neither of these
appear to give you table names.

Is there something else I should look at?

Thanks in advance,

-S.




More information about the Python-list mailing list