]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
remove a few superfluous imports
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 29 Apr 2010 18:10:28 +0000 (14:10 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 29 Apr 2010 18:10:28 +0000 (14:10 -0400)
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/sql/expression.py
lib/sqlalchemy/sql/util.py
lib/sqlalchemy/types.py

index 5b33ca1a2acdb69a2fe950bc7f2ac3ec583ab706..42b1b3cb5447e7206f46831697aff142cc1c2452 100644 (file)
@@ -1616,7 +1616,6 @@ def _state_session(state):
     return None
 
 # Lazy initialization to avoid circular imports
-unitofwork.object_session = object_session
 unitofwork._state_session = _state_session
 from sqlalchemy.orm import mapper
 mapper._expire_state = _expire_state
index 70e26cfccd630a053ff9b9a2aedd6dc142c41900..6dd9d8baf3f7347b05d20b682f2b7da86acb1df7 100644 (file)
@@ -34,8 +34,8 @@ from sqlalchemy.sql import operators
 from sqlalchemy.sql.visitors import Visitable, cloned_traverse
 import operator
 
-functions, schema, sql_util, sqltypes = None, None, None, None
-DefaultDialect, ClauseAdapter, Annotated = None, None, None
+functions, sql_util, sqltypes = None, None, None
+DefaultDialect = None
 
 __all__ = [
     'Alias', 'ClauseElement',
@@ -1075,10 +1075,10 @@ class ClauseElement(Visitable):
         dictionary.
         
         """
-        global Annotated
-        if Annotated is None:
-            from sqlalchemy.sql.util import Annotated
-        return Annotated(self, values)
+        global sql_util
+        if sql_util is None:
+            from sqlalchemy.sql import util as sql_util
+        return sql_util.Annotated(self, values)
 
     def _deannotate(self):
         """return a copy of this ClauseElement with an empty annotations
@@ -1973,10 +1973,11 @@ class FromClause(Selectable):
         object, returning a copy of this :class:`FromClause`.
         
         """
-        global ClauseAdapter
-        if ClauseAdapter is None:
-            from sqlalchemy.sql.util import ClauseAdapter
-        return ClauseAdapter(alias).traverse(self)
+
+        global sql_util
+        if sql_util is None:
+            from sqlalchemy.sql import util as sql_util
+        return sql_util.ClauseAdapter(alias).traverse(self)
 
     def correspond_on_equivalents(self, column, equivalents):
         """Return corresponding_column for the given column, or if None
index dda5d2d28bc2dfdca84e0bc14caf0b425545b90a..b81906396f067a134c574fa980e47316e1471dbb 100644 (file)
@@ -288,7 +288,6 @@ class Annotated(object):
 # so that the resulting objects are pickleable.
 annotated_classes = {}
 
-from sqlalchemy.sql import expression
 for cls in expression.__dict__.values() + [schema.Column, schema.Table]:
     if isinstance(cls, type) and issubclass(cls, expression.ClauseElement):
         exec "class Annotated%s(Annotated, cls):\n" \
index 1fdf643c750ab32682ade2891290891fd4eeb640..4d86dc3625424fd92fa166aafc4627f47704f97c 100644 (file)
@@ -1285,9 +1285,8 @@ class SchemaType(object):
     def create(self, bind=None, checkfirst=False):
         """Issue CREATE ddl for this type, if applicable."""
         
-        from sqlalchemy.schema import _bind_or_error
         if bind is None:
-            bind = _bind_or_error(self)
+            bind = schema._bind_or_error(self)
         t = self.dialect_impl(bind.dialect)
         if t is not self and isinstance(t, SchemaType):
             t.create(bind=bind, checkfirst=checkfirst)
@@ -1295,9 +1294,8 @@ class SchemaType(object):
     def drop(self, bind=None, checkfirst=False):
         """Issue DROP ddl for this type, if applicable."""
 
-        from sqlalchemy.schema import _bind_or_error
         if bind is None:
-            bind = _bind_or_error(self)
+            bind = schema._bind_or_error(self)
         t = self.dialect_impl(bind.dialect)
         if t is not self and isinstance(t, SchemaType):
             t.drop(bind=bind, checkfirst=checkfirst)