Created
September 16, 2009 09:44
-
-
Save riffm/187966 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
from psycopg2 import connect | |
from DBSingleStyle import Param, to_format | |
if __name__=='__main__': | |
query = ('SELECT table_name, column_name, data_type \ | |
FROM information_schema.columns WHERE table_name=', Param(sys.argv[1])) | |
conn = connect("dbname='template1' user='postgres' host='localhost'") | |
cur = conn.cursor() | |
cur.execute(*to_format(query)) | |
for row in cur.fetchall(): | |
print row | |
conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment