Commits

Anonymous committed 4c04152

Added SA 0.8 support.

Comments (0)

Files changed (3)

sqlautocode/config.py

         engine = sqlalchemy.create_engine(url)
         test = engine.connect()
         test.close()
-    except sqlalchemy.exceptions.SQLAlchemyError, ex:
+    except sqlalchemy.exc.SQLAlchemyError, ex:
         parser.error('Could not connect to "%s": %s' % (url, ex))
 
 

sqlautocode/declarative.py

     from sqlalchemy.ext.declarative import _deferred_relationship
 except ImportError:
     #SA 0.5 support
-    from sqlalchemy.ext.declarative import _deferred_relation as _deferred_relationship
+    try:
+        from sqlalchemy.ext.declarative import _deferred_relation as _deferred_relationship
+    except ImportError:
+        #SA 0.8 support
+        from sqlalchemy.ext.declarative.clsregistry import _deferred_relationship
     
 from sqlalchemy.orm import relation, backref, class_mapper, Mapper
 

sqlautocode/tests/base.py

 
 environment =  Table('environment', metadata,
     Column(u'environment_id', Numeric(precision=10, scale=0, asdecimal=True), primary_key=True, nullable=False),
-            Column(u'environment_name', String(length=100, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
-            Column(u'database_host', String(length=100, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
-            Column(u'database_port', String(length=5, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
-            Column(u'database_sid', String(length=32, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
-            Column(u'database_user', String(length=100, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
-            Column(u'database_pass', String(length=100, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
+            Column(u'environment_name', String(length=100, convert_unicode=False), primary_key=False, nullable=False),
+            Column(u'database_host', String(length=100, convert_unicode=False), primary_key=False, nullable=False),
+            Column(u'database_port', String(length=5, convert_unicode=False), primary_key=False, nullable=False),
+            Column(u'database_sid', String(length=32, convert_unicode=False), primary_key=False, nullable=False),
+            Column(u'database_user', String(length=100, convert_unicode=False), primary_key=False, nullable=False),
+            Column(u'database_pass', String(length=100, convert_unicode=False), primary_key=False, nullable=False),
     
     
     )
 report =  Table('report', metadata,
     Column(u'report_id', Numeric(precision=10, scale=0, asdecimal=True), primary_key=True, nullable=False),
             Column(u'environment_id', Numeric(precision=10, scale=0, asdecimal=True), primary_key=False, nullable=False),
-            Column(u'report_name', String(length=50, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
-            Column(u'report_description', String(length=4000, convert_unicode=False, assert_unicode=None), primary_key=False),
+            Column(u'report_name', String(length=50, convert_unicode=False), primary_key=False, nullable=False),
+            Column(u'report_description', String(length=4000, convert_unicode=False), primary_key=False),
             Column(u'deleted', Numeric(precision=1, scale=0, asdecimal=True), primary_key=False, nullable=False),
             Column(u'created_date', DateTime(timezone=False), primary_key=False, nullable=False),
             Column(u'created_by', Numeric(precision=10, scale=0, asdecimal=True), primary_key=False, nullable=False),
     Column(u'ui_report_id', Numeric(precision=10, scale=0, asdecimal=True), primary_key=True, nullable=False),
             Column(u'report_id', Numeric(precision=10, scale=0, asdecimal=True), primary_key=False, nullable=False),
             Column(u'environment_id', Numeric(precision=10, scale=0, asdecimal=True), primary_key=False, nullable=False),
-            Column(u'ui_report_name', String(length=100, convert_unicode=False, assert_unicode=None), primary_key=False, nullable=False),
-            Column(u'ui_report_description', String(length=4000, convert_unicode=False, assert_unicode=None), primary_key=False),
+            Column(u'ui_report_name', String(length=100, convert_unicode=False), primary_key=False, nullable=False),
+            Column(u'ui_report_description', String(length=4000, convert_unicode=False), primary_key=False),
             Column(u'enabled', Numeric(precision=1, scale=0, asdecimal=True), primary_key=False, nullable=False),
             Column(u'deleted', Numeric(precision=1, scale=0, asdecimal=True), primary_key=False, nullable=False),
             Column(u'created_date', DateTime(timezone=False), primary_key=False, nullable=False),
     return metadata_multi
 
 
-    
+