What am I doing wrong here? I tried to follow the example provided in the docs, but run into the error that the table does not exists.
I am using a sqlite-db for testing.
class PredictionMeta(SQLModel, table=True):
id: int = Field(primary_key=True)
run_id: str = Field(unique=True, index=True)
class PredictionMonths(SQLModel, table=True):
id: int = Field(primary_key=True)
run_id: str = Field(foreign_key="PredictionMeta.run_id", index=True)
month: str
prediction: float
class PredictionModel(SQLModel, table=True):
id: int = Field(primary_key=True)
run_id: str = Field(foreign_key="PredictionMeta.run_id", index=True)
material: str
SQLModel.metadata.create_all(engine)
NoReferencedTableError: Foreign key associated with column 'predictionmonths.run_id' could not find table 'PredictionMeta' with which to generate a foreign key to target column 'run_id'