MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / AliasedInsp

Class AliasedInsp

lib/sqlalchemy/orm/util.py:838–1315  ·  view source on GitHub ↗

Provide an inspection interface for an :class:`.AliasedClass` object. The :class:`.AliasedInsp` object is returned given an :class:`.AliasedClass` using the :func:`_sa.inspect` function:: from sqlalchemy import inspect from sqlalchemy.orm import aliased my_

Source from the content-addressed store, hash-verified

836
837@inspection._self_inspects
838class AliasedInsp(
839 ORMEntityColumnsClauseRole[_O],
840 ORMFromClauseRole,
841 HasCacheKey,
842 InspectionAttr,
843 MemoizedSlots,
844 inspection.Inspectable["AliasedInsp[_O]"],
845 Generic[_O],
846):
847 """Provide an inspection interface for an
848 :class:`.AliasedClass` object.
849
850 The :class:`.AliasedInsp` object is returned
851 given an :class:`.AliasedClass` using the
852 :func:`_sa.inspect` function::
853
854 from sqlalchemy import inspect
855 from sqlalchemy.orm import aliased
856
857 my_alias = aliased(MyMappedClass)
858 insp = inspect(my_alias)
859
860 Attributes on :class:`.AliasedInsp`
861 include:
862
863 * ``entity`` - the :class:`.AliasedClass` represented.
864 * ``mapper`` - the :class:`_orm.Mapper` mapping the underlying class.
865 * ``selectable`` - the :class:`_expression.Alias`
866 construct which ultimately
867 represents an aliased :class:`_schema.Table` or
868 :class:`_expression.Select`
869 construct.
870 * ``name`` - the name of the alias. Also is used as the attribute
871 name when returned in a result tuple from :class:`_query.Query`.
872 * ``with_polymorphic_mappers`` - collection of :class:`_orm.Mapper`
873 objects
874 indicating all those mappers expressed in the select construct
875 for the :class:`.AliasedClass`.
876 * ``polymorphic_on`` - an alternate column or SQL expression which
877 will be used as the "discriminator" for a polymorphic load.
878
879 .. seealso::
880
881 :ref:`inspection_toplevel`
882
883 """
884
885 __slots__ = (
886 "__weakref__",
887 "_weak_entity",
888 "mapper",
889 "selectable",
890 "name",
891 "_adapt_on_names",
892 "with_polymorphic_mappers",
893 "polymorphic_on",
894 "_use_mapper_path",
895 "_base_alias",

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected