MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _table_to_equated

Method _table_to_equated

lib/sqlalchemy/orm/mapper.py:4065–4094  ·  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

4063
4064 @util.memoized_property
4065 def _table_to_equated(self):
4066 """memoized map of tables to collections of columns to be
4067 synchronized upwards to the base mapper."""
4068
4069 result: util.defaultdict[
4070 Table,
4071 List[
4072 Tuple[
4073 Mapper[Any],
4074 List[Tuple[ColumnElement[Any], ColumnElement[Any]]],
4075 ]
4076 ],
4077 ] = util.defaultdict(list)
4078
4079 def set_union(x, y):
4080 return x.union(y)
4081
4082 for table in self._sorted_tables:
4083 cols = set(table.c)
4084
4085 for m in self.iterate_to_root():
4086 if m._inherits_equated_pairs and cols.intersection(
4087 reduce(
4088 set_union,
4089 [l.proxy_set for l, r in m._inherits_equated_pairs],
4090 )
4091 ):
4092 result[table].append((m, m._inherits_equated_pairs))
4093
4094 return result
4095
4096
4097class _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