Deprecation warnings with pydantic v2.11 #1334
Unanswered
jonyscathe
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
Use
sqlmodel_update
on some SQLModel instance, in my case passing in a BaseModel instance.This then calls
get_model_fields
on the BaseModel instance.This function returns model.fields which leads to a deprecation warning from pydantic:
Easy way (though possibly not the nicest way) to fix this particular issue is to change
sqlmodel_update
to:Of course
def get_model_fields(model: InstanceOrType[BaseModel])
should also be updated todef get_model_fields(model: Type[BaseModel])
Note: Several other deprecation warnings I noticed as well, though I don't think these ones are new as of pydantic 2.11... And these ones aren't causing my tests to fail on deprecation warnings.
.__fields_set__
which should be updated to.model_fields_set
Operating System
Linux
Operating System Details
python-slim container
SQLModel Version
0.0.24
Python Version
3.12.9
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions