Folks I have this toy example I've sanitized.
class TableBase(AbstractConcreteBase, Base):
pass
class TableA(TableBase):
__tablename__ = "table_a"
__mapper_args__ = {
"polymorphic_identity": "A",
"concrete": True,
}
v0 = Column(Integer)
@hybrid_property
def magic(self):
return self.v0 * 100
@magic.expression
def magic(cls):
return cls.v0 * 100
class TableB(TableBase):
__tablename__ = "table_b"
__mapper_args__ = {
"polymorphic_identity": "B",
"concrete": True,
}
v0 = Column(Integer)
@hybrid_property
def magic(self):
return self.v0 * 10
@magic.expression
def magic(cls):
return cls.v0 * 10
When I query at the top level:
print(Query([TableBase.magic]).limit(1).statement)
I get
AttributeError: type object 'TableBase' has no attribute 'magic'
I've tried a bunch of things, most of them point to the fact that the hybrid_property is not being rendered in the subquery.
I did solve it by moving the hybrid_property into the abstract class, though I want the particularities of a table to stay with the table definition and not at the union level.
Thoughts? Ideas?
Thanks!!!
--Damian