0.0.39 is dropping the class_registry variable from main without warnings #2024
Replies: 2 comments 1 reply
|
When I reviewed that PR I searched for |
|
The reason it got dropped as "unused" is that it genuinely was. In 0.0.38 and earlier, class_registry = weakref.WeakValueDictionary() # type: ignoreNothing else in SQLModel ever wrote to it or read from it (grep the old The registry that actually holds your mapped classes by name (the one SQLAlchemy uses to resolve string relationship refs) is on the registry object, not the module: from sqlmodel import SQLModel
SQLModel._sa_registry._class_registry
# same object as sqlmodel.main.default_registry._class_registryThat's the live If instead you were only using |

The reason it got dropped as "unused" is that it genuinely was. In 0.0.38 and earlier,
sqlmodel.main.class_registrywas just this, sitting at module scope:Nothing else in SQLModel ever wrote to it or read from it (grep the old
main.py, it appears exactly once), and it was never exported fromsqlmodel/__init__.py. So it was always an empty dict that no SQLModel code touched. If your BigQuery compat code was reading_sm.class_registryexpecting to find your mapped classes in there, it was getting an empty mapping the whole time.The registry that actually holds your mapped classes by name (the one SQLAlchemy uses to resolve str…