def cte(self, name=None, recursive=False):
    'Return the full SELECT statement represented by this\n        :class:`.Query` represented as a common table expression (CTE).\n\n        .. versionadded:: 0.7.6\n\n        Parameters and usage are the same as those of the\n        :meth:`.SelectBase.cte` method; see that method for\n        further details.\n\n        Here is the `Postgresql WITH\n        RECURSIVE example\n        <http://www.postgresql.org/docs/8.4/static/queries-with.html>`_.\n        Note that, in this example, the ``included_parts`` cte and the\n        ``incl_alias`` alias of it are Core selectables, which\n        means the columns are accessed via the ``.c.`` attribute.  The\n        ``parts_alias`` object is an :func:`.orm.aliased` instance of the\n        ``Part`` entity, so column-mapped attributes are available\n        directly::\n\n            from sqlalchemy.orm import aliased\n\n            class Part(Base):\n                __tablename__ = \'part\'\n                part = Column(String, primary_key=True)\n                sub_part = Column(String, primary_key=True)\n                quantity = Column(Integer)\n\n            included_parts = session.query(\n                            Part.sub_part,\n                            Part.part,\n                            Part.quantity).\\\n                                filter(Part.part=="our part").\\\n                                cte(name="included_parts", recursive=True)\n\n            incl_alias = aliased(included_parts, name="pr")\n            parts_alias = aliased(Part, name="p")\n            included_parts = included_parts.union_all(\n                session.query(\n                    parts_alias.sub_part,\n                    parts_alias.part,\n                    parts_alias.quantity).\\\n                        filter(parts_alias.part==incl_alias.c.sub_part)\n                )\n\n            q = session.query(\n                    included_parts.c.sub_part,\n                    func.sum(included_parts.c.quantity).\n                        label(\'total_quantity\')\n                ).\\\n                group_by(included_parts.c.sub_part)\n\n        .. seealso::\n\n            :meth:`.SelectBase.cte`\n\n        '
    return self.enable_eagerloads(False).statement.cte(name=name, recursive=recursive)
Return the full SELECT statement represented by this
:class:`.Query` represented as a common table expression (CTE).

.. versionadded:: 0.7.6

Parameters and usage are the same as those of the
:meth:`.SelectBase.cte` method; see that method for
further details.

Here is the `Postgresql WITH
RECURSIVE example
<http://www.postgresql.org/docs/8.4/static/queries-with.html>`_.
Note that, in this example, the ``included_parts`` cte and the
``incl_alias`` alias of it are Core selectables, which
means the columns are accessed via the ``.c.`` attribute.  The
``parts_alias`` object is an :func:`.orm.aliased` instance of the
``Part`` entity, so column-mapped attributes are available
directly::

    from sqlalchemy.orm import aliased

    class Part(Base):
        __tablename__ = 'part'
        part = Column(String, primary_key=True)
        sub_part = Column(String, primary_key=True)
        quantity = Column(Integer)

    included_parts = session.query(
                    Part.sub_part,
                    Part.part,
                    Part.quantity).\
                        filter(Part.part=="our part").\
                        cte(name="included_parts", recursive=True)

    incl_alias = aliased(included_parts, name="pr")
    parts_alias = aliased(Part, name="p")
    included_parts = included_parts.union_all(
        session.query(
            parts_alias.sub_part,
            parts_alias.part,
            parts_alias.quantity).\
                filter(parts_alias.part==incl_alias.c.sub_part)
        )

    q = session.query(
            included_parts.c.sub_part,
            func.sum(included_parts.c.quantity).
                label('total_quantity')
        ).\
        group_by(included_parts.c.sub_part)

.. seealso::

    :meth:`.SelectBase.cte`
def cte(self, name=None, recursive=False):
    'Return the full SELECT statement represented by this\n        :class:`.Query` represented as a common table expression (CTE).\n\n        .. versionadded:: 0.7.6\n\n        Parameters and usage are the same as those of the\n        :meth:`.SelectBase.cte` method; see that method for\n        further details.\n\n        Here is the `Postgresql WITH\n        RECURSIVE example\n        <http://www.postgresql.org/docs/8.4/static/queries-with.html>`_.\n        Note that, in this example, the ``included_parts`` cte and the\n        ``incl_alias`` alias of it are Core selectables, which\n        means the columns are accessed via the ``.c.`` attribute.  The\n        ``parts_alias`` object is an :func:`.orm.aliased` instance of the\n        ``Part`` entity, so column-mapped attributes are available\n        directly::\n\n            from sqlalchemy.orm import aliased\n\n            class Part(Base):\n                __tablename__ = \'part\'\n                part = Column(String, primary_key=True)\n                sub_part = Column(String, primary_key=True)\n                quantity = Column(Integer)\n\n            included_parts = session.query(\n                            Part.sub_part,\n                            Part.part,\n                            Part.quantity).\\\n                                filter(Part.part=="our part").\\\n                                cte(name="included_parts", recursive=True)\n\n            incl_alias = aliased(included_parts, name="pr")\n            parts_alias = aliased(Part, name="p")\n            included_parts = included_parts.union_all(\n                session.query(\n                    parts_alias.sub_part,\n                    parts_alias.part,\n                    parts_alias.quantity).\\\n                        filter(parts_alias.part==incl_alias.c.sub_part)\n                )\n\n            q = session.query(\n                    included_parts.c.sub_part,\n                    func.sum(included_parts.c.quantity).\n                        label(\'total_quantity\')\n                ).\\\n                group_by(included_parts.c.sub_part)\n\n        .. seealso::\n\n            :meth:`.SelectBase.cte`\n\n        '
    return self.enable_eagerloads(False).statement.cte(name=name, recursive=recursive)