MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / setup_mappers

Method setup_mappers

test/orm/test_joins.py:2141–2169  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

2139
2140 @classmethod
2141 def setup_mappers(cls):
2142 nodes, assoc_table, sub_table = (
2143 cls.tables.nodes,
2144 cls.tables.assoc_table,
2145 cls.tables.sub_table,
2146 )
2147
2148 Node, Sub = cls.classes("Node", "Sub")
2149
2150 cls.mapper_registry.map_imperatively(
2151 Node,
2152 nodes,
2153 properties={
2154 "children": relationship(
2155 Node,
2156 lazy="select",
2157 join_depth=3,
2158 backref=backref("parent", remote_side=[nodes.c.id]),
2159 ),
2160 "subs": relationship(Sub),
2161 "assoc": relationship(
2162 Node,
2163 secondary=assoc_table,
2164 primaryjoin=nodes.c.id == assoc_table.c.left_id,
2165 secondaryjoin=nodes.c.id == assoc_table.c.right_id,
2166 ),
2167 },
2168 )
2169 cls.mapper_registry.map_imperatively(Sub, sub_table)
2170
2171 def test_o2m_aliased_plus_o2m(self):
2172 Node, Sub = self.classes.Node, self.classes.Sub

Callers

nothing calls this directly

Calls 3

relationshipFunction · 0.90
backrefFunction · 0.90
map_imperativelyMethod · 0.80

Tested by

no test coverage detected