Refactor table setting
This commit is contained in:
@@ -70,10 +70,10 @@ def get_class_by_table(base, table, data=None):
|
|||||||
:param data: Data row to determine the class in polymorphic scenarios
|
:param data: Data row to determine the class in polymorphic scenarios
|
||||||
:return: Declarative class or None.
|
:return: Declarative class or None.
|
||||||
"""
|
"""
|
||||||
found_classes = set()
|
found_classes = set(
|
||||||
for c in base._decl_class_registry.values():
|
c for c in base._decl_class_registry.values()
|
||||||
if hasattr(c, '__table__') and c.__table__ is table:
|
if hasattr(c, '__table__') and c.__table__ is table
|
||||||
found_classes.add(c)
|
)
|
||||||
if len(found_classes) > 1:
|
if len(found_classes) > 1:
|
||||||
if not data:
|
if not data:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
Reference in New Issue
Block a user