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.
1 parent 1c5263e commit 80f2935Copy full SHA for 80f2935
sqlmodel/main.py
@@ -591,6 +591,14 @@ def __init__(
591
return cls.__do_init__(bases, dict_, kw)
592
593
def sqlmodel_rebuild(cls) -> None:
594
+ reg = cls._sa_registry
595
+ # clear any exisiting mappers for the cls
596
+ manager = [m for m in reg._managers if m.class_ == cls]
597
+ if len(manager) > 0:
598
+ for m in manager:
599
+ reg._dispose_manager_and_mapper(m)
600
+ del reg._managers[m]
601
+
602
return cls.__do_init__(cls.__bases__, cls.__dict__, {})
603
604
# Override SQLAlchemy, allow both SQLAlchemy and plain Pydantic models
0 commit comments