Replies: 2 comments
-
You should look into that thread: #52 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Any updates on this? |
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
Hello. I am trying to set up my database using
SQLModel
.Doing so, I am getting tired of some of the repetition when setting
foreign_key
,index
orunique
on theField
annotations.I would like to be able to reach something like this:
And the
fields.py
field would look like:When testing out, I used
sqlalchemy.inspect
on the model, to see if the constraints were applied. The output shows that it didn't work:Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.18
Python Version
Python 3.12.3
Additional Context
I would like to add that this composition of
Field
seems to work in Pydantic...Which would output the following:
Additionally, I tried using the same approach in SQLModel, and still no luck:
Beta Was this translation helpful? Give feedback.
All reactions