summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/session.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-12-29 20:54:29 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-01-25 09:28:28 -0500
commit93855ed623ceedffc02dee06c9a46c37dd26286b (patch)
tree5fdb783ea642d99693fd284dcbc04d4691423d16 /lib/sqlalchemy/orm/session.py
parent78e598e3a5b8df7419a600c291f90260e598c9b7 (diff)
downloadsqlalchemy-93855ed623ceedffc02dee06c9a46c37dd26286b.tar.gz
Implement relationship to AliasedClass; deprecate non primary mappers
Implemented a new feature whereby the :class:`.AliasedClass` construct can now be used as the target of a :func:`.relationship`. This allows the concept of "non primary mappers" to no longer be necessary, as the :class:`.AliasedClass` is much easier to configure and automatically inherits all the relationships of the mapped class, as well as preserves the ability for loader options to work normally. - introduce new name for mapped_table, "persist_selectable". this is the selectable that selects against the local mapper and its superclasses, but does not include columns local only to subclasses. - relationship gains "entity" which is the mapper or aliasedinsp. - clarfiy name "entity" vs. "query_entity" in loader strategies. Fixes: #4423 Fixes: #4422 Fixes: #4421 Fixes: #3348 Change-Id: Ic3609b43dc4ed115006da9ad9189e574dc0c72d9
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r--lib/sqlalchemy/orm/session.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py
index 53f99b99d..a4cc07194 100644
--- a/lib/sqlalchemy/orm/session.py
+++ b/lib/sqlalchemy/orm/session.py
@@ -1507,7 +1507,7 @@ class Session(_SessionClassMethods):
if cls in self.__binds:
return self.__binds[cls]
if clause is None:
- clause = mapper.mapped_table
+ clause = mapper.persist_selectable
if clause is not None:
for t in sql_util.find_tables(clause, include_crud=True):
@@ -1520,8 +1520,8 @@ class Session(_SessionClassMethods):
if isinstance(clause, sql.expression.ClauseElement) and clause.bind:
return clause.bind
- if mapper and mapper.mapped_table.bind:
- return mapper.mapped_table.bind
+ if mapper and mapper.persist_selectable.bind:
+ return mapper.persist_selectable.bind
context = []
if mapper is not None: