diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-12 18:00:45 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-12 18:00:45 -0500 |
commit | 53aab63b6c24dfdcc249ada5c9d712dc42e5ae40 (patch) | |
tree | 04d0b282c7b5e2c43b2e46a0d87c242521dc3545 /lib/sqlalchemy | |
parent | de9ec22de972ec66f07db8b745108c6248bec6ad (diff) | |
download | sqlalchemy-53aab63b6c24dfdcc249ada5c9d712dc42e5ae40.tar.gz |
- remove some remaining sys.modules shenanigansrel_0_7b1
- The "sqlalchemy.exceptions" alias in sys.modules
has been removed. Base SQLA exceptions are
available via "from sqlalchemy import exc".
The "exceptions" alias for "exc" remains in
"sqlalchemy" for now, it's just not patched into
sys.modules.
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/__init__.py | 1 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/horizontal_shard.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/sqlsoup.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/collections.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/dependency.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/interfaces.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/properties.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/scoping.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/util.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/schema.py | 12 | ||||
-rw-r--r-- | lib/sqlalchemy/types.py | 2 |
13 files changed, 18 insertions, 25 deletions
diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index d54afa41c..d76afa49c 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -8,7 +8,6 @@ import inspect import sys import sqlalchemy.exc as exceptions -sys.modules['sqlalchemy.exceptions'] = exceptions from sqlalchemy.sql import ( alias, diff --git a/lib/sqlalchemy/ext/horizontal_shard.py b/lib/sqlalchemy/ext/horizontal_shard.py index 926c029d0..32c767e11 100644 --- a/lib/sqlalchemy/ext/horizontal_shard.py +++ b/lib/sqlalchemy/ext/horizontal_shard.py @@ -14,7 +14,7 @@ the source distrbution. """ -import sqlalchemy.exceptions as sa_exc +from sqlalchemy import exc as sa_exc from sqlalchemy import util from sqlalchemy.orm.session import Session from sqlalchemy.orm.query import Query diff --git a/lib/sqlalchemy/ext/sqlsoup.py b/lib/sqlalchemy/ext/sqlsoup.py index ded8a35cd..f76a175a4 100644 --- a/lib/sqlalchemy/ext/sqlsoup.py +++ b/lib/sqlalchemy/ext/sqlsoup.py @@ -367,7 +367,7 @@ from sqlalchemy.orm import scoped_session, sessionmaker, mapper, \ class_mapper, relationship, session,\ object_session, attributes from sqlalchemy.orm.interfaces import MapperExtension, EXT_CONTINUE -from sqlalchemy.exceptions import SQLAlchemyError, InvalidRequestError, ArgumentError +from sqlalchemy.exc import SQLAlchemyError, InvalidRequestError, ArgumentError from sqlalchemy.sql import expression diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index e7b04c4af..485210d1c 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -16,9 +16,9 @@ defines a large part of the ORM's interactivity. import operator from operator import itemgetter -from sqlalchemy import util, event +from sqlalchemy import util, event, exc as sa_exc from sqlalchemy.orm import interfaces, collections, events -import sqlalchemy.exceptions as sa_exc + mapperutil = util.importlater("sqlalchemy.orm", "util") diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py index 4b03a50db..142519206 100644 --- a/lib/sqlalchemy/orm/collections.py +++ b/lib/sqlalchemy/orm/collections.py @@ -108,9 +108,8 @@ import operator import sys import weakref -import sqlalchemy.exceptions as sa_exc from sqlalchemy.sql import expression -from sqlalchemy import schema, util +from sqlalchemy import schema, util, exc as sa_exc __all__ = ['collection', 'collection_adapter', diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py index 5b513c9c8..402d031c3 100644 --- a/lib/sqlalchemy/orm/dependency.py +++ b/lib/sqlalchemy/orm/dependency.py @@ -8,8 +8,7 @@ """ -from sqlalchemy import sql, util -import sqlalchemy.exceptions as sa_exc +from sqlalchemy import sql, util, exc as sa_exc from sqlalchemy.orm import attributes, exc, sync, unitofwork, \ util as mapperutil from sqlalchemy.orm.interfaces import ONETOMANY, MANYTOONE, MANYTOMANY diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index f68d2a289..39bc61290 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -18,7 +18,7 @@ classes within should be considered mostly private. from itertools import chain -import sqlalchemy.exceptions as sa_exc +from sqlalchemy import exc as sa_exc from sqlalchemy import log, util, event from sqlalchemy.sql import expression deque = util.importlater('collections').deque diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index 1815901e8..68e3196df 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -11,8 +11,7 @@ mapped attributes. """ -from sqlalchemy import sql, util, log -import sqlalchemy.exceptions as sa_exc +from sqlalchemy import sql, util, log, exc as sa_exc from sqlalchemy.sql.util import ClauseAdapter, criterion_as_pairs, \ join_condition from sqlalchemy.sql import operators, expression diff --git a/lib/sqlalchemy/orm/scoping.py b/lib/sqlalchemy/orm/scoping.py index 1068f6704..53e5e5d1f 100644 --- a/lib/sqlalchemy/orm/scoping.py +++ b/lib/sqlalchemy/orm/scoping.py @@ -4,7 +4,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -import sqlalchemy.exceptions as sa_exc +from sqlalchemy import exc as sa_exc from sqlalchemy.util import ScopedRegistry, ThreadLocalRegistry, warn from sqlalchemy.orm import class_mapper from sqlalchemy.orm import exc as orm_exc diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index d650bf9b1..53f29ffeb 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -8,8 +8,7 @@ import weakref from itertools import chain -import sqlalchemy.exceptions as sa_exc -from sqlalchemy import util, sql, engine, log +from sqlalchemy import util, sql, engine, log, exc as sa_exc from sqlalchemy.sql import util as sql_util, expression from sqlalchemy.orm import ( SessionExtension, attributes, exc, query, unitofwork, util as mapperutil, state diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index a1a50f2ad..ecdf804bd 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -4,8 +4,8 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -import sqlalchemy.exceptions as sa_exc -from sqlalchemy import sql, util, event + +from sqlalchemy import sql, util, event, exc as sa_exc from sqlalchemy.sql import expression, util as sql_util, operators from sqlalchemy.orm.interfaces import MapperExtension, EXT_CONTINUE,\ PropComparator, MapperProperty diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 95f0eb8ec..3a4bd90ce 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -34,7 +34,7 @@ from sqlalchemy import event, events sqlutil = util.importlater("sqlalchemy.sql", "util") url = util.importlater("sqlalchemy.engine", "url") - +sqltypes = util.importlater("sqlalchemy", "types") __all__ = ['SchemaItem', 'Table', 'Column', 'ForeignKey', 'Sequence', 'Index', 'ForeignKeyConstraint', 'PrimaryKeyConstraint', 'CheckConstraint', @@ -318,7 +318,7 @@ class Table(SchemaItem, expression.TableClause): def _autoincrement_column(self): for col in self.primary_key: if col.autoincrement and \ - issubclass(col.type._type_affinity, types.Integer) and \ + issubclass(col.type._type_affinity, sqltypes.Integer) and \ not col.foreign_keys and \ isinstance(col.default, (type(None), Sequence)) and \ (col.server_default is None or col.server_default.reflected): @@ -679,9 +679,9 @@ class Column(SchemaItem, expression.ColumnClause): if args: coltype = args[0] - if (isinstance(coltype, types.TypeEngine) or + if (isinstance(coltype, sqltypes.TypeEngine) or (isinstance(coltype, type) and - issubclass(coltype, types.TypeEngine))): + issubclass(coltype, sqltypes.TypeEngine))): if type_ is not None: raise exc.ArgumentError( "May not pass type_ positionally and as a keyword.") @@ -709,7 +709,7 @@ class Column(SchemaItem, expression.ColumnClause): if '_proxies' in kwargs: self.proxies = kwargs.pop('_proxies') # otherwise, add DDL-related events - elif isinstance(self.type, types.SchemaType): + elif isinstance(self.type, sqltypes.SchemaType): self.type._set_parent_with_dispatch(self) if self.default is not None: @@ -1185,7 +1185,7 @@ class ForeignKey(SchemaItem): _column = self._colspec # propagate TypeEngine to parent if it didn't have one - if isinstance(self.parent.type, types.NullType): + if isinstance(self.parent.type, sqltypes.NullType): self.parent.type = _column.type return _column diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 3a1415796..a46cb1530 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -26,8 +26,6 @@ import codecs from sqlalchemy import exc, schema from sqlalchemy.sql import expression, operators -import sys -schema.types = expression.sqltypes = sys.modules['sqlalchemy.types'] from sqlalchemy.util import pickle from sqlalchemy.util.compat import decimal from sqlalchemy.sql.visitors import Visitable |