learn-sql-model/learn_sql_model/models/pet.py
2023-05-22 08:28:32 -05:00

14 lines
384 B
Python

from typing import Optional, TYPE_CHECKING
from sqlmodel import Field, Relationship
from learn_sql_model.models.fast_model import FastModel
if TYPE_CHECKING:
from learn_sql_model.models.hero import Hero
class Pet(FastModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = "Jim"
hero: "Hero" = Relationship(back_populates="pet")