SQLModel fails to create DB constraints when using Annotated types after Pydantic 2.12.0 #1597
Unanswered
MarishLakshmanan
asked this question in
Questions
Replies: 1 comment
-
Similar: #1596 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
Description
After upgrading to Pydantic 2.12.0,
SQLModel
no longer creates database constraints (like primary keys, unqiue keys ) for fields defined usingAnnotated
types.Example:
Expected Behavior
The table should be created with id as an varchar and primary key
Actual Behavior
it throws an error
Additional notes
In case you use an unique key constraint the table will be created, you will not get any error but the unique key constraint will not be created.
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.26
Python Version
3.13.3
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions