You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using get_class_by_table method to find the declarative base associated to a table object, without any data associated (trying to export a list of tables associated to the files they are defined in).
In case of polymorphic tables, this method raises a ValueError that multiple classes are found for the table. Although I totally understand this error, I think it would be valuable for at least the exception to be decorated with the multiple results, so that client code may do a follow-up process accordingly with all matching classes.
and then raise PolymorphicIndeterminationError instead of ValueError.
An alternative that may be enough in my case would be to add a parameter only_polymorphic_base to the method, and return only the class that has base in its direct __bases__
I don't know which option would be preferred, but I think this could be a great improvement.
Thanks
The text was updated successfully, but these errors were encountered:
Hello,
I'm using
get_class_by_table
method to find the declarative base associated to a table object, without any data associated (trying to export a list of tables associated to the files they are defined in).In case of polymorphic tables, this method raises a ValueError that multiple classes are found for the table. Although I totally understand this error, I think it would be valuable for at least the exception to be decorated with the multiple results, so that client code may do a follow-up process accordingly with all matching classes.
Something such as
and then raise
PolymorphicIndeterminationError
instead ofValueError
.An alternative that may be enough in my case would be to add a parameter
only_polymorphic_base
to the method, and return only the class that hasbase
in its direct__bases__
I don't know which option would be preferred, but I think this could be a great improvement.
Thanks
The text was updated successfully, but these errors were encountered: