0

subhero table is not creating.. it's inheriting from hero class..

from typing import Optional
from sqlmodel import Field, BigInteger, Column, SQLModel, JSON

from engine import engine


class Hero(SQLModel, table=True):
    name: Optional[str] = Field(default=None, primary_key=True)
    secret_name: str
    age: Optional[int] = Field(sa_column=Column("age", BigInteger))
    wives: Optional[dict | list] = Field(sa_column=Column("wives", JSON))

    class Config:
        arbitrary_types_allowed = True


class Subhero(Hero, table=True):
    pass


def create_db_and_tables():  #
    SQLModel.metadata.create_all(engine)  #


create_db_and_tables()

why the table is not creating???? can someone explain why this is not happening>>>??

0 Answers0