sqlmodel: Jak použít custom table name

Nastavte __tablename__ ve vaší SQLModel subclass pro definici custom table name.

sqlmodel_custom_tablename.py

class Product(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    mpn: Optional[str] = Field(description="Manufacturer part number", index=True)

    __tablename__ = "MyApplicationProduct"

Podívejte se na podobné články podle kategorie: SQLModel Python