]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Merged reference fixes from r2986
authorJason Kirtland <jek@discorporate.us>
Thu, 19 Jul 2007 23:46:37 +0000 (23:46 +0000)
committerJason Kirtland <jek@discorporate.us>
Thu, 19 Jul 2007 23:46:37 +0000 (23:46 +0000)
lib/sqlalchemy/__init__.py
lib/sqlalchemy/databases/information_schema.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/sql.py

index e55d0ab57ef26836db5b81c668c8af66166eb58d..ad26151317d845bee8ba8de84f35136ff787ba2d 100644 (file)
@@ -25,9 +25,8 @@ def __figure_version():
             return '(not installed)'
     except:
         return '(not installed)'
-        
+
 __version__ = __figure_version()
-    
+
 def global_connect(*args, **kwargs):
     default_metadata.connect(*args, **kwargs)
-    
\ No newline at end of file
index 54c47b6f42d66dad79f7baf45ae74bbf2dce6caa..81c44dcaa49d8079b6279e89d9c5d35006274f79 100644 (file)
@@ -1,28 +1,22 @@
-import sqlalchemy.sql as sql
-import sqlalchemy.engine as engine
-import sqlalchemy.schema as schema
-import sqlalchemy.ansisql as ansisql
-import sqlalchemy.types as sqltypes
-import sqlalchemy.exceptions as exceptions
-from sqlalchemy import *
-from sqlalchemy.ansisql import *
+from sqlalchemy import sql, schema, exceptions, select, MetaData, Table, Column, String, Integer
+from sqlalchemy.schema import PassiveDefault, ForeignKeyConstraint
 
 ischema = MetaData()
 
-schemata = schema.Table("schemata", ischema,
+schemata = Table("schemata", ischema,
     Column("catalog_name", String),
     Column("schema_name", String),
     Column("schema_owner", String),
     schema="information_schema")
 
-tables = schema.Table("tables", ischema,
+tables = Table("tables", ischema,
     Column("table_catalog", String),
     Column("table_schema", String),
     Column("table_name", String),
     Column("table_type", String),
     schema="information_schema")
 
-columns = schema.Table("columns", ischema,
+columns = Table("columns", ischema,
     Column("table_schema", String),
     Column("table_name", String),
     Column("column_name", String),
@@ -35,21 +29,21 @@ columns = schema.Table("columns", ischema,
     Column("column_default", Integer),
     schema="information_schema")
     
-constraints = schema.Table("table_constraints", ischema,
+constraints = Table("table_constraints", ischema,
     Column("table_schema", String),
     Column("table_name", String),
     Column("constraint_name", String),
     Column("constraint_type", String),
     schema="information_schema")
 
-column_constraints = schema.Table("constraint_column_usage", ischema,
+column_constraints = Table("constraint_column_usage", ischema,
     Column("table_schema", String),
     Column("table_name", String),
     Column("column_name", String),
     Column("constraint_name", String),
     schema="information_schema")
 
-pg_key_constraints = schema.Table("key_column_usage", ischema,
+pg_key_constraints = Table("key_column_usage", ischema,
     Column("table_schema", String),
     Column("table_name", String),
     Column("column_name", String),
@@ -57,7 +51,7 @@ pg_key_constraints = schema.Table("key_column_usage", ischema,
     Column("ordinal_position", Integer),
     schema="information_schema")
 
-#mysql_key_constraints = schema.Table("key_column_usage", ischema,
+#mysql_key_constraints = Table("key_column_usage", ischema,
 #    Column("table_schema", String),
 #    Column("table_name", String),
 #    Column("column_name", String),
@@ -69,7 +63,7 @@ pg_key_constraints = schema.Table("key_column_usage", ischema,
 
 key_constraints = pg_key_constraints
 
-ref_constraints = schema.Table("referential_constraints", ischema,
+ref_constraints = Table("referential_constraints", ischema,
     Column("constraint_catalog", String),
     Column("constraint_schema", String),
     Column("constraint_name", String),
@@ -97,7 +91,7 @@ class ISchema(object):
             try:
                 gen_tbl = globals()['gen_'+name]
             except KeyError:
-                raise ArgumentError('information_schema table %s not found' % name)
+                raise exceptions.ArgumentError('information_schema table %s not found' % name)
             self.cache[name] = gen_tbl.toengine(self.engine)
         return self.cache[name]
 
@@ -186,10 +180,10 @@ def reflecttable(connection, table, ischema_names):
             if current_schema == referred_schema:
                 referred_schema = table.schema
             if referred_schema is not None:
-                schema.Table(referred_table, table.metadata, autoload=True, schema=referred_schema, autoload_with=connection)
+                Table(referred_table, table.metadata, autoload=True, schema=referred_schema, autoload_with=connection)
                 refspec = ".".join([referred_schema, referred_table, referred_column])
             else:
-                schema.Table(referred_table, table.metadata, autoload=True, autoload_with=connection)
+                Table(referred_table, table.metadata, autoload=True, autoload_with=connection)
                 refspec = ".".join([referred_table, referred_column])
             if constrained_column not in fk[0]:
                 fk[0].append(constrained_column)
index 3a86001d5eaee1d41609d7788245f7e3b495e154..d0ca36515d02640afd4aa0fbf9672b73399dc18f 100644 (file)
@@ -883,7 +883,7 @@ class ResultProxy(object):
                 rec = (type, type.dialect_impl(self.dialect), i)
 
                 if rec[0] is None:
-                    raise DBAPIError("None for metadata " + colname)
+                    raise exceptions.DBAPIError("None for metadata " + colname)
                 if self.__props.setdefault(colname.lower(), rec) is not rec:
                     self.__props[colname.lower()] = (type, ResultProxy.AmbiguousColumn(colname), 0)
                 self.__keys.append(colname)
index fecb5350b7c8b2bf3692ee473e7d9814775ff641..8b454947efc1911f142e8fe0a54bd52ca5ae4aea 100644 (file)
@@ -2163,10 +2163,10 @@ class _UnaryExpression(ColumnElement):
         visitor.visit_unary(self)
 
     def compare(self, other):
-        """Compare this ``_UnaryClause`` against the given ``ClauseElement``."""
+        """Compare this ``_UnaryExpression`` against the given ``ClauseElement``."""
 
         return (
-            isinstance(other, _UnaryClause) and self.operator == other.operator and
+            isinstance(other, _UnaryExpression) and self.operator == other.operator and
             self.modifier == other.modifier and 
             self.element.compare(other.element)
         )