SQLModelConfig is not publicly exported while SQLModel annotates model_config with it, rejecting public ConfigDict/dict spelling under ty · Issue #2091 · fastapi/sqlmodel · GitHub
SQLModel annotates model_config: SQLModelConfig (sqlmodel/main.py), but SQLModelConfig lives in the private sqlmodel._compat module and is not exported from sqlmodel.__init__. As a result, typed application models cannot satisfy the annotation with any public spelling: ty rejects both the plain-dict and the pydantic ConfigDict forms, while mypy accepts both.
sqlmodel/_compat.py defines class SQLModelConfig(BaseConfig, total=False) where BaseConfig = ConfigDict, adding table and registry keys.
from sqlmodel import SQLModelConfig raises ImportError; only from sqlmodel._compat import SQLModelConfig works.
ty 0.0.80 reports invalid-assignment for both model_config = {"from_attributes": True} (dict[str, bool] vs SQLModelConfig) and model_config = ConfigDict(from_attributes=True) (ConfigDict vs SQLModelConfig).
mypy 1.20.2 reports no issues for either spelling.
Run ty check on the file: invalid-assignment on the model_config line. Replace with the plain-dict form and the same error appears with dict[str, bool]. mypy is clean in both cases.
Requested fix: either export SQLModelConfig from sqlmodel.__init__ (so apps can use the same spelling sqlmodel itself uses at main.py), or align the public model_config annotation so the documented public ConfigDict/dict spellings type-check. Happy to test a patch against ty 0.0.80.
Activity