@_generative(_no_clauseelement_condition)
def select_entity_from(self, from_obj):
    'Set the FROM clause of this :class:`.Query` to a\n        core selectable, applying it as a replacement FROM clause\n        for corresponding mapped entities.\n\n        This method is similar to the :meth:`.Query.select_from`\n        method, in that it sets the FROM clause of the query.  However,\n        where :meth:`.Query.select_from` only affects what is placed\n        in the FROM, this method also applies the given selectable\n        to replace the FROM which the selected entities would normally\n        select from.\n\n        The given ``from_obj`` must be an instance of a :class:`.FromClause`,\n        e.g. a :func:`.select` or :class:`.Alias` construct.\n\n        An example would be a :class:`.Query` that selects ``User`` entities,\n        but uses :meth:`.Query.select_entity_from` to have the entities\n        selected from a :func:`.select` construct instead of the\n        base ``user`` table::\n\n            select_stmt = select([User]).where(User.id == 7)\n\n            q = session.query(User).\\\n                    select_entity_from(select_stmt).\\\n                    filter(User.name == \'ed\')\n\n        The query generated will select ``User`` entities directly\n        from the given :func:`.select` construct, and will be::\n\n            SELECT anon_1.id AS anon_1_id, anon_1.name AS anon_1_name\n            FROM (SELECT "user".id AS id, "user".name AS name\n            FROM "user"\n            WHERE "user".id = :id_1) AS anon_1\n            WHERE anon_1.name = :name_1\n\n        Notice above that even the WHERE criterion was "adapted" such that\n        the ``anon_1`` subquery effectively replaces all references to the\n        ``user`` table, except for the one that it refers to internally.\n\n        Compare this to :meth:`.Query.select_from`, which as of\n        version 0.9, does not affect existing entities.  The\n        statement below::\n\n            q = session.query(User).\\\n                    select_from(select_stmt).\\\n                    filter(User.name == \'ed\')\n\n        Produces SQL where both the ``user`` table as well as the\n        ``select_stmt`` construct are present as separate elements\n        in the FROM clause.  No "adaptation" of the ``user`` table\n        is applied::\n\n            SELECT "user".id AS user_id, "user".name AS user_name\n            FROM "user", (SELECT "user".id AS id, "user".name AS name\n            FROM "user"\n            WHERE "user".id = :id_1) AS anon_1\n            WHERE "user".name = :name_1\n\n        :meth:`.Query.select_entity_from` maintains an older\n        behavior of :meth:`.Query.select_from`.  In modern usage,\n        similar results can also be achieved using :func:`.aliased`::\n\n            select_stmt = select([User]).where(User.id == 7)\n            user_from_select = aliased(User, select_stmt.alias())\n\n            q = session.query(user_from_select)\n\n        :param from_obj: a :class:`.FromClause` object that will replace\n         the FROM clause of this :class:`.Query`.\n\n        .. seealso::\n\n            :meth:`.Query.select_from`\n\n        .. versionadded:: 0.8\n            :meth:`.Query.select_entity_from` was added to specify\n            the specific behavior of entity replacement, however\n            the :meth:`.Query.select_from` maintains this behavior\n            as well until 0.9.\n\n        '
    self._set_select_from([from_obj], True)
Set the FROM clause of this :class:`.Query` to a
core selectable, applying it as a replacement FROM clause
for corresponding mapped entities.

This method is similar to the :meth:`.Query.select_from`
method, in that it sets the FROM clause of the query.  However,
where :meth:`.Query.select_from` only affects what is placed
in the FROM, this method also applies the given selectable
to replace the FROM which the selected entities would normally
select from.

The given ``from_obj`` must be an instance of a :class:`.FromClause`,
e.g. a :func:`.select` or :class:`.Alias` construct.

An example would be a :class:`.Query` that selects ``User`` entities,
but uses :meth:`.Query.select_entity_from` to have the entities
selected from a :func:`.select` construct instead of the
base ``user`` table::

    select_stmt = select([User]).where(User.id == 7)

    q = session.query(User).\
            select_entity_from(select_stmt).\
            filter(User.name == 'ed')

The query generated will select ``User`` entities directly
from the given :func:`.select` construct, and will be::

    SELECT anon_1.id AS anon_1_id, anon_1.name AS anon_1_name
    FROM (SELECT "user".id AS id, "user".name AS name
    FROM "user"
    WHERE "user".id = :id_1) AS anon_1
    WHERE anon_1.name = :name_1

Notice above that even the WHERE criterion was "adapted" such that
the ``anon_1`` subquery effectively replaces all references to the
``user`` table, except for the one that it refers to internally.

Compare this to :meth:`.Query.select_from`, which as of
version 0.9, does not affect existing entities.  The
statement below::

    q = session.query(User).\
            select_from(select_stmt).\
            filter(User.name == 'ed')

Produces SQL where both the ``user`` table as well as the
``select_stmt`` construct are present as separate elements
in the FROM clause.  No "adaptation" of the ``user`` table
is applied::

    SELECT "user".id AS user_id, "user".name AS user_name
    FROM "user", (SELECT "user".id AS id, "user".name AS name
    FROM "user"
    WHERE "user".id = :id_1) AS anon_1
    WHERE "user".name = :name_1

:meth:`.Query.select_entity_from` maintains an older
behavior of :meth:`.Query.select_from`.  In modern usage,
similar results can also be achieved using :func:`.aliased`::

    select_stmt = select([User]).where(User.id == 7)
    user_from_select = aliased(User, select_stmt.alias())

    q = session.query(user_from_select)

:param from_obj: a :class:`.FromClause` object that will replace
 the FROM clause of this :class:`.Query`.

.. seealso::

    :meth:`.Query.select_from`

.. versionadded:: 0.8
    :meth:`.Query.select_entity_from` was added to specify
    the specific behavior of entity replacement, however
    the :meth:`.Query.select_from` maintains this behavior
    as well until 0.9.
@_generative(_no_clauseelement_condition)
def select_entity_from(self, from_obj):
    'Set the FROM clause of this :class:`.Query` to a\n        core selectable, applying it as a replacement FROM clause\n        for corresponding mapped entities.\n\n        This method is similar to the :meth:`.Query.select_from`\n        method, in that it sets the FROM clause of the query.  However,\n        where :meth:`.Query.select_from` only affects what is placed\n        in the FROM, this method also applies the given selectable\n        to replace the FROM which the selected entities would normally\n        select from.\n\n        The given ``from_obj`` must be an instance of a :class:`.FromClause`,\n        e.g. a :func:`.select` or :class:`.Alias` construct.\n\n        An example would be a :class:`.Query` that selects ``User`` entities,\n        but uses :meth:`.Query.select_entity_from` to have the entities\n        selected from a :func:`.select` construct instead of the\n        base ``user`` table::\n\n            select_stmt = select([User]).where(User.id == 7)\n\n            q = session.query(User).\\\n                    select_entity_from(select_stmt).\\\n                    filter(User.name == \'ed\')\n\n        The query generated will select ``User`` entities directly\n        from the given :func:`.select` construct, and will be::\n\n            SELECT anon_1.id AS anon_1_id, anon_1.name AS anon_1_name\n            FROM (SELECT "user".id AS id, "user".name AS name\n            FROM "user"\n            WHERE "user".id = :id_1) AS anon_1\n            WHERE anon_1.name = :name_1\n\n        Notice above that even the WHERE criterion was "adapted" such that\n        the ``anon_1`` subquery effectively replaces all references to the\n        ``user`` table, except for the one that it refers to internally.\n\n        Compare this to :meth:`.Query.select_from`, which as of\n        version 0.9, does not affect existing entities.  The\n        statement below::\n\n            q = session.query(User).\\\n                    select_from(select_stmt).\\\n                    filter(User.name == \'ed\')\n\n        Produces SQL where both the ``user`` table as well as the\n        ``select_stmt`` construct are present as separate elements\n        in the FROM clause.  No "adaptation" of the ``user`` table\n        is applied::\n\n            SELECT "user".id AS user_id, "user".name AS user_name\n            FROM "user", (SELECT "user".id AS id, "user".name AS name\n            FROM "user"\n            WHERE "user".id = :id_1) AS anon_1\n            WHERE "user".name = :name_1\n\n        :meth:`.Query.select_entity_from` maintains an older\n        behavior of :meth:`.Query.select_from`.  In modern usage,\n        similar results can also be achieved using :func:`.aliased`::\n\n            select_stmt = select([User]).where(User.id == 7)\n            user_from_select = aliased(User, select_stmt.alias())\n\n            q = session.query(user_from_select)\n\n        :param from_obj: a :class:`.FromClause` object that will replace\n         the FROM clause of this :class:`.Query`.\n\n        .. seealso::\n\n            :meth:`.Query.select_from`\n\n        .. versionadded:: 0.8\n            :meth:`.Query.select_entity_from` was added to specify\n            the specific behavior of entity replacement, however\n            the :meth:`.Query.select_from` maintains this behavior\n            as well until 0.9.\n\n        '
    self._set_select_from([from_obj], True)