Incorrect SQL for aliased_entity.to_many_property.of_type(...).any()

Issue #1325 resolved
Former user created an issue

The following query

    # Engineer is derived from Employee
    c = aliased(Company)
    print list(session.query(c).filter(c.employees.of_type(Engineer).any()))

generates SQL, which refers to table {{{companies}}}, which is not present in the FROM clause. Should refer to the aliased table.

The following query works well.

    print list(session.query(c).filter(c.employees.any()))

Full test case is attached.

Comments (2)

  1. Log in to comment