Repository navigation
Replies: 1 comment
|
Using from pydantic import ConfigDict
from sqlmodel import SQLModel
class Test(SQLModel):
model_config = ConfigDict(arbitrary_types_allowed=True)
id: int
assert Test.model_config["arbitrary_types_allowed"] is True
assert Test.model_config["from_attributes"] is TruePydantic merges this with inherited configuration, so SQLModel's I reproduced the dropped class keyword on both SQLModel 0.0.24/Pydantic 2.11.7 and SQLModel 0.0.48/Pydantic 2.14.1. On both, the |
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.
First Check
Commit to Help
Example Code
Description
Setting model config parameters as class kwargs doesn't work when using pydantic v2:
This is caused by a bug in the meta-class:
sqlmodel/sqlmodel/main.py
Lines 529 to 535 in 4bac032
where
allowed_config_kwargsis{'copy', 'pop', 'values', 'keys', 'fromkeys', 'items', 'update', 'setdefault', 'popitem', 'get', 'clear'}With Pydantic v2,
BaseConfigis aliased toConfigDictwhich doesn't have the config keys as attributes.Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.24
Python Version
3.13.2
Additional Context
Pydantic version: 2.11.7
All reactions