Hello,
I want two separate polymorphic identity values to map to the same
class. It's OK when saving only the primary one is used.
I have something along the lines of the following:
class Root(TableModel):
some_field = ...
__mapper_args__ = {
'polymorphic_on': 'some_col',
'polymorphic_identity': 'root',
}
class Child(Root):
__mapper_args__ = {
'polymorphic_identity': 'son',
}
some_new_fields = ...
mapper(Child, Root.__table__,
polymorphic_identity='daughter',
non_primary=True,
)
However, this fails with
AssertionError: No such polymorphic_identity u'daughter' is defined
For what it's worth, this is sqlalchemy 1.0.17 on python 2
Any tips regarding this? Any piece of documentation that I missed? It'd
be nice if we could just do 'polymorphic_identity': ('son',
'daughter'), or maybe 'polymorphic_secondary_identities': ('daugther',
'some other gende', ) etc.
Best regards,
Burak
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.