changeset 319:3c58df9bcf14

now relying entirely on sqlalchemy connections
author Catherine Devlin <catherine.devlin@gmail.com>
date Tue, 31 Mar 2009 16:57:50 -0400
parents 0aad38fbc361
children af4106fca5d9
files sqlpython/sqlpython.py
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/sqlpython.py	Tue Mar 31 13:02:34 2009 -0400
+++ b/sqlpython/sqlpython.py	Tue Mar 31 16:57:50 2009 -0400
@@ -71,8 +71,8 @@
         self.curs = None
         self.no_connection()        
             
-    def url_connect(self, arg, mode=0):
-        eng = sqlalchemy.create_engine(arg) #create_engine refuses "mode" argument
+    def url_connect(self, arg):
+        eng = sqlalchemy.create_engine(arg) 
         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 '', 
@@ -112,14 +112,9 @@
         if orauser.upper() == 'SYS' and not modeval:
             print 'Privilege not specified for SYS, assuming SYSOPER'
             modeval = cx_Oracle.SYSOPER
-        if modeval == 0:   # can sqlalchemy connect as sysoper, sysdba?
-            result = self.url_connect('oracle://%s:%s@%s' % (orauser, orapass, oraserv), mode=modeval)
-            result['dbname'] = oraserv
-            return result
-        else:
-            self.conn = cx_Oracle.connect(orauser,orapass,oraserv,modeval)
-            result = {'user': orauser, 'rdbms': 'oracle', 'dbname': sid, 'conn': self.conn} 
-            return result
+        result = self.url_connect('oracle://%s:%s@%s?mode=%d' % (orauser, orapass, oraserv, modeval))
+        result['dbname'] = oraserv
+        return result
     
     connection_modes = {re.compile(' AS SYSDBA', re.IGNORECASE): cx_Oracle.SYSDBA, 
                         re.compile(' AS SYSOPER', re.IGNORECASE): cx_Oracle.SYSOPER}