We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
sqlmodel/_compat.py
1 parent b23a457 commit dbd8551Copy full SHA for dbd8551
sqlmodel/_compat.py
@@ -103,7 +103,14 @@ def set_config_value(
103
model.model_config[parameter] = value # type: ignore[literal-required]
104
105
def get_model_fields(model: InstanceOrType[BaseModel]) -> Dict[str, "FieldInfo"]:
106
- return model.model_fields # type: ignore[arg-type]
+ # TODO: refactor the usage of this function to always pass the class
107
+ # not the instance, and then remove this extra check
108
+ # this is for compatibility with Pydantic v3
109
+ if isinstance(model, type):
110
+ use_model = model
111
+ else:
112
+ use_model = model.__class__
113
+ return use_model.model_fields
114
115
def get_fields_set(
116
object: InstanceOrType["SQLModel"],
0 commit comments