single inh criteria should be added for select_from()

Issue #3891 resolved
Mike Bayer repo owner created an issue

in test_single:

    def test_select_from_inherited_tables(self):
        Manager, Engineer, Employee = (self.classes.Manager, self.classes.Engineer, self.classes.Employee)

        sess = create_session()
        m1 = Manager(name='Tom', manager_data='data1')
        e1 = Engineer(name='Kurt', engineer_info='knows how to hack')
        sess.add_all([m1, e1])
        sess.flush()

        eq_(
            sess.query(func.count(1)).select_from(Manager).all(),
            [(1, )]
        )

need to say func.count(Manager.employee_id) for now

Comments (2)

  1. Mike Bayer reporter

    Consult _select_from_entity in _adjust_for_single_inheritance

    Fixed bug in single-table inheritance where the select_from() argument would not be taken into account when limiting rows to a subclass. Previously, only expressions in the columns requested would be taken into account.

    Change-Id: Id353c45eade52b264d8f6685a58ba53975669eea Fixes: #3891

    → <<cset b6a6ffa4c0e0>>

  2. Log in to comment