summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/scoping.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/scoping.py')
-rw-r--r--lib/sqlalchemy/orm/scoping.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/scoping.py b/lib/sqlalchemy/orm/scoping.py
index 5559784c7..4339b68eb 100644
--- a/lib/sqlalchemy/orm/scoping.py
+++ b/lib/sqlalchemy/orm/scoping.py
@@ -5,7 +5,7 @@
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import sqlalchemy.exceptions as sa_exc
-from sqlalchemy.util import ScopedRegistry, to_list, get_cls_kwargs
+from sqlalchemy.util import ScopedRegistry, to_list, get_cls_kwargs, deprecated
from sqlalchemy.orm import (
EXT_CONTINUE, MapperExtension, class_mapper, object_session
)
@@ -23,12 +23,7 @@ class ScopedSession(object):
Session = scoped_session(sessionmaker(autoflush=True))
- To map classes so that new instances are saved in the current
- Session automatically, as well as to provide session-aware
- class attributes such as "query":
-
- mapper = Session.mapper
- mapper(Class, table, ...)
+ ... use session normally.
"""
@@ -57,8 +52,15 @@ class ScopedSession(object):
self.registry().close()
self.registry.clear()
+ @deprecated("Session.mapper is deprecated. "
+ "Please see http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper "
+ "for information on how to replicate its behavior.")
def mapper(self, *args, **kwargs):
- """return a mapper() function which associates this ScopedSession with the Mapper."""
+ """return a mapper() function which associates this ScopedSession with the Mapper.
+
+ DEPRECATED.
+
+ """
from sqlalchemy.orm import mapper