Open AbdealiLoKo opened 2 years ago
A alternate syntax here is:
class Writer(Base):
...
poly_col = column_property(
case(
[(type.in_(['poet', 'lyricist']), 'bard')],
else_=type,
)
)
__mapper_args__ = {
'polymorphic_on': poly_col,
'polymorphic_identity': 'writer',
}
But this seems to be failing with the error that the column property is not found in the version table
The
polymorphic_on
can be a CASE WHEN statement. Ref: https://docs.sqlalchemy.org/en/14/orm/mapping_api.html#sqlalchemy.orm.mapper.params.polymorphic_onBut it looks like sqlalchemy-continuum fails when I try to add
__versioned__
to a model with it.Reproducible example: