bundle does not provide entities, fails on single inh

Issue #3874 resolved
Mike Bayer repo owner created an issue
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)

  1. Mike Bayer reporter

    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>>

  2. Log in to comment