def exists(self):
    "A convenience method that turns a query into an EXISTS subquery\n        of the form EXISTS (SELECT 1 FROM ... WHERE ...).\n\n        e.g.::\n\n            q = session.query(User).filter(User.name == 'fred')\n            session.query(q.exists())\n\n        Producing SQL similar to::\n\n            SELECT EXISTS (\n                SELECT 1 FROM users WHERE users.name = :name_1\n            ) AS anon_1\n\n        The EXISTS construct is usually used in the WHERE clause::\n\n            session.query(User.id).filter(q.exists()).scalar()\n\n        Note that some databases such as SQL Server don't allow an\n        EXISTS expression to be present in the columns clause of a\n        SELECT.    To select a simple boolean value based on the exists\n        as a WHERE, use :func:`.literal`::\n\n            from sqlalchemy import literal\n\n            session.query(literal(True)).filter(q.exists()).scalar()\n\n        .. versionadded:: 0.8.1\n\n        "
    return sql.exists(self.add_columns('1').with_labels().statement.with_only_columns([1]))
A convenience method that turns a query into an EXISTS subquery
of the form EXISTS (SELECT 1 FROM ... WHERE ...).

e.g.::

    q = session.query(User).filter(User.name == 'fred')
    session.query(q.exists())

Producing SQL similar to::

    SELECT EXISTS (
        SELECT 1 FROM users WHERE users.name = :name_1
    ) AS anon_1

The EXISTS construct is usually used in the WHERE clause::

    session.query(User.id).filter(q.exists()).scalar()

Note that some databases such as SQL Server don't allow an
EXISTS expression to be present in the columns clause of a
SELECT.    To select a simple boolean value based on the exists
as a WHERE, use :func:`.literal`::

    from sqlalchemy import literal

    session.query(literal(True)).filter(q.exists()).scalar()

.. versionadded:: 0.8.1
def exists(self):
    "A convenience method that turns a query into an EXISTS subquery\n        of the form EXISTS (SELECT 1 FROM ... WHERE ...).\n\n        e.g.::\n\n            q = session.query(User).filter(User.name == 'fred')\n            session.query(q.exists())\n\n        Producing SQL similar to::\n\n            SELECT EXISTS (\n                SELECT 1 FROM users WHERE users.name = :name_1\n            ) AS anon_1\n\n        The EXISTS construct is usually used in the WHERE clause::\n\n            session.query(User.id).filter(q.exists()).scalar()\n\n        Note that some databases such as SQL Server don't allow an\n        EXISTS expression to be present in the columns clause of a\n        SELECT.    To select a simple boolean value based on the exists\n        as a WHERE, use :func:`.literal`::\n\n            from sqlalchemy import literal\n\n            session.query(literal(True)).filter(q.exists()).scalar()\n\n        .. versionadded:: 0.8.1\n\n        "
    return sql.exists(self.add_columns('1').with_labels().statement.with_only_columns([1]))