# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-from types import *
-from sql import *
-from schema import *
+from sqlalchemy.types import *
+from sqlalchemy.sql import *
+from sqlalchemy.schema import *
from sqlalchemy.orm import *
from sqlalchemy.engine import create_engine
in the sql module."""
from sqlalchemy import schema, sql, engine, util, sql_util
-import sqlalchemy.engine.default as default
+from sqlalchemy.engine import default
import string, re, sets, weakref
ANSI_FUNCS = sets.ImmutableSet([
import sqlalchemy.ansisql as ansisql
import sqlalchemy.types as sqltypes
import sqlalchemy.exceptions as exceptions
-import information_schema as ischema
+from sqlalchemy.databases import information_schema as ischema
from sqlalchemy import *
import re
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import sqlalchemy.databases
-
-from base import *
-import strategies
+from sqlalchemy import databases
+from sqlalchemy.engine.base import *
+from sqlalchemy.engine import strategies
import re
def engine_descriptors():
from sqlalchemy import schema, exceptions, util, sql, types
-import sqlalchemy.pool
+from sqlalchemy import pool as poollib
import StringIO, sys, re
-import base
+from sqlalchemy.engine import base
"""provides default implementations of the engine interfaces"""
kwargs.setdefault('echo', False)
kwargs.setdefault('use_threadlocal',True)
if poolclass is None:
- poolclass = sqlalchemy.pool.QueuePool
+ poolclass = poollib.QueuePool
dbapi = dialect.dbapi()
if dbapi is None:
raise exceptions.InvalidRequestError("Cant get DBAPI module for dialect '%s'" % dialect)
creator = kwargs.pop('creator', connect)
self._pool = poolclass(creator, **kwargs)
else:
- if isinstance(pool, sqlalchemy.pool.DBProxy):
+ if isinstance(pool, poollib.DBProxy):
self._pool = pool.get_pool(*cargs, **cparams)
else:
self._pool = pool
from sqlalchemy import schema, exceptions, util, sql, types
import StringIO, sys, re
-import base, default
+from sqlalchemy.engine import base, default
"""provides a thread-local transactional wrapper around the basic ComposedSQLEngine. multiple calls to engine.connect()
will return the same connection for the same thread. also provides begin/commit methods on the engine itself
import re
import cgi
import urllib
-import sqlalchemy.exceptions as exceptions
+from sqlalchemy import exceptions
"""provides the URL object as well as the make_url parsing function."""
the mapper package provides object-relational functionality, building upon the schema and sql
packages and tying operations to class properties and constructors.
"""
-from sqlalchemy import sql, schema, engine, util, exceptions
-from mapper import *
-from mapper import mapper_registry
-import mapper as mapperlib
-from query import Query
-from util import polymorphic_union
-import properties, strategies
-from session import Session as create_session
+from sqlalchemy import exceptions
+from sqlalchemy.orm.mapper import *
+from sqlalchemy.orm.mapper import mapper_registry, ExtensionOption
+from sqlalchemy.orm.query import Query
+from sqlalchemy.orm.util import polymorphic_union
+from sqlalchemy.orm import properties, strategies
+from sqlalchemy.orm.session import Session as create_session
__all__ = ['relation', 'backref', 'eagerload', 'lazyload', 'noload', 'deferred', 'defer', 'undefer', 'extension',
- 'mapper', 'clear_mappers', 'clear_mapper', 'sql', 'class_mapper', 'object_mapper', 'MapperExtension', 'Query',
+ 'mapper', 'clear_mappers', 'clear_mapper', 'class_mapper', 'object_mapper', 'MapperExtension', 'Query',
'cascade_mappers', 'polymorphic_union', 'create_session', 'synonym', 'contains_eager', 'EXT_PASS'
]
beginning of the list of extensions that will be called in the context of the Query.
used with query.options()."""
- return mapperlib.ExtensionOption(ext)
+ return ExtensionOption(ext)
def eagerload(name):
"""return a MapperOption that will convert the property of the given name
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from sqlalchemy import util
-import util as orm_util
-import weakref
+from sqlalchemy.orm import util as orm_util
from sqlalchemy import logging
+import weakref
class InstrumentedAttribute(object):
"""a property object that instruments attribute access on object instances. All methods correspond to
"""bridges the PropertyLoader (i.e. a relation()) and the UOWTransaction
together to allow processing of scalar- and list-based dependencies at flush time."""
-import sync
-from sync import ONETOMANY,MANYTOONE,MANYTOMANY
+from sqlalchemy.orm import sync
+from sqlalchemy.orm.sync import ONETOMANY,MANYTOONE,MANYTOMANY
from sqlalchemy import sql, util
-import session as sessionlib
+from sqlalchemy.orm import session as sessionlib
def create_dependency_processor(prop):
types = {
from sqlalchemy import sql, schema, util, exceptions, logging
from sqlalchemy import sql_util as sqlutil
-import util as mapperutil
-import sync
-from interfaces import MapperProperty, MapperOption, OperationContext
-import query as querylib
-import session as sessionlib
+from sqlalchemy.orm import util as mapperutil
+from sqlalchemy.orm import sync
+from sqlalchemy.orm.interfaces import MapperProperty, MapperOption, OperationContext
import weakref
__all__ = ['Mapper', 'MapperExtension', 'class_mapper', 'object_mapper', 'EXT_PASS']
if not self.non_primary and (mapper_registry.has_key(self.class_key)):
raise exceptions.ArgumentError("Class '%s' already has a primary mapper defined with entity name '%s'. Use non_primary=True to create a non primary Mapper, or to create a new primary mapper, remove this mapper first via sqlalchemy.orm.clear_mapper(mapper), or preferably sqlalchemy.orm.clear_mappers() to clear all mappers." % (self.class_, self.entity_name))
- sessionlib.attribute_manager.reset_class_managed(self.class_)
+ attribute_manager.reset_class_managed(self.class_)
oldinit = self.class_.__init__
def init(self, *args, **kwargs):
# this gets the AttributeManager to do some pre-initialization,
# in order to save on KeyErrors later on
- sessionlib.attribute_manager.init_attr(self)
+ attribute_manager.init_attr(self)
if kwargs.has_key('_sa_session'):
session = kwargs.pop('_sa_session')
def instances(self, cursor, session, *mappers, **kwargs):
"""return a list of mapped instances corresponding to the rows in a given ResultProxy."""
- return querylib.Query(self, session).instances(cursor, *mappers, **kwargs)
+ import sqlalchemy.orm.query
+ return sqlalchemy.orm.Query(self, session).instances(cursor, *mappers, **kwargs)
def identity_key_from_row(self, row):
"""return an identity-map key for use in storing/retrieving an item from the identity map.
# this gets the AttributeManager to do some pre-initialization,
# in order to save on KeyErrors later on
- sessionlib.attribute_manager.init_attr(obj)
+ attribute_manager.init_attr(obj)
return obj
to handle flush-time dependency sorting and processing."""
from sqlalchemy import sql, schema, util, exceptions, sql_util, logging
-import mapper
-import sync
-import strategies
-import attributes
-import session as sessionlib
-import dependency
-import util as mapperutil
+from sqlalchemy.orm import mapper, sync, strategies, attributes, dependency
+from sqlalchemy.orm import session as sessionlib
+from sqlalchemy.orm import util as mapperutil
import sets, random
-from interfaces import *
+from sqlalchemy.orm.interfaces import *
class SynonymProperty(MapperProperty):
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import session as sessionlib
from sqlalchemy import sql, util, exceptions, sql_util, logging
-
-import mapper
-from interfaces import OperationContext
+from sqlalchemy.orm import mapper
+from sqlalchemy.orm.interfaces import OperationContext
__all__ = ['Query', 'QueryContext', 'SelectionContext']
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from sqlalchemy import util, exceptions, sql
-import unitofwork, query
+from sqlalchemy.orm import unitofwork, query
+from sqlalchemy.orm.mapper import object_mapper as _object_mapper
+from sqlalchemy.orm.mapper import class_mapper as _class_mapper
import weakref
import sqlalchemy
"""deprecated; a synynom for merge()"""
return self.merge(*args, **kwargs)
-def _object_mapper(obj):
- return sqlalchemy.orm.object_mapper(obj)
-
-def _class_mapper(class_, **kwargs):
- return sqlalchemy.orm.class_mapper(class_, **kwargs)
# this is the AttributeManager instance used to provide attribute behavior on objects.
# to all the "global variable police" out there: its a stateless object.
return None
unitofwork.object_session = object_session
-
+from sqlalchemy.orm import mapper
+mapper.attribute_manager = attribute_manager
\ No newline at end of file
"""sqlalchemy.orm.interfaces.LoaderStrategy implementations, and related MapperOptions."""
from sqlalchemy import sql, schema, util, exceptions, sql_util, logging
-import mapper, query
-from interfaces import *
-import session as sessionlib
-import util as mapperutil
+from sqlalchemy.orm import mapper, query
+from sqlalchemy.orm.interfaces import *
+from sqlalchemy.orm import session as sessionlib
+from sqlalchemy.orm import util as mapperutil
import sets, random
-import sqlalchemy.sql as sql
-import sqlalchemy.schema as schema
-import sqlalchemy.exceptions as exceptions
+from sqlalchemy import sql, schema, exceptions
from sqlalchemy import logging
-import util as mapperutil
+from sqlalchemy.orm import util as mapperutil
"""contains the ClauseSynchronizer class, which is used to map attributes between two objects
in a manner corresponding to a SQL clause that compares column values."""
"""
from sqlalchemy import util, logging, topological
-import sqlalchemy
-import attributes
+from sqlalchemy.orm import attributes
+from sqlalchemy.orm.mapper import object_mapper, class_mapper
from sqlalchemy.exceptions import *
import StringIO
import weakref
class DependencySorter(topological.QueueDependencySorter):
pass
-def object_mapper(obj):
- return sqlalchemy.object_mapper(obj)
-
-def class_mapper(class_):
- return sqlalchemy.class_mapper(class_)
-
attribute_manager = UOWAttributeManager()
-import unitofwork
+from sqlalchemy.orm import unitofwork
"""dumps out a string representation of a UOWTask structure"""
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-import sqlalchemy.util as util
-import sqlalchemy.sql as sql
+from sqlalchemy import sql, util
class CascadeOptions(object):
"""keeps track of the options sent to relation().cascade"""
import pickle
from sqlalchemy import util, exceptions, logging
-import sqlalchemy.queue as Queue
+from sqlalchemy import queue as Queue
try:
import thread
from sqlalchemy import util, exceptions
from sqlalchemy import types as sqltypes
import string, re, random, sets
-types = __import__('types')
__all__ = ['text', 'table', 'column', 'func', 'select', 'update', 'insert', 'delete', 'join', 'and_', 'or_', 'not_', 'between_', 'case', 'cast', 'union', 'union_all', 'null', 'desc', 'asc', 'outerjoin', 'alias', 'subquery', 'literal', 'bindparam', 'exists', 'extract','AbstractDialect', 'ClauseParameters', 'ClauseVisitor', 'Executor', 'Compiled', 'ClauseElement', 'ColumnElement', 'ColumnCollection', 'FromClause', 'TableClause', 'Select', 'Alias', 'CompoundSelect','Join', 'Selectable']
"""
import string, StringIO
from sets import *
-import sqlalchemy.util as util
+from sqlalchemy import util
from sqlalchemy.exceptions import *
class QueueDependencySorter(object):
'SMALLINT', 'DATE', 'TIME'
]
-import sqlalchemy.util as util
-import sqlalchemy.exceptions as exceptions
+from sqlalchemy import util, exceptions
try:
import cPickle as pickle
except:
import dummy_thread as thread
import dummy_threading as threading
-from exceptions import *
+from sqlalchemy.exceptions import *
import __builtin__
try: