nested model
Closed this issue · 2 comments
matv864 commented
I try to create api on sqlmodel with relationships (In my case, I have table Card and Article with link to Card (key: card_id))
one-to-many
And now I try to understand how it works (joined isn't my solving, I need record which contain Card model with list of Article models inside)
code of getting record
return await card_crud.get(
db=db,
id=card_id,
schema_to_select=Card_schema,
)
Why "true" ....?
How did it appeared ....?
how can I implement this?
matv864 commented
in Usual SQL I would use this
selectinload
but how can I make this in FastCRUD
igorbenav commented
I think what you are looking for is the get_joined method.
Here's a comprehensive guide to joins in FastCRUD
, including nested joins