summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/session.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-10-15 23:00:06 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-10-15 23:00:06 +0000
commiteb6f1f87f6f632c16bde4b8e947f6e302e7c5c8b (patch)
treebb16d8805115990e603fe1da93251f93ef5f1c3e /lib/sqlalchemy/orm/session.py
parent53f1c775db8f58ed33f3e35bbb3bd36961442c0c (diff)
downloadsqlalchemy-eb6f1f87f6f632c16bde4b8e947f6e302e7c5c8b.tar.gz
deprecations per [ticket:1498]:
- deprecated PassiveDefault - use DefaultClause. - the BINARY and MSBinary types now generate "BINARY" in all cases. Omitting the "length" parameter will generate "BINARY" with no length. Use BLOB to generate an unlengthed binary column. - the "quoting='quoted'" argument to MSEnum/ENUM is deprecated. It's best to rely upon the automatic quoting. - "shortname" attribute on bindparam() is removed. - fold_equivalents flag on join is deprecated (will remain until [ticket:1131] is implemented) - "scalar" flag on select() is removed, use select.as_scalar(). - 'transactional' flag on sessionmaker() and others is removed. Use 'autocommit=True' to indicate 'transactional=False'. - 'polymorphic_fetch' argument on mapper() is removed. Loading can be controlled using the 'with_polymorphic' option. - 'select_table' argument on mapper() is removed. Use 'with_polymorphic=("*", <some selectable>)' for this functionality. - 'proxy' argument on synonym() is removed. This flag did nothing throughout 0.5, as the "proxy generation" behavior is now automatic. - Passing a single list of elements to eagerload(), eagerload_all(), contains_eager(), lazyload(), defer(), and undefer() instead of multiple positional -args is deprecated. - Passing a single list of elements to query.order_by(), query.group_by(), query.join(), or query.outerjoin() instead of multiple positional *args is deprecated. - query.iterate_instances() is removed. Use query.instances(). - Query.query_from_parent() is removed. Use the sqlalchemy.orm.with_parent() function to produce a "parent" clause, or alternatively query.with_parent(). - query._from_self() is removed, use query.from_self() instead. - the "comparator" argument to composite() is removed. Use "comparator_factory". - RelationProperty._get_join() is removed. - the 'echo_uow' flag on Session is removed. Use logging on the "sqlalchemy.orm.unitofwork" name. - session.clear() is removed. use session.expunge_all(). - session.save(), session.update(), session.save_or_update() are removed. Use session.add() and session.add_all(). - the "objects" flag on session.flush() remains deprecated. - the "dont_load=True" flag on session.merge() is deprecated in favor of "load=False". - passing an InstanceState (internal SQLAlchemy state object) to attributes.init_collection() or attributes.get_history() is deprecated. These functions are public API and normally expect a regular mapped object instance. - the 'engine' parameter to declarative_base() is removed. Use the 'bind' keyword argument.
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r--lib/sqlalchemy/orm/session.py61
1 files changed, 4 insertions, 57 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py
index 760dfe81f..d68840c51 100644
--- a/lib/sqlalchemy/orm/session.py
+++ b/lib/sqlalchemy/orm/session.py
@@ -122,10 +122,6 @@ def sessionmaker(bind=None, class_=None, autoflush=True, autocommit=False,
that is local to the ``sessionmaker()`` function, and is not sent
directly to the constructor for ``Session``.
- echo_uow
- Deprecated. Use
- ``logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.DEBUG)``.
-
_enable_transaction_accounting
Defaults to ``True``. A legacy-only flag which when ``False``
disables *all* 0.5-style object accounting on transaction boundaries,
@@ -169,12 +165,6 @@ def sessionmaker(bind=None, class_=None, autoflush=True, autocommit=False,
present until they are removed using expunge(), clear(), or purge().
"""
- if 'transactional' in kwargs:
- util.warn_deprecated(
- "The 'transactional' argument to sessionmaker() is deprecated; "
- "use autocommit=True|False instead.")
- autocommit = not kwargs.pop('transactional')
-
kwargs['bind'] = bind
kwargs['autoflush'] = autoflush
kwargs['autocommit'] = autocommit
@@ -525,14 +515,14 @@ class Session(object):
public_methods = (
'__contains__', '__iter__', 'add', 'add_all', 'begin', 'begin_nested',
- 'clear', 'close', 'commit', 'connection', 'delete', 'execute', 'expire',
+ 'close', 'commit', 'connection', 'delete', 'execute', 'expire',
'expire_all', 'expunge', 'expunge_all', 'flush', 'get_bind', 'is_modified',
- 'merge', 'query', 'refresh', 'rollback', 'save',
- 'save_or_update', 'scalar', 'update')
+ 'merge', 'query', 'refresh', 'rollback',
+ 'scalar')
def __init__(self, bind=None, autoflush=True, expire_on_commit=True,
_enable_transaction_accounting=True,
- autocommit=False, twophase=False, echo_uow=None,
+ autocommit=False, twophase=False,
weak_identity_map=True, binds=None, extension=None, query_cls=query.Query):
"""Construct a new Session.
@@ -541,12 +531,6 @@ class Session(object):
"""
- if echo_uow is not None:
- util.warn_deprecated(
- "echo_uow is deprecated. "
- "Use logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.DEBUG).")
- log.class_logger(UOWTransaction, echo_uow)
-
if weak_identity_map:
self._identity_cls = identity.WeakInstanceDict
else:
@@ -795,8 +779,6 @@ class Session(object):
self._new = {}
self._deleted = {}
- clear = util.deprecated("Use session.expunge_all()")(expunge_all)
-
# TODO: need much more test coverage for bind_mapper() and similar !
# TODO: + crystalize + document resolution order vis. bind_mapper/bind_table
@@ -1039,44 +1021,12 @@ class Session(object):
self.identity_map.discard(state)
self._deleted.pop(state, None)
- @util.deprecated("Use session.add()")
- def save(self, instance):
- """Add a transient (unsaved) instance to this ``Session``.
-
- This operation cascades the `save_or_update` method to associated
- instances if the relation is mapped with ``cascade="save-update"``.
-
-
- """
- state = _state_for_unsaved_instance(instance)
- self._save_impl(state)
- self._cascade_save_or_update(state)
-
def _save_without_cascade(self, instance):
"""Used by scoping.py to save on init without cascade."""
state = _state_for_unsaved_instance(instance, create=True)
self._save_impl(state)
- @util.deprecated("Use session.add()")
- def update(self, instance):
- """Bring a detached (saved) instance into this ``Session``.
-
- If there is a persistent instance with the same instance key, but
- different identity already associated with this ``Session``, an
- InvalidRequestError exception is thrown.
-
- This operation cascades the `save_or_update` method to associated
- instances if the relation is mapped with ``cascade="save-update"``.
-
- """
- try:
- state = attributes.instance_state(instance)
- except exc.NO_STATE:
- raise exc.UnmappedInstanceError(instance)
- self._update_impl(state)
- self._cascade_save_or_update(state)
-
def add(self, instance):
"""Place an object in the ``Session``.
@@ -1100,9 +1050,6 @@ class Session(object):
self._save_or_update_impl(state)
self._cascade_save_or_update(state)
- save_or_update = (
- util.deprecated("Use session.add()")(add))
-
def _cascade_save_or_update(self, state):
for state, mapper in _cascade_unknown_state_iterator('save-update', state, halt_on=lambda c:c in self):
self._save_or_update_impl(state)