'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):

    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)
