learn-sql-model/learn_sql_model/models/pet.py
2023-06-06 09:57:21 -05:00

16 lines
454 B
Python

from datetime import datetime
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"
birthday: Optional[datetime] = None
hero: "Hero" = Relationship(back_populates="pet")