MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / OrderItem

Class OrderItem

examples/association/proxied_association.py:60–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60class OrderItem(Base):
61 __tablename__ = "orderitem"
62 order_id: Mapped[int] = mapped_column(
63 ForeignKey("order.order_id"), primary_key=True
64 )
65 item_id: Mapped[int] = mapped_column(
66 ForeignKey("item.item_id"), primary_key=True
67 )
68 price: Mapped[float]
69
70 item: Mapped[Item] = relationship(lazy="joined")
71
72 def __init__(self, item: Item, price: float | None = None):
73 self.item = item
74 self.price = price or item.price
75
76
77if __name__ == "__main__":

Callers 1

Calls 3

mapped_columnFunction · 0.90
ForeignKeyClass · 0.90
relationshipFunction · 0.90

Tested by

no test coverage detected