SQLModel maps Decimal to DECIMAL(10,0) in MySQL instead of respecting decimal_places #1127
Unanswered
jalvarezz13
asked this question in
Questions
Replies: 0 comments
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
SQLModel is mapping this field to DECIMAL(10,0) in MySQL, instead of DECIMAL(10,2) as expected. This results in loss of decimal precision in the database.
Operating System
Linux, Other
Operating System Details
MySQL Docker container using version 8.4.2
SQLModel Version
0.0.22
Python Version
3.12.3
Additional Context
Currently, it's necessary to manually replace the field definition in the generated migration, changing DECIMAL(10,0) to DECIMAL(10,2) to achieve the desired behavior.
Beta Was this translation helpful? Give feedback.
All reactions