[Bug]: table=True with custom registry= stores bool in model_config and leaves model unmapped #2047
Unanswered
baiyuxi930826
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
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Passing
table=Truetogether with a customregistry=stores the booleantableflag intomodel_config["registry"]instead of the registry object, and the model is left unmapped.In
sqlmodel/main.py(SQLModelMetaclass):Debug information
803a3d1f6d605a1da45ed166120845ed54ce9c2aRepro steps
Default path works:
class Hero(SQLModel, table=True).Expected behavior
model_config["registry"]should hold the provided registry; the table model should be mapped like the default-registrytable=Truepath.Actual behavior
model_config["registry"]isTrue; model has no mapper; multi-registry one-shot API is unusable.Suggested direction
Also reconsider always setting
__abstract__ = Truewhen a custom registry is provided on atable=Truemodel.I'd be happy to prepare a PR with a regression test if this is confirmed.
Beta Was this translation helpful? Give feedback.
All reactions