MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _table_to_equated

Method _table_to_equated

lib/sqlalchemy/orm/mapper.py:4093–4122  ·  view source on GitHub ↗

memoized map of tables to collections of columns to be synchronized upwards to the base mapper.

(self)

Source from the content-addressed store, hash-verified

4091
4092 @util.memoized_property
4093 def _table_to_equated(self):
4094 """memoized map of tables to collections of columns to be
4095 synchronized upwards to the base mapper."""
4096
4097 result: util.defaultdict[
4098 Table,
4099 List[
4100 Tuple[
4101 Mapper[Any],
4102 List[Tuple[ColumnElement[Any], ColumnElement[Any]]],
4103 ]
4104 ],
4105 ] = util.defaultdict(list)
4106
4107 def set_union(x, y):
4108 return x.union(y)
4109
4110 for table in self._sorted_tables:
4111 cols = set(table.c)
4112
4113 for m in self.iterate_to_root():
4114 if m._inherits_equated_pairs and cols.intersection(
4115 reduce(
4116 set_union,
4117 [l.proxy_set for l, r in m._inherits_equated_pairs],
4118 )
4119 ):
4120 result[table].append((m, m._inherits_equated_pairs))
4121
4122 return result
4123
4124
4125class _OptGetColumnsNotAvailable(Exception):

Callers

nothing calls this directly

Calls 3

iterate_to_rootMethod · 0.95
intersectionMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected