From: Mike Bayer Date: Sun, 29 Aug 2010 22:13:18 +0000 (-0400) Subject: - The Session class is now present in sqlalchemy.orm.*. X-Git-Tag: rel_0_6_4~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fc7951674ceab85fb13936fc268547bb15ec54a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - The Session class is now present in sqlalchemy.orm.*. We're moving away from the usage of create_session(), which has non-standard defaults, for those situations where a one-step Session constructor is desired. Most users should stick with sessionmaker() for general use, however. --- diff --git a/CHANGES b/CHANGES index 98f37a3a62..a4e5c22834 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,13 @@ CHANGES for schemes that may be specifying ConcurrentModificationError in an "except:" clause. + + - The Session class is now present in sqlalchemy.orm.*. + We're moving away from the usage of create_session(), + which has non-standard defaults, for those situations + where a one-step Session constructor is desired. Most + users should stick with sessionmaker() for general use, + however. - An object that's been deleted now gets a flag 'deleted', which prohibits the object from diff --git a/lib/sqlalchemy/orm/__init__.py b/lib/sqlalchemy/orm/__init__.py index 50ea4c2838..55daeb3dbd 100644 --- a/lib/sqlalchemy/orm/__init__.py +++ b/lib/sqlalchemy/orm/__init__.py @@ -51,7 +51,7 @@ from sqlalchemy.orm.mapper import reconstructor, validates from sqlalchemy.orm import strategies from sqlalchemy.orm.query import AliasOption, Query from sqlalchemy.sql import util as sql_util -from sqlalchemy.orm.session import Session as _Session +from sqlalchemy.orm.session import Session from sqlalchemy.orm.session import object_session, sessionmaker, \ make_transient from sqlalchemy.orm.scoping import ScopedSession @@ -66,6 +66,7 @@ __all__ = ( 'Validator', 'PropComparator', 'Query', + 'Session', 'aliased', 'backref', 'class_mapper', @@ -173,7 +174,7 @@ def create_session(bind=None, **kwargs): kwargs.setdefault('autoflush', False) kwargs.setdefault('autocommit', True) kwargs.setdefault('expire_on_commit', False) - return _Session(bind=bind, **kwargs) + return Session(bind=bind, **kwargs) def relationship(argument, secondary=None, **kwargs): """Provide a relationship of a primary Mapper to a secondary Mapper.