-
-
Notifications
You must be signed in to change notification settings - Fork 785
Class Initialisation Validation Kwarg #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Class Initialisation Validation Kwarg #227
Conversation
|
@tiangolo Would it be possible to get the workflows run on this pr? |
…ation even if not a table.
79c0dd3 to
d793def
Compare
|
@tiangolo Would it be possible to get this PR reviewed and workflows run? |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
I just ran across this issue myself, so it would be great to get this fix merged. Looks like it is just some lint errors in the actions failures. Any plan to get this rolled in? Thanks! |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
📝 Docs preview for commit 4499f96 at: https://63ecd2b82960b411061a9718--sqlmodel.netlify.app |
I've resolved the conflicts and the pr now passes the latest checks. @tiangolo Are we able to get a go/no-go on this PR, been sitting around for over a year now so be good to get a final decision on whether it should be updated, merged, or closed. |
|
Bump? I'm pretty interested in this, however it is now going on 3 years old... Any updates? |
YuriiMotov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndrewRiggs-Atkins, thanks for your interest and efforts!
The feature you attempted to implement in this PR is highly requested by users. And I personally think it would be great if we found a solution to it.
But to add this to the project we should test it carefully and cover by automated tests to ensure it suits user's needs and further code changes will not brake it.
Are you ready to continue working on this?
|
This pull request has a merge conflict that needs to be resolved. |
|
Related PR: #1041 |
As discussed in issue #134, this pr enables pydantic validation to be run on object instantiation when the class is set as a table, instead of only when being commited into the database.
main.py > SQLModelMetaclass > new > line ~307
main.py > SQLModel > init > line ~517
usage
When
validateis disabled, validation runs on commit as usual, with it enabled, validation runs on object initialisation. Works for pydanic@validatefunctions as well as others such asmax_length