I would like to use the same model for the api and the SQLDatabase but I am struggling with the configuration.
I am writing an API in fastAPI and I would like to return an object with nested objects, but without creating additional tables in the DB.
class InnerObject(...):
first_attribute: str
second_attribute: str
class OuterObject(SQLModel):
id: str = Field(sa_column=Column(nullable=False, primary_key=True))
name: str
attributes: InnerObject = Field(...)
Is it possible to configure SQLModel to flatten out the attributes in the OuterObject table?