# HG changeset patch # User catherine@DellZilla # Date 1250188435 14400 # Node ID 0f019dfb795f5e183eefc9caa6552a3bf121ed53 # Parent 9d0a3ab7f57364446443bc1138ddcb24a5432253 new file for gerald objects diff -r 9d0a3ab7f573 -r 0f019dfb795f sqlpython/sqlpy_gerald.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sqlpython/sqlpy_gerald.py Thu Aug 13 14:33:55 2009 -0400 @@ -0,0 +1,22 @@ +import gerald + +class SchemaSet(object): + def __init__(self, connection, rdbms, connect_string): + self.schemas = {} + curs = connection.cursor() + if rdbms == 'postgres': + curs.execute('SELECT schema_name FROM information_schema.schemata') + for row in curs.fetchall(): + schema = row[0] + self.schemas[schema] = gerald.PostgresSchema(schema, connect_string) + elif rdbms == 'oracle': + curs.execute('SELECT DISTINCT owner FROM all_objects') + for row in curs.fetchall(): + schema = row[0] + + + +import psycopg2 +connstr = 'postgres:/catherine:catherine@localhost/catherine' +conn = psycopg2.connect("dbname='catherine' user='catherine' password='catherine' host='localhost'") +ss = SchemaSet(conn, 'postgres', connstr) diff -r 9d0a3ab7f573 -r 0f019dfb795f sqlpython/sqlpython.py --- a/sqlpython/sqlpython.py Thu Aug 13 13:20:30 2009 -0400 +++ b/sqlpython/sqlpython.py Thu Aug 13 14:33:55 2009 -0400 @@ -100,7 +100,7 @@ self.conn = eng.connect().connection conn = {'conn': self.conn, 'prompt': self.prompt, 'dbname': eng.url.database, 'rdbms': eng.url.drivername, 'user': eng.url.username or '', - 'eng': eng} + 'eng': eng, 'connect_string': arg} return conn def ora_connect(self, arg): modeval = 0