MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / Section

Class Section

test/orm/test_lazy_relations.py:1279–1296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1277 def go(allow_partial_pks):
1278
1279 class Section(decl_base):
1280 __tablename__ = "sections"
1281 year = Column(Integer, primary_key=True)
1282 idx = Column(Integer, primary_key=True)
1283 parent_idx = Column(Integer)
1284
1285 if not allow_partial_pks:
1286 __mapper_args__ = {"allow_partial_pks": False}
1287
1288 ForeignKeyConstraint((year, parent_idx), (year, idx))
1289
1290 parent = relationship(
1291 "Section",
1292 primaryjoin=and_(
1293 year == remote(year),
1294 foreign(parent_idx) == remote(idx),
1295 ),
1296 )
1297
1298 decl_base.metadata.create_all(connection)
1299 connection.commit()

Callers 1

goMethod · 0.85

Calls 6

ColumnClass · 0.90
relationshipFunction · 0.90
and_Function · 0.90
remoteFunction · 0.90
foreignFunction · 0.90

Tested by 1

goMethod · 0.68