unhelpful error when refering to a table instead of a class in relationship.
Issue #2196
resolved
Hello,
I've just spent a couple of hours staring at an 'UnmappedClassError Table("name of table", one thousand lines of columns) is not mapped' error message and just figured out, that the mistake was to put the name of the table in relationships first argument, instead of the name of the class (using declarative). The error sent me looking for errors in the framework, incorrectly bound engines, stuff like that.
I've written a patch against orm/util.py that checks for sqla.schema.Table in util.py:class_mapper.
There is also a short bit of code that triggers the error in table_instead_of_mapper.py
Thank you for your time.
Comments (3)
-
repo owner -
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.7.3 (automated comment)
- Log in to comment
It's pretty arbitrary to put special handling for a "Table" and not any number of other objects that can be placed there.
A more generalized solution would just to be check for "type".