If I have a mixed single/joined table inheritance hierarchy:
class Person(Base):
__tablename__ = "person"
id = Column(Integer, primary_key=True)
__mapper_args__ = {
"polymorphic_on": type,
}
class Employee(Person):
foo = Column(Integer)
__mapper_args__ = {
"polymorphic_identity": "employee",
}
class Contractor(Person):
__tablename__ = "contractor"
id = Column(Integer, ForeignKey(Person.id), primary_key=True)
__mapper_args__ = {
"polymorphic_identity": "contractor",
}
What do I put for "with_polymorphic" if I want only Employee (and not
Contractor) to be loaded? The only examples I could find are for
"with_polymorphic":
"*". In particular, 1. how do I get a reference to Contractor if it's
defined below Person (and it has to be below because it inherits from Person),
and 2. what's the second element in the tuple supposed to be for a normal
joined or single table inheritance scenario?
--
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.