summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sqlalchemy/orm/session.py1
-rw-r--r--lib/sqlalchemy/sql/expression.py21
-rw-r--r--lib/sqlalchemy/sql/util.py1
-rw-r--r--lib/sqlalchemy/types.py6
4 files changed, 13 insertions, 16 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py
index 5b33ca1a2..42b1b3cb5 100644
--- a/lib/sqlalchemy/orm/session.py
+++ b/lib/sqlalchemy/orm/session.py
@@ -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
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 70e26cfcc..6dd9d8baf 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -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
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index dda5d2d28..b81906396 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -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" \
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py
index 1fdf643c7..4d86dc362 100644
--- a/lib/sqlalchemy/types.py
+++ b/lib/sqlalchemy/types.py
@@ -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)