I use fastapi in my recent project but I spent a lot of time on structure my model code.
The biggest problem is split models.py to a module. I read a lot of articles and found it is not a acceptable because of pedantic.
User have to re-import all referenced model at the end of each file and rebuild models in the file. Is there a more graceful solution?
Another problem is the inherit between sqlmodels with table=True and table=False. I found table=True sqlmodel will be a sqalchemy model created by meta class and table=False is actually pedantic model. If user create a pedantic model based on sqlalchemy model, some unexpected bug may occur.
I use fastapi in my recent project but I spent a lot of time on structure my model code.
The biggest problem is split models.py to a module. I read a lot of articles and found it is not a acceptable because of pedantic. User have to re-import all referenced model at the end of each file and rebuild models in the file. Is there a more graceful solution?
Another problem is the inherit between sqlmodels with
table=True
andtable=False
. I foundtable=True
sqlmodel will be a sqalchemy model created by meta class andtable=False
is actually pedantic model. If user create a pedantic model based on sqlalchemy model, some unexpected bug may occur.Can you write some tips about fastapi models?