changeset 385:0f019dfb795f

new file for gerald objects
author catherine@DellZilla
date Thu, 13 Aug 2009 14:33:55 -0400
parents 9d0a3ab7f573
children e3dd9e4467d1
files sqlpython/sqlpy_gerald.py sqlpython/sqlpython.py
diffstat 2 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /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)
--- 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