# sqlalchemy 2.1.9 (MIT), harvested by tools/harvest_corpus.py
=== input
Produce a UNION of this Query against one or more queries.

        e.g.::

            q1 = sess.query(SomeClass).filter(SomeClass.foo == "bar")
            q2 = sess.query(SomeClass).filter(SomeClass.bar == "foo")

            q3 = q1.union(q2)

        The method accepts multiple Query objects so as to control
        the level of nesting.  A series of ``union()`` calls such as::

            x.union(y).union(z).all()

        will nest on each ``union()``, and produces:

        .. sourcecode:: sql

            SELECT * FROM (SELECT * FROM (SELECT * FROM X UNION
                            SELECT * FROM y) UNION SELECT * FROM Z)

        Whereas::

            x.union(y, z).all()

        produces:

        .. sourcecode:: sql

            SELECT * FROM (SELECT * FROM X UNION SELECT * FROM y UNION
                            SELECT * FROM Z)

        Note that many database backends do not allow ORDER BY to
        be rendered on a query called within UNION, EXCEPT, etc.
        To disable all ORDER BY clauses including those configured
        on mappers, issue ``query.order_by(None)`` - the resulting
        :class:`_query.Query` object will not render ORDER BY within
        its SELECT statement.

        .. seealso::

            :meth:`_sql.Select.union` - v2 equivalent method.

        
=== parse rest
short_description: 'Produce a UNION of this Query against one or more queries.'
long_description: |
  e.g.::
  
      q1 = sess.query(SomeClass).filter(SomeClass.foo == "bar")
      q2 = sess.query(SomeClass).filter(SomeClass.bar == "foo")
  
      q3 = q1.union(q2)
  
  The method accepts multiple Query objects so as to control
  the level of nesting.  A series of ``union()`` calls such as::
  
      x.union(y).union(z).all()
  
  will nest on each ``union()``, and produces:
  
  .. sourcecode:: sql
  
      SELECT * FROM (SELECT * FROM (SELECT * FROM X UNION
                      SELECT * FROM y) UNION SELECT * FROM Z)
  
  Whereas::
  
      x.union(y, z).all()
  
  produces:
  
  .. sourcecode:: sql
  
      SELECT * FROM (SELECT * FROM X UNION SELECT * FROM y UNION
                      SELECT * FROM Z)
  
  Note that many database backends do not allow ORDER BY to
  be rendered on a query called within UNION, EXCEPT, etc.
  To disable all ORDER BY clauses including those configured
  on mappers, issue ``query.order_by(None)`` - the resulting
  :class:`_query.Query` object will not render ORDER BY within
  its SELECT statement.
  
  .. seealso::
  
      :meth:`_sql.Select.union` - v2 equivalent method.
blank_after_short_description: True
blank_after_long_description: False
style: rest
=== detect
rest
=== compose rest
Produce a UNION of this Query against one or more queries.

e.g.::

    q1 = sess.query(SomeClass).filter(SomeClass.foo == "bar")
    q2 = sess.query(SomeClass).filter(SomeClass.bar == "foo")

    q3 = q1.union(q2)

The method accepts multiple Query objects so as to control
the level of nesting.  A series of ``union()`` calls such as::

    x.union(y).union(z).all()

will nest on each ``union()``, and produces:

.. sourcecode:: sql

    SELECT * FROM (SELECT * FROM (SELECT * FROM X UNION
                    SELECT * FROM y) UNION SELECT * FROM Z)

Whereas::

    x.union(y, z).all()

produces:

.. sourcecode:: sql

    SELECT * FROM (SELECT * FROM X UNION SELECT * FROM y UNION
                    SELECT * FROM Z)

Note that many database backends do not allow ORDER BY to
be rendered on a query called within UNION, EXCEPT, etc.
To disable all ORDER BY clauses including those configured
on mappers, issue ``query.order_by(None)`` - the resulting
:class:`_query.Query` object will not render ORDER BY within
its SELECT statement.

.. seealso::

    :meth:`_sql.Select.union` - v2 equivalent method.
