diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-11-11 12:57:32 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-11-11 12:57:32 -0500 |
| commit | 33c378f768c699f3590f168f6c3c86448239268c (patch) | |
| tree | 3f040fef0dd9cd03d5e5c4365ac67c27f31fd73f /doc | |
| parent | d51a36397e2449afccb9b70d3ec3d13990460124 (diff) | |
| download | sqlalchemy-33c378f768c699f3590f168f6c3c86448239268c.tar.gz | |
- Fixed bug where the "single table inheritance" criteria would be
added onto the end of a query in some inappropriate situations, such
as when querying from an exists() of a single-inheritance subclass.
fixes #3582
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/build/changelog/changelog_11.rst | 12 | ||||
| -rw-r--r-- | doc/build/changelog/migration_11.rst | 40 |
2 files changed, 51 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_11.rst b/doc/build/changelog/changelog_11.rst index 688818a2a..9ce3975c2 100644 --- a/doc/build/changelog/changelog_11.rst +++ b/doc/build/changelog/changelog_11.rst @@ -22,6 +22,18 @@ :version: 1.1.0b1 .. change:: + :tags: bug, orm + :tickets: 3582 + + Fixed bug where the "single table inheritance" criteria would be + added onto the end of a query in some inappropriate situations, such + as when querying from an exists() of a single-inheritance subclass. + + .. seealso:: + + :ref:`change_3582` + + .. change:: :tags: enhancement, schema :pullreq: github:204 diff --git a/doc/build/changelog/migration_11.rst b/doc/build/changelog/migration_11.rst index 5b7c8321a..f43cfa87c 100644 --- a/doc/build/changelog/migration_11.rst +++ b/doc/build/changelog/migration_11.rst @@ -16,7 +16,7 @@ What's New in SQLAlchemy 1.1? some issues may be moved to later milestones in order to allow for a timely release. - Document last updated: October 7, 2015 + Document last updated: November 11, 2015 Introduction ============ @@ -253,6 +253,44 @@ configuration of the existing object-level technique of assigning :ticket:`3250` + +.. _change_3582: + +Further Fixes to single-table inheritance querying +-------------------------------------------------- + +Continuing from 1.0's :ref:`migration_3177`, the :class:`.Query` should +no longer inappropriately add the "single inheritance" criteria when the +query is against a subquery expression such as an exists:: + + class Widget(Base): + __tablename__ = 'widget' + id = Column(Integer, primary_key=True) + type = Column(String) + data = Column(String) + __mapper_args__ = {'polymorphic_on': type} + + + class FooWidget(Widget): + __mapper_args__ = {'polymorphic_identity': 'foo'} + + q = session.query(FooWidget).filter(FooWidget.data == 'bar').exists() + + session.query(q).all() + +Produces:: + + SELECT EXISTS (SELECT 1 + FROM widget + WHERE widget.data = :data_1 AND widget.type IN (:type_1)) AS anon_1 + +The IN clause on the inside is appropriate, in order to limit to FooWidget +objects, however previously the IN clause would also be generated a second +time on the outside of the subquery. + +:ticket:`3582` + + New Features and Improvements - Core ==================================== |
