bundle does not provide entities, fails on single inh
Issue #3874
resolved
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Employee(Base):
__tablename__ = 'employee'
id = Column(Integer, primary_key=True)
type = Column(String(50))
name = Column(String(30))
__mapper_args__ = {
'polymorphic_identity': 'employee',
'polymorphic_on': type,
'with_polymorphic': '*'
}
class Engineer(Employee):
__mapper_args__ = {
'polymorphic_identity': 'engineer',
}
class Manager(Employee):
__mapper_args__ = {
'polymorphic_identity': 'manager',
}
e = create_engine("sqlite://", echo=True)
Base.metadata.create_all(e)
s = Session(e)
s.add_all([
Engineer(name='e1'),
Engineer(name='e2'),
Manager(name='m1'),
])
s.commit()
print(s.query(Bundle("name", Manager.name)).select_from(Manager).all())
not adding the criteria for single inh
Comments (2)
-
reporter -
reporter - changed status to resolved
Add real .entities to _BundleEntity
Fixed bug where the single-table inheritance query criteria would not be inserted into the query in the case that the :class:
.Bundle
construct were used as the selection criteria.Change-Id: Ib7c128ceef5c3220a098cdfd0270c43a2a67716d Fixes:
#3874→ <<cset 675f021368a3>>
- Log in to comment
https://gerrit.sqlalchemy.org/263