summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative/base.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/ext/declarative/base.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/ext/declarative/base.py')
-rw-r--r--lib/sqlalchemy/ext/declarative/base.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/ext/declarative/base.py b/lib/sqlalchemy/ext/declarative/base.py
index 269cfce00..80cd23bc8 100644
--- a/lib/sqlalchemy/ext/declarative/base.py
+++ b/lib/sqlalchemy/ext/declarative/base.py
@@ -163,7 +163,7 @@ class _MapperConfig(object):
# dict_ will be a dictproxy, which we can't write to, and we need to!
self.dict_ = dict(dict_)
self.classname = classname
- self.mapped_table = None
+ self.persist_selectable = None
self.properties = util.OrderedDict()
self.declared_columns = set()
self.column_copies = {}
@@ -584,7 +584,7 @@ class _MapperConfig(object):
elif self.inherits:
inherited_mapper = _declared_mapping_info(self.inherits)
inherited_table = inherited_mapper.local_table
- inherited_mapped_table = inherited_mapper.mapped_table
+ inherited_persist_selectable = inherited_mapper.persist_selectable
if table is None:
# single table inheritance.
@@ -611,10 +611,10 @@ class _MapperConfig(object):
)
inherited_table.append_column(c)
if (
- inherited_mapped_table is not None
- and inherited_mapped_table is not inherited_table
+ inherited_persist_selectable is not None
+ and inherited_persist_selectable is not inherited_table
):
- inherited_mapped_table._refresh_for_new_column(c)
+ inherited_persist_selectable._refresh_for_new_column(c)
def _prepare_mapper_arguments(self):
properties = self.properties