changeset 477:920a45f244e8

setuptools optional
author catherine@dellzilla
date Fri, 12 Mar 2010 19:42:11 -0500
parents 4bd3145bff1b
children ad07a08cb792
files docs/source/intro.rst setup.py sqlpython/connect.txt sqlpython/connections.py
diffstat 4 files changed, 120 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/docs/source/intro.rst	Thu Mar 11 16:11:42 2010 -0500
+++ b/docs/source/intro.rst	Fri Mar 12 19:42:11 2010 -0500
@@ -74,7 +74,7 @@
 Bugs
 ----
 
-Please report bugs at http://trac-hg.assembla.com/sqlpython or to catherine.devlin@gmail.com.
+Please report bugs at http://www.assembla.com/spaces/sqlpython/tickets or to catherine.devlin@gmail.com.
 
 Origins
 -------
--- a/setup.py	Thu Mar 11 16:11:42 2010 -0500
+++ b/setup.py	Fri Mar 12 19:42:11 2010 -0500
@@ -1,5 +1,10 @@
-from setuptools import setup, find_packages
-
+try:
+    from setuptools import setup, find_packages
+except ImportError:
+    from distutils.core import setup
+    def find_packages():
+        return ['sqlpython']
+    
 classifiers = """Development Status :: 4 - Beta
 Intended Audience :: Information Technology
 License :: OSI Approved :: MIT License
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sqlpython/connect.txt	Fri Mar 12 19:42:11 2010 -0500
@@ -0,0 +1,110 @@
+SQL.No_Connection> connect testuser/testpassword@eqdev
+0:testuser@eqdev> connect oracle://testuser:testpassword@eqdev
+0:testuser@eqdev> connect --oracle testuser/testpassword@eqdev
+0:testuser@eqdev> connect --password=testpassword eqdev testuser
+Connection failure.
+Opens the DB connection.  Some sample valid connection strings:
+        
+        connect oracle://user:password@SID
+        connect postgres://user:password@hostname/dbname
+        connect user/password@SID  (Oracle is the default RDBMS target)
+        connect --postgres --hostname=hostname dbname username
+        connect --mysql dbname username
+Usage: connect [options] arg
+
+Options:
+  -h, --help            show this help message and exit
+  -a, --add             add connection (keep current connection)
+  -c, --close           close connection {N} (or current)
+  -C, --closeall        close all connections
+  --postgres            Connect to postgreSQL: `connect --postgres [DBNAME
+                        [USERNAME]]`
+  --oracle              Connect to an Oracle database
+  --mysql               Connect to a MySQL database
+  -H HOSTNAME, --hostname=HOSTNAME
+                        Machine where database is hosted
+  -p PORT, --port=PORT  Port to connect to
+  --password=PASSWORD   Password
+  -d DATABASE, --database=DATABASE
+                        Database name to connect to
+  -U USERNAME, --username=USERNAME
+                        Database user name to connect as
+
+0:testuser@eqdev> connect --postgres testplatform testuser
+Password: 
+0:testuser@testplatform> connect --postgres --password=testpassword testplatform testuser
+0:testuser@testplatform> connect --postgres --password=testpassword testplatform --username=testuser
+'NoneType' object has no attribute 'start'
+0:testuser@testplatform> connect --postgres --password=testpassword --username=testuser --database=testplatform
+0:testuser@testplatform> connect --postgres testuser/testpassword@testplatform
+Password: 
+Connection failure.
+Opens the DB connection.  Some sample valid connection strings:
+        
+        connect oracle://user:password@SID
+        connect postgres://user:password@hostname/dbname
+        connect user/password@SID  (Oracle is the default RDBMS target)
+        connect --postgres --hostname=hostname dbname username
+        connect --mysql dbname username
+Usage: connect [options] arg
+
+Options:
+  -h, --help            show this help message and exit
+  -a, --add             add connection (keep current connection)
+  -c, --close           close connection {N} (or current)
+  -C, --closeall        close all connections
+  --postgres            Connect to postgreSQL: `connect --postgres [DBNAME
+                        [USERNAME]]`
+  --oracle              Connect to an Oracle database
+  --mysql               Connect to a MySQL database
+  -H HOSTNAME, --hostname=HOSTNAME
+                        Machine where database is hosted
+  -p PORT, --port=PORT  Port to connect to
+  --password=PASSWORD   Password
+  -d DATABASE, --database=DATABASE
+                        Database name to connect to
+  -U USERNAME, --username=USERNAME
+                        Database user name to connect as
+
+0:testuser@testplatform> connect postgres://testuser:testpassword@testplatform
+Connection failure.
+Opens the DB connection.  Some sample valid connection strings:
+        
+        connect oracle://user:password@SID
+        connect postgres://user:password@hostname/dbname
+        connect user/password@SID  (Oracle is the default RDBMS target)
+        connect --postgres --hostname=hostname dbname username
+        connect --mysql dbname username
+Usage: connect [options] arg
+
+Options:
+  -h, --help            show this help message and exit
+  -a, --add             add connection (keep current connection)
+  -c, --close           close connection {N} (or current)
+  -C, --closeall        close all connections
+  --postgres            Connect to postgreSQL: `connect --postgres [DBNAME
+                        [USERNAME]]`
+  --oracle              Connect to an Oracle database
+  --mysql               Connect to a MySQL database
+  -H HOSTNAME, --hostname=HOSTNAME
+                        Machine where database is hosted
+  -p PORT, --port=PORT  Port to connect to
+  --password=PASSWORD   Password
+  -d DATABASE, --database=DATABASE
+                        Database name to connect to
+  -U USERNAME, --username=USERNAME
+                        Database user name to connect as
+
+0:testuser@testplatform> connect postgres://testuser:testpassword@localhost/testplatform
+0:testuser@testplatform> 
+0:testuser@testplatform> connect mysql://testuser:testpassword@localhost/testplatform
+0:testuser@testplatform> connect --mysql --password=testpassword --username=testuser --database=testplatform
+0:testuser@testplatform> connect --mysql --password=testpassword testplatform testuser
+0:testuser@testplatform> 
+
+
+fails:
+0:testuser@eqdev> connect --password=testpassword eqdev testuser
+0:testuser@testplatform> connect postgres://testuser:testpassword@testplatform
+0:testuser@testplatform> connect --postgres testuser/testpassword@testplatform
+0:testuser@eqdev> connect --password=testpassword eqdev testuser
--- a/sqlpython/connections.py	Thu Mar 11 16:11:42 2010 -0500
+++ b/sqlpython/connections.py	Fri Mar 12 19:42:11 2010 -0500
@@ -256,7 +256,7 @@
         picklefile = open(self.picklefile())
         schema = pickle.load(picklefile)
         picklefile.close()
-        newgerald = gerald_classes[self.rdbms](self.username, None)
+        newgerald = gerald_classes[self.rdbms](self.username, None, omit_error_objects=True)
         newgerald.connect(self.conn_data.gerald_uri())
         newgerald.schema = schema  
         newgerald.current = False
@@ -277,7 +277,7 @@
             except IOError:
                 pass
         self.db_instance.gerald.current = False
-        newgerald = gerald_classes[self.db_instance.rdbms](self.db_instance.username, self.db_instance.conn_data.gerald_uri())
+        newgerald = gerald_classes[self.db_instance.rdbms](self.db_instance.username, self.db_instance.conn_data.gerald_uri(), omit_error_objects=True)
         newgerald.descriptions = {}
         for (name, obj) in newgerald.schema.items():
             newgerald.descriptions[name] = ObjectDescriptor(name, obj)