@_generative(_no_clauseelement_condition)
def with_polymorphic(self, cls_or_mappers, selectable=None, polymorphic_on=None):
    'Load columns for inheriting classes.\n\n        :meth:`.Query.with_polymorphic` applies transformations\n        to the "main" mapped class represented by this :class:`.Query`.\n        The "main" mapped class here means the :class:`.Query`\n        object\'s first argument is a full class, i.e.\n        ``session.query(SomeClass)``. These transformations allow additional\n        tables to be present in the FROM clause so that columns for a\n        joined-inheritance subclass are available in the query, both for the\n        purposes of load-time efficiency as well as the ability to use\n        these columns at query time.\n\n        See the documentation section :ref:`with_polymorphic` for\n        details on how this method is used.\n\n        .. versionchanged:: 0.8\n            A new and more flexible function\n            :func:`.orm.with_polymorphic` supersedes\n            :meth:`.Query.with_polymorphic`, as it can apply the equivalent\n            functionality to any set of columns or classes in the\n            :class:`.Query`, not just the "zero mapper".  See that\n            function for a description of arguments.\n\n        '
    if (not self._primary_entity):
        raise sa_exc.InvalidRequestError('No primary mapper set up for this Query.')
    entity = self._entities[0]._clone()
    self._entities = ([entity] + self._entities[1:])
    entity.set_with_polymorphic(self, cls_or_mappers, selectable=selectable, polymorphic_on=polymorphic_on)
Load columns for inheriting classes.

:meth:`.Query.with_polymorphic` applies transformations
to the "main" mapped class represented by this :class:`.Query`.
The "main" mapped class here means the :class:`.Query`
object's first argument is a full class, i.e.
``session.query(SomeClass)``. These transformations allow additional
tables to be present in the FROM clause so that columns for a
joined-inheritance subclass are available in the query, both for the
purposes of load-time efficiency as well as the ability to use
these columns at query time.

See the documentation section :ref:`with_polymorphic` for
details on how this method is used.

.. versionchanged:: 0.8
    A new and more flexible function
    :func:`.orm.with_polymorphic` supersedes
    :meth:`.Query.with_polymorphic`, as it can apply the equivalent
    functionality to any set of columns or classes in the
    :class:`.Query`, not just the "zero mapper".  See that
    function for a description of arguments.
@_generative(_no_clauseelement_condition)
def with_polymorphic(self, cls_or_mappers, selectable=None, polymorphic_on=None):
    'Load columns for inheriting classes.\n\n        :meth:`.Query.with_polymorphic` applies transformations\n        to the "main" mapped class represented by this :class:`.Query`.\n        The "main" mapped class here means the :class:`.Query`\n        object\'s first argument is a full class, i.e.\n        ``session.query(SomeClass)``. These transformations allow additional\n        tables to be present in the FROM clause so that columns for a\n        joined-inheritance subclass are available in the query, both for the\n        purposes of load-time efficiency as well as the ability to use\n        these columns at query time.\n\n        See the documentation section :ref:`with_polymorphic` for\n        details on how this method is used.\n\n        .. versionchanged:: 0.8\n            A new and more flexible function\n            :func:`.orm.with_polymorphic` supersedes\n            :meth:`.Query.with_polymorphic`, as it can apply the equivalent\n            functionality to any set of columns or classes in the\n            :class:`.Query`, not just the "zero mapper".  See that\n            function for a description of arguments.\n\n        '
    if (not self._primary_entity):
        raise sa_exc.InvalidRequestError('No primary mapper set up for this Query.')
    entity = self._entities[0]._clone()
    self._entities = ([entity] + self._entities[1:])
    entity.set_with_polymorphic(self, cls_or_mappers, selectable=selectable, polymorphic_on=polymorphic_on)