Fix a few sql gotchas

This commit is contained in:
Matthias 2024-02-12 20:31:44 +01:00
parent 790c7e386a
commit 8364a704d6
2 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ class _CustomData(ModelBase):
- One metadata entry can only be associated with one Trade
"""
__tablename__ = 'trade_custom_data'
__allow_unmapped__ = True
session: ClassVar[SessionType]
# Uniqueness should be ensured over pair, order_id

View File

@ -1485,7 +1485,7 @@ class Trade(ModelBase, LocalTrade):
"Order", order_by="Order.id", cascade="all, delete-orphan", lazy="selectin",
innerjoin=True) # type: ignore
custom_data: Mapped[List[_CustomData]] = relationship(
"CustomData", order_by="CustomData.id", cascade="all, delete-orphan",
"_CustomData", cascade="all, delete-orphan",
lazy="raise") # type: ignore
exchange: Mapped[str] = mapped_column(String(25), nullable=False) # type: ignore