Replies: 2 comments 1 reply
-
sqlmodel is indeed very slow compared to sqlalchemy. Probably because it's doing a lot of Pydantic operations alongside the sqlalchemy ones. This is definitely a library that prioritizes developer experience over speed. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@YusufTyer what you ended up doing? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
The table I am querying from is a very large table containing millions of rows. I cannot provide access to the data within, but the fields documented in the classes are accurate.
There was no sqlmodel documentation available on how best to use a group by operation, so I used the sqlalchemy way of producing a group by query. The query executed to completion after 19s.
I then applied the sqlalchemy ORM to my tables and produced the exact same query. The execution of this table took just 1 second.
Please help me understand if I have made a mistake somewhere in defining my data model, or if there is a better way to perform the group by operation using sqlmodel. I don't believe that the issue would be with the data itself since the query ran very quick using sqlalchemy.
PS: This is my first time posting on GitHub so apologies if the format of the question was not written ideally.
Operating System
Windows
Operating System Details
No response
SQLModel Version
0.0.8
Python Version
3.9
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions