Open leemurus opened 3 weeks ago
Hey anton, thanks for the report. Have you enabled recursive types? If you haven't, I would strongly recommend doing so as that should significantly shorten the generated types.py
file.
Hey RobertCraigie! What do you mean about enable recursive types? As I understand it, this will increase the file size on the contrary, since there will be more models. On the contrary, we reduced them to a minimum value of 2 and made the current measurements at this figure.
My company has 132 tables in PostgreSQL, which we've pulled into a
schema.prisma
file to generate models. This resulted in atypes.py
file with approximately 1 million lines. Due to the large size and the frequent calls tomodel_rebuild
function within themodels.py
file, interactions with the library have become very slow.As a result:
For traditional web applications like FastAPI or Django, this cold start is acceptable since you can start the application once and keep it running. However, for serverless applications, this performance is problematic because you are charged for startup time and resource usage.
Is it possible to fix this somehow or is the whole idea of generation not applicable to python because of its speed?
Env: Macos M2 Pro, 16 GB ram, python ^3.10