L i{NUdZddlmZddlZddlmZddlmZddlmZddlmZddlmZdd lm Z dd lm Z dd lm Z dd lm Z dd lm Z ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%dd lm&Z&dd!lm'Z'd"d#lm(Z)d"d$lm*Z*d"dlmZd"d%l+m,Z,d"d&l+m-Z-d"d'l+m.Z.d"d(l+m/Z/d"d)l+m0Z0d"d*l+m1Z1d"d+l2m3Z3d"d,l4m5Z5d"d-l4m6Z6d"d.l4m7Z7d/Z8d0e9d1<d2Z:d3e9d4<ed5d67Z;ejxrTdd8lm=Z=dd9lm>Z>dd:l?m@Z@dd;l?mAZAddlmDZDdd?lmEZEdd@lFmGZGddAlmHZHd"dBlImJZJd"dClImKZKd"dDlLmMZMd"dElLmNZNee6dFdGfZOe6dHZPeeQefZReeQefZSe eOdIfZTGdJdKe0jeZVGdLdMeVZWGdNdOeVZXGdPdQe-je0je1jZ\GdRdSe\Z]GdTdUe\Z^GdVdWe\Z_ dodXZ` dpdYZadqdZZb drd[Zcebdsd\Zdebd]d^dtd_Zeebdsd`ZfebdudaZgebddb dvdcZhebduddZiebddb dvdeZjebdudfZkebdsdgZlebdudhZmebd]d^ dwdiZnebdxdjZoebdydkZpeb dzdlZqeb d{dmZrdnZsy)| ) annotationsN)Any)Callable)cast)Dict)Iterable)Optional)overload)Sequence)Tuple)Type)TypeVar)Union)util)insp_is_aliased_class)insp_is_attribute)insp_is_mapper)insp_is_mapper_property)QueryableAttribute)InspectionAttr) LoaderOption)_DEFAULT_TOKEN) _StrPathToken)_WILDCARD_TOKEN)AbstractEntityRegistry)path_is_property) PathRegistry) TokenRegistry)_orm_full_deannotate) AliasedInsp)excinspect)and_) cache_key) coercions)roles) traversals)visitors) _generative)Final)Literal)Self relationshipzFinal[Literal['relationship']]_RELATIONSHIP_TOKENcolumnzFinal[Literal['column']] _COLUMN_TOKEN_FNzCallable[..., Any])bound) _EntityType)_InternalEntityType) _MapperEntity)ORMCompileState) QueryContext) _StrategyKey)MapperProperty) ORMOption)Mapper)_PathRepresentation)_ColumnExpressionArgument)_FromClauseArgument)_CacheKeyTraversalType)CacheKey*QueryableAttribute[Any])r1r3.c`eZdZUdZdZded< d% d&dZddd'd Z d( d)d Zd*d Z d( d+d Z d*d Z d( d+dZ d*dZ d,d-dZd*dZd,d.dZd/dZd0dZ d1dZd2dZed3dZed4dZ d5dZe d6 d7dZe d8 d9dZe d( d:dZe d;dZd d?d Z d@d!ZdAd"Z dBd#Z!e" d, dCd$Z#y)D _AbstractLoad)propagate_to_loadersTboolrINFcr|Ot|ts%tjtj |}nat jdd|}nGt|ddr8t|tsJt|j}|J|j}nd}|j|ddi|d|i|rd nd }|S) aIndicate that the given attribute should be eagerly loaded from columns stated manually in the query. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. The option is used in conjunction with an explicit join that loads the desired rows, i.e.:: sess.query(Order).join(Order.user).options(contains_eager(Order.user)) The above query would join from the ``Order`` entity to its related ``User`` entity, and the returned ``Order`` objects would have the ``Order.user`` attribute pre-populated. It may also be used for customizing the entries in an eagerly loaded collection; queries will normally want to use the :ref:`orm_queryguide_populate_existing` execution option assuming the primary collection of parent objects may already have been loaded:: sess.query(User).join(User.addresses).filter( Address.email_address.like("%@aol.com") ).options(contains_eager(User.addresses)).populate_existing() See the section :ref:`contains_eager` for complete usage details. .. seealso:: :ref:`loading_toplevel` :ref:`contains_eager` NzPassing a string name for the 'alias' argument to 'contains_eager()` is deprecated, and will not work in a future release. Please use a sqlalchemy.alias() or sqlalchemy.orm.aliased() construct.1.4version_of_typelazyjoinedeager_from_aliasT)rIopts_reconcile_to_other) isinstancestrr)expectr*FromClauseRolerwarn_deprecatedgetattrrr&rO selectable_set_relationship_strategy)selfattralias _is_chain_propagate_to_loaders coerced_aliasotcloneds e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/orm/strategy_options.pycontains_eagerz_AbstractLoad.contains_eager^sP  eS) ) 0 01E1Eu M $$:" !& T:t ,d$67 775 !>MMM M00  X !6$m4(1t 1   raiseloadc~|jt|ddd}ddd}|rd|d<|jd|}|S)aIndicate that for a particular entity, only the given list of column-based attribute names should be loaded; all others will be deferred. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. Example - given a class ``User``, load only the ``name`` and ``fullname`` attributes:: session.query(User).options(load_only(User.name, User.fullname)) Example - given a relationship ``User.addresses -> Address``, specify subquery loading for the ``User.addresses`` collection, but on each ``Address`` object load only the ``email_address`` attribute:: session.query(User).options( subqueryload(User.addresses).load_only(Address.email_address) ) For a statement that has multiple entities, the lead entity can be specifically referred to using the :class:`_orm.Load` constructor:: stmt = ( select(User, Address) .join(User.addresses) .options( Load(User).load_only(User.name, User.fullname), Load(Address).load_only(Address.email_address), ) ) When used together with the :ref:`populate_existing ` execution option only the attributes listed will be refreshed. :param \*attrs: Attributes to be loaded, all others will be deferred. :param raiseload: raise :class:`.InvalidRequestError` rather than lazy loading a value when a deferred attribute is accessed. Used to prevent unwanted SQL from being emitted. .. versionadded:: 2.0 .. seealso:: :ref:`orm_queryguide_column_deferral` - in the :ref:`queryguide_toplevel` :param \*attrs: Attributes to be loaded, all others will be deferred. :param raiseload: raise :class:`.InvalidRequestError` rather than lazy loading a value when a deferred attribute is accessed. Used to prevent unwanted SQL from being emitted. .. versionadded:: 2.0 FTdeferred instrumentri)rE_set_column_strategy_expand_column_strategy_attrs)r]riattrsrdwildcard_strategys re load_onlyz_AbstractLoad.load_onlys]x** )% 0d 3  *.TB -1 k *,,    rgcZ|j|ddi|d|intj}|S)a Indicate that the given attribute should be loaded using joined eager loading. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. examples:: # joined-load the "orders" collection on "User" select(User).options(joinedload(User.orders)) # joined-load Order.items and then Item.keywords select(Order).options(joinedload(Order.items).joinedload(Item.keywords)) # lazily load Order.items, but when Items are loaded, # joined-load the keywords collection select(Order).options(lazyload(Order.items).joinedload(Item.keywords)) :param innerjoin: if ``True``, indicates that the joined eager load should use an inner join instead of the default of left outer join:: select(Order).options(joinedload(Order.user, innerjoin=True)) In order to chain multiple eager joins together where some may be OUTER and others INNER, right-nested joins are used to link them:: select(A).options( joinedload(A.bs, innerjoin=False).joinedload(B.cs, innerjoin=True) ) The above query, linking A.bs via "outer" join and B.cs via "inner" join would render the joins as "a LEFT OUTER JOIN (b JOIN c)". When using older versions of SQLite (< 3.7.16), this form of JOIN is translated to use full subqueries as this syntax is otherwise not directly supported. The ``innerjoin`` flag can also be stated with the term ``"unnested"``. This indicates that an INNER JOIN should be used, *unless* the join is linked to a LEFT OUTER JOIN to the left, in which case it will render as LEFT OUTER JOIN. For example, supposing ``A.bs`` is an outerjoin:: select(A).options(joinedload(A.bs).joinedload(B.cs, innerjoin="unnested")) The above join will render as "a LEFT OUTER JOIN b LEFT OUTER JOIN c", rather than as "a LEFT OUTER JOIN (b JOIN c)". .. note:: The "unnested" flag does **not** affect the JOIN rendered from a many-to-many association table, e.g. a table configured as :paramref:`_orm.relationship.secondary`, to the target table; for correctness of results, these joins are always INNER and are therefore right-nested if linked to an OUTER join. .. note:: The joins produced by :func:`_orm.joinedload` are **anonymously aliased**. The criteria by which the join proceeds cannot be modified, nor can the ORM-enabled :class:`_sql.Select` or legacy :class:`_query.Query` refer to these joins in any way, including ordering. See :ref:`zen_of_eager_loading` for further detail. To produce a specific SQL JOIN which is explicitly available, use :meth:`_sql.Select.join` and :meth:`_query.Query.join`. To combine explicit JOINs with eager loading of collections, use :func:`_orm.contains_eager`; see :ref:`contains_eager`. .. seealso:: :ref:`loading_toplevel` :ref:`joined_eager_loading` rPrQ innerjoinrS)r\r EMPTY_DICT)r]r^ruloaders re joinedloadz_AbstractLoad.joinedloadsE\00  X (i(__ 1  rgc*|j|ddiS)a`Indicate that the given attribute should be loaded using subquery eager loading. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. examples:: # subquery-load the "orders" collection on "User" select(User).options(subqueryload(User.orders)) # subquery-load Order.items and then Item.keywords select(Order).options( subqueryload(Order.items).subqueryload(Item.keywords) ) # lazily load Order.items, but when Items are loaded, # subquery-load the keywords collection select(Order).options(lazyload(Order.items).subqueryload(Item.keywords)) .. seealso:: :ref:`loading_toplevel` :ref:`subquery_eager_loading` rPsubqueryr\r]r^s re subqueryloadz_AbstractLoad.subqueryloadHs8..tfj5IJJrgc2|j|ddid|iS)aIndicate that the given attribute should be loaded using SELECT IN eager loading. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. examples:: # selectin-load the "orders" collection on "User" select(User).options(selectinload(User.orders)) # selectin-load Order.items and then Item.keywords select(Order).options( selectinload(Order.items).selectinload(Item.keywords) ) # lazily load Order.items, but when Items are loaded, # selectin-load the keywords collection select(Order).options(lazyload(Order.items).selectinload(Item.keywords)) :param recursion_depth: optional int; when set to a positive integer in conjunction with a self-referential relationship, indicates "selectin" loading will continue that many levels deep automatically until no items are found. .. note:: The :paramref:`_orm.selectinload.recursion_depth` option currently supports only self-referential relationships. There is not yet an option to automatically traverse recursive structures with more than one relationship involved. Additionally, the :paramref:`_orm.selectinload.recursion_depth` parameter is new and experimental and should be treated as "alpha" status for the 2.0 series. .. versionadded:: 2.0 added :paramref:`_orm.selectinload.recursion_depth` .. seealso:: :ref:`loading_toplevel` :ref:`selectin_eager_loading` rPselectinrecursion_depthrvr|)r]r^rs re selectinloadz_AbstractLoad.selectinloadfs0d..  Z #_5/  rgc*|j|ddiS)a<Indicate that the given attribute should be loaded using "lazy" loading. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. .. seealso:: :ref:`loading_toplevel` :ref:`lazy_loading` rPselectr|r}s relazyloadz_AbstractLoad.lazyloads..tfh5GHHrgc6|j|ddid|i}|S)aIndicate that the given attribute should be loaded using an immediate load with a per-attribute SELECT statement. The load is achieved using the "lazyloader" strategy and does not fire off any additional eager loaders. The :func:`.immediateload` option is superseded in general by the :func:`.selectinload` option, which performs the same task more efficiently by emitting a SELECT for all loaded objects. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. :param recursion_depth: optional int; when set to a positive integer in conjunction with a self-referential relationship, indicates "selectin" loading will continue that many levels deep automatically until no items are found. .. note:: The :paramref:`_orm.immediateload.recursion_depth` option currently supports only self-referential relationships. There is not yet an option to automatically traverse recursive structures with more than one relationship involved. .. warning:: This parameter is new and experimental and should be treated as "alpha" status .. versionadded:: 2.0 added :paramref:`_orm.immediateload.recursion_depth` .. seealso:: :ref:`loading_toplevel` :ref:`selectin_eager_loading` rP immediaterrvr|)r]r^rrxs re immediateloadz_AbstractLoad.immediateloads4T00  [ !#_51   rgc*|j|ddiS)aIndicate that the given relationship attribute should remain unloaded. The relationship attribute will return ``None`` when accessed without producing any loading effect. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. :func:`_orm.noload` applies to :func:`_orm.relationship` attributes only. .. legacy:: The :func:`_orm.noload` option is **legacy**. As it forces collections to be empty, which invariably leads to non-intuitive and difficult to predict results. There are no legitimate uses for this option in modern SQLAlchemy. .. seealso:: :ref:`loading_toplevel` rPnoloadr|r}s rerz_AbstractLoad.noloads0..tfh5GHHrgc<|j|d|rdiSdiS)aIndicate that the given attribute should raise an error if accessed. A relationship attribute configured with :func:`_orm.raiseload` will raise an :exc:`~sqlalchemy.exc.InvalidRequestError` upon access. The typical way this is useful is when an application is attempting to ensure that all relationship attributes that are accessed in a particular context would have been already loaded via eager loading. Instead of having to read through SQL logs to ensure lazy loads aren't occurring, this strategy will cause them to raise immediately. :func:`_orm.raiseload` applies to :func:`_orm.relationship` attributes only. In order to apply raise-on-SQL behavior to a column-based attribute, use the :paramref:`.orm.defer.raiseload` parameter on the :func:`.defer` loader option. :param sql_only: if True, raise only if the lazy load would emit SQL, but not if it is only checking the identity map, or determining that the related value should just be None due to missing keys. When False, the strategy will raise for all varieties of relationship loading. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. .. seealso:: :ref:`loading_toplevel` :ref:`prevent_lazy_with_raiseload` :ref:`orm_queryguide_deferred_raiseload` rP raise_on_sqlraiser|)r]r^sql_onlys reriz_AbstractLoad.raiseloads4D.. 6X>C  ;BC  rgc&|j|dS)aIndicate an attribute should load using its predefined loader style. The behavior of this loading option is to not change the current loading style of the attribute, meaning that the previously configured one is used or, if no previous style was selected, the default loading will be used. This method is used to link to other loader options further into a chain of attributes without altering the loader style of the links along the chain. For example, to set joined eager loading for an element of an element:: session.query(MyClass).options( defaultload(MyClass.someattribute).joinedload( MyOtherClass.someotherattribute ) ) :func:`.defaultload` is also useful for setting column-level options on a related class, namely that of :func:`.defer` and :func:`.undefer`:: session.scalars( select(MyClass).options( defaultload(MyClass.someattribute) .defer("some_column") .undefer("some_other_column") ) ) .. seealso:: :ref:`orm_queryguide_relationship_sub_options` :meth:`_orm.Load.options` Nr|r}s re defaultloadz_AbstractLoad.defaultloadsJ..tT::rgcRddd}|rd|d<|jt|f|S)aIndicate that the given column-oriented attribute should be deferred, e.g. not loaded until accessed. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. e.g.:: from sqlalchemy.orm import defer session.query(MyClass).options( defer(MyClass.attribute_one), defer(MyClass.attribute_two) ) To specify a deferred load of an attribute on a related class, the path can be specified one token at a time, specifying the loading style for each link along the chain. To leave the loading style for a link unchanged, use :func:`_orm.defaultload`:: session.query(MyClass).options( defaultload(MyClass.someattr).defer(RelatedClass.some_column) ) Multiple deferral options related to a relationship can be bundled at once using :meth:`_orm.Load.options`:: select(MyClass).options( defaultload(MyClass.someattr).options( defer(RelatedClass.some_column), defer(RelatedClass.some_other_column), defer(RelatedClass.another_column), ) ) :param key: Attribute to be deferred. :param raiseload: raise :class:`.InvalidRequestError` rather than lazy loading a value when the deferred attribute is accessed. Used to prevent unwanted SQL from being emitted. .. versionadded:: 1.4 .. seealso:: :ref:`orm_queryguide_column_deferral` - in the :ref:`queryguide_toplevel` :func:`_orm.load_only` :func:`_orm.undefer` Trkrirn)r]keyristrategys redeferz_AbstractLoad.deferFs;l!%D9 $(H[ !(( )3& 18  rgc@|jt|fdddS)ajIndicate that the given column-oriented attribute should be undeferred, e.g. specified within the SELECT statement of the entity as a whole. The column being undeferred is typically set up on the mapping as a :func:`.deferred` attribute. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. Examples:: # undefer two columns session.query(MyClass).options( undefer(MyClass.col1), undefer(MyClass.col2) ) # undefer all columns specific to a single class using Load + * session.query(MyClass, MyOtherClass).options(Load(MyClass).undefer("*")) # undefer a column on a related object select(MyClass).options(defaultload(MyClass.items).undefer(MyClass.text)) :param key: Attribute to be undeferred. .. seealso:: :ref:`orm_queryguide_column_deferral` - in the :ref:`queryguide_toplevel` :func:`_orm.defer` :func:`_orm.undefer_group` FTrkrn)r]rs reundeferz_AbstractLoad.undefers*H(( )3& 1d 3  rgc<|jtfdd|diS)a$Indicate that columns within the given deferred group name should be undeferred. The columns being undeferred are set up on the mapping as :func:`.deferred` attributes and include a "group" name. E.g:: session.query(MyClass).options(undefer_group("large_attrs")) To undefer a group of attributes on a related entity, the path can be spelled out using relationship loader options, such as :func:`_orm.defaultload`:: select(MyClass).options( defaultload("someattr").undefer_group("large_attrs") ) .. seealso:: :ref:`orm_queryguide_column_deferral` - in the :ref:`queryguide_toplevel` :func:`_orm.defer` :func:`_orm.undefer` Nundefer_group_T)ror)r]names re undefer_groupz_AbstractLoad.undefer_groups-:((  v'>&E  rgcttjtj|}|j |fddi|fS)aApply an ad-hoc SQL expression to a "deferred expression" attribute. This option is used in conjunction with the :func:`_orm.query_expression` mapper-level construct that indicates an attribute which should be the target of an ad-hoc SQL expression. E.g.:: stmt = select(SomeClass).options( with_expression(SomeClass.x_y_expr, SomeClass.x + SomeClass.y) ) .. versionadded:: 1.2 :param key: Attribute to be populated :param expr: SQL expression to be applied to the attribute. .. seealso:: :ref:`orm_queryguide_with_expression` - background and usage examples query_expressionT)extra_criteria)r!r)rWr*LabeledColumnExprRolero)r]r expressions rewith_expressionz_AbstractLoad.with_expressionsO>*   U88* E (( F'. })  rgc r|jddidttd|Dti}|S)aIndicate an eager load should take place for all attributes specific to a subclass. This uses an additional SELECT with IN against all matched primary key values, and is the per-query analogue to the ``"selectin"`` setting on the :paramref:`.mapper.polymorphic_load` parameter. .. versionadded:: 1.2 .. seealso:: :ref:`polymorphic_selectin` selectinload_polymorphicTentitiesc32K|]}t|ywNr%).0clss re z5_AbstractLoad.selectin_polymorphic..sArgcV|$tt|j}|Sd}|Sr)rritems)r]r strategy_keys rerz_AbstractLoad._coerce_strats5   (8!9:L Lrgc`|j|}|j|f|t||||S)N)rSrIreconcile_to_other)r_clone_for_bind_strategyr2)r]r^rrIrSrTrs rer\z(_AbstractLoad._set_relationship_strategysB))(3  %% G  !52 &  rgc^|j|}|j||t||||S)N)rS attr_groupr)rrr4)r]rqrrSrrs reroz"_AbstractLoad._set_column_strategy1s@))(3  %%   ) &  rgcT|j|}|j||dd||S)NT)rIrrr)r]rqrrTrs re_set_generic_strategyz#_AbstractLoad._set_generic_strategyEs=))(3  %%   !%2 &  rgcR|j|}|jd|d||S)Nrvr)r]rrSrs rerz!_AbstractLoad._set_class_strategyVs0))(3  %%dL$T%J rgct)zapply this :class:`_orm._AbstractLoad` object as a sub-option o a :class:`_orm.Load` object. Implementation is provided by subclasses. NotImplementedErrorr]parents re_apply_to_parentz_AbstractLoad._apply_to_parent_ "##rgct)zApply a series of options as sub-options to this :class:`_orm._AbstractLoad` object. Implementation is provided by subclasses. rr]rSs reoptionsz_AbstractLoad.optionshrrgc trr) r]rqr wildcard_keyrSrrIrrs rerz&_AbstractLoad._clone_for_bind_strategyqs "##rgc|jjsy|j||t|j yr)compile_options_enable_eagerloads_processrJ current_path)r] compile_statemapper_entitiess re'process_compile_state_replaced_entitiesz5_AbstractLoad.process_compile_state_replaced_entities~s; ,,??   ]//0 0 rgc|jjsy|j||jt |j  xr|jj yr)rrr_lead_mapper_entitiesrJr_for_refresh_state)r]rs reprocess_compile_statez#_AbstractLoad.process_compile_statesU,,??    / /]//0 0 E!11DDD  rgct)zimplemented by subclassesr)r]rrraiseerrs rerz_AbstractLoad._processrrgcd}tt||jD]\}\}}t|tr\|dk(r4|j dt s|j dtr|cS|tdtk7r||jk7ry||urzt|tr(t|rt|r|j|ry||dzdS)Nr:r) enumeratezip natural_pathrUrVendswithrrr2rrrisa)rto_choppathdebugic_tokenp_tokens re _chop_pathz_AbstractLoad._chop_paths %. ** +&   !A!'3'6$$q(8%9:''!O+<(=>"N"5!6a7HII7;;.'!7N3"7+"7+KK(5 6q1uwrg)NFF) r^ _AttrTyper_zOptional[_FromClauseArgument]r`rJrarJreturnr0)rqrrirJrr0r)r^rruOptional[bool]rr0)r^rrr0)r^rr Optional[int]rr0)F)r^rrrJrr0)rrrirJrr0)rrrr0)rrVrr0)rrr_ColumnExpressionArgument[Any]rr0)rIterable[Type[Any]]rr0)r _StrategySpecrr<)rz Literal[None]rNone)rOptional[_StrategySpec]rOptional[_StrategyKey])TNN) r^rrrrIrJrSOptional[_OptsType]rTrrr0)NN) rqTuple[_AttrType, ...]rrrSrrOptional[Tuple[Any, ...]]rr0)rqrrrrTrrr0)rrrS _OptsTyperr0rLoadrrrSrHrr0NNTNNrqzOptional[Tuple[_AttrType, ...]]rrrOptional[_WildcardKeyType]rSrrOptional[_AttrGroupType]rIrJrrrrrr0)rr:rSequence[_MapperEntity]rr)rr:rrrr:rrrrJrr)rr@rrrrJrzOptional[_PathRepresentation])$__name__ __module__ __qualname__ __slots___is_strategy_option__annotations__rfrsryr~rrrrrirrrrrrr rr-r\rorrrrrrrr classmethodrrrgrerHrHXs)I 04&+ DD-D D $ D  DL>CI\%)WW"W  WrKB*.6 6 '6   6 pI&*.//'/  /bI4$ L%;N; z' R B% % 3%   % N2II AA/  &*$(.2 *#  "  ,  ( %)48 $*"  2   & /3 $ ,    %-6 $$%)/3%)-148 $. $) $1 $ " $ - $# $+ $2 $  $ & 1    "  $&$1$ $  $  # $# #  # ' # # rgrHceZdZUdZdZdej jfdejjfdejjfdejjfgZ dZ de d<d e d<d e d<dd Zdd Ze dd Z ddZddZddZdZ ddZddZed dZ d! d"dZdZdZy)#raRepresents loader options which modify the state of a ORM-enabled :class:`_sql.Select` or a legacy :class:`_query.Query` in order to affect how various mapped attributes are loaded. The :class:`_orm.Load` object is in most cases used implicitly behind the scenes when one makes use of a query option like :func:`_orm.joinedload`, :func:`_orm.defer`, or similar. It typically is not instantiated directly except for in some very specific cases. .. seealso:: :ref:`orm_queryguide_relationship_per_entity_wildcard` - illustrates an example where direct use of :class:`_orm.Load` may be useful )rcontextadditional_source_entitiesrr rIr NrzTuple[_LoadElement, ...]z$Tuple[_InternalEntityType[Any], ...]ctdt|}|j|j|_d|_d|_d|_y)Nz$Union[Mapper[Any], AliasedInsp[Any]]rF)rr& _post_inspect_path_registryrr rIr )r]entityinsps re__init__z Load.__init__s@:GFOL ''  $)!*,'rgc(d|jddS)NLoad(r))rr]s re__str__z Load.__str__styy|nA&&rgc`|j|}||_d|_d|_d|_|S)NrF)__new__rr rIr )rrloads re_construct_for_existing_pathz!Load._construct_for_existing_paths5{{3  $)!*,' rgc0||ur|S|j|Sr)_adjust_for_extra_criteria)r]r  uncached_opts re'_adapt_cached_option_to_uncached_optionz,Load._adapt_cached_option_to_uncached_option s" 4 K..w77rgcn|j}tfd|jD|_|S)Nc3@K|]}|jywr) _prepend_path)relementrs rerz%Load._prepend_path..s! ,3G ! !$ ' )_clonerr r]rrds ` rer zLoad._prepend_paths2 7;||   rgc`|jD]}|jsn|S|jj|S|jj }|jJ dd|j }tfd|jD|_|S)zApply the current bound parameters in a QueryContext to all occurrences "extra_criteria" stored within this ``Load`` object, returning a new instance of this ``Load`` object. cr|j}tfd|jD|_|S)Nc3BK|]}j|ywr)_apply_params_to_element)rcritorig_cache_keyreplacement_cache_keys rerzCLoad._adjust_for_extra_criteria..process..8s+/&>>"D/s)r#r_extra_criteria)optr+r* cloned_opts `` reprocessz0Load._adjust_for_extra_criteria..process1s: J)./'66 /*J & rgc3NK|]}|jr |n|ywr)r,)rvaluer*r/r+s rerz2Load._adjust_for_extra_criteria..Bs8 ((4nE s"%)r- _LoadElementr+rDr*rDrr2)r r,user_passed_query_generate_cache_keyrselect_statementr#r)r]r r1 orig_queryrdr*r/r+s @@@rerzLoad._adjust_for_extra_criterias\\ E$$ K ' 9 9 M M O (K**;; #779)))  #+ %         rgc |j}|D]8}|j}|stj|t d|ds6|cSy)zocalled at process time to allow adjustment of the root entity inside of _LoadElement objects. z_InternalEntityType[Any]rN)r entity_zeroorm_util_entity_corresponds_tor)r]rrrentezeros re!_reconcile_query_entities_with_usz&Load._reconcile_query_entities_with_usLsU yy" COOE88/a9    rgc|j||}t|jj}|jD]&}|r |j s|j |||||(yr)r=rJr _current_pathr rIr)r]rrrreconciled_lead_entityhas_current_pathrxs rerz Load._process_ss "&!G!G X"   = = K KLll F (C(C  ( (&   rgc|jj|jk(sJtfdjj dfj zDslt jdkDrjd}jd}njd}jd}tj||tjjddjddz_|jr#tfd|jD_ jr?xjjz c_ xj j z c_yy)zapply this :class:`_orm.Load` object as a sub-option of another :class:`_orm.Load` object. This method is used by the :meth:`_orm.Load.options` method. c3|K|]3}tj|jjd5ywrNr9$_entity_corresponds_to_use_path_implr odd_element)relemrds rerz(Load._apply_to_parent..s:   9 9fkk--a0  9<rrrNc3@K|]}|jywr)_prepend_path_from)rr1rs rerz(Load._apply_to_parent..s!#5:((0#r") _generaterIanyrrGr len_raise_for_does_not_linkrcoercer r)r]rattrname parent_entityrds ` @rerzLoad._apply_to_parentsA!**d.G.GGGG  0046//0   6;;!#!;;q> & A !;;q> & A $V[[(M J"))&++a*;fkk!n*LM <<"#>Bll#FN >> NNfnn ,N  - -11  - rgc|D]} |j||S#t$r0}t|tst j d|d|d}~wwxYw)aApply a series of options as sub-options to this :class:`_orm.Load` object. E.g.:: query = session.query(Author) query = query.options( joinedload(Author.book).options( load_only(Book.summary, Book.excerpt), joinedload(Book.citations).options(joinedload(Citation.author)), ) ) :param \*opts: A series of loader option objects (ultimately :class:`_orm.Load` objects) which should be applied to the path specified by this :class:`_orm.Load` object. .. versionadded:: 1.3.6 .. seealso:: :func:`.defaultload` :ref:`orm_queryguide_relationship_sub_options` zLoader option z2 is not compatible with the Load.options() method.N)rAttributeErrorrUrHsa_exc ArgumentError)r]rSr-aes rerz Load.optionssw: C $$T*  " !#}5 ..(.11  s A+AAc |rd|_|jjrtjdt |jrm|r>|jj j|jj |dn-tjd|jj d|htj|jd||||||| } | r<|xj| fz c_ |J|xjtd|dz c_ |S|D]} t| tr)tj|j| ||||||| } n(t j|j| ||||||| } | sg|t"ur| j|_|xj| fz c_ | j$j'd d s| j)} |xj| fz c_ |S) NT3Wildcard token cannot be followed by another entityrzMapped attribute 'z#' does not refer to a mapped entity)rrrzTuple[_InternalEntityType[Any]]rrF)rIris_tokenrUrVrprop_strategy_lookup_ClassStrategyLoadcreater r rrUrV_TokenStrategyLoad_AttributeStrategyLoadr2 local_optsget_recurse) r]rqrrrSrrIrr load_elementr^r1s rerzLoad._clone_for_bind_strategys (,D % 99  &&E dii ( //  L**((89// =-44 $%#5-5 L / '''//45tJ7G4/\ S' .dC(#5#<#<  $,#-+='5$= $L$:#@#@  $,#-+='5$A $L $'::$0$5$5 LL\O3L $..223DeL)224 - O' .R rgc`|j}|jj|d<|SNr_shallow_to_dictr serializer]ds re __getstate__zLoad.__getstate__0+  ! ! #II'')& rgc\tj|d|d<|j|yrgr deserialize_shallow_from_dictr]states re __setstate__zLoad.__setstate__5($00v?f  &rg)r_EntityType[Any])rrV)rrrr)r r;rr>rr>)rrrr)r r;rrrrrrr)rrr__doc__rr,ExtendedInternalTraversaldp_has_cache_keyInternalTraversaldp_has_cache_key_list dp_boolean_traverse_internals_cache_key_traversalrrrrrrr rr=rrr-rrrmrurrgrerrs I 33DDE   & & < <  !;!;!F!FG (  & & < <     %% DD-') 8#83<8 82h&&1   @%N''\%)/3%)-148^.^)^1 ^ " ^ - ^#^+^2^ ^@ 'rgrc,eZdZUdZdZdej jfdej jfdej jfgZ dZ de d<d e d<d e d<d e d<d Z dd Z ddZddZddZdZ ddZddZddZy) _WildcardLoadz)represent a standalone '*' load operation)rrrarrraNrCcache_key_traversalrrzUnion[Tuple[()], Tuple[str]]FcJd|_d|_tj|_y)Nr)rrrrwrars rerz_WildcardLoad.__init__Ns  //rgc |J|d} |rt| tr| ttfvsJ|d| } ||_| f|_|rt j||_|Jy)Nrr) rUrVrrrrr immutabledictra) r]rqrrrSrrIrrr^s rerz&_WildcardLoad._clone_for_bind_strategySs   Qx 4%.99  : q'  G "006DO%%%rgctd)Nz(Star option does not support sub-optionsrrs rerz_WildcardLoad.optionsos!"LMMrgc|jsJ|jd}|jtr|jdddt}t t |jj|}|jsJtj|d|jd|j|j}|xj|fz c_y)aPapply this :class:`_orm._WildcardLoad` object as a sub-option of a :class:`_orm.Load` object. This method is used by the :meth:`_orm.Load.options` method. Note that :class:`_orm.WildcardLoad` itself can't have sub-options, but it may be used as the sub-option of a :class:`_orm.Load` object. rrN)rrrsplitrrrtokenrZr_r^rrarIr )r]rr^effective_pathrxs rerz_WildcardLoad._apply_to_parentrsyyyyy| == (jjoa()?*;?COO??$11 *.)) z<@Hz) ))c*o2221 %%%%--hxH  %%%%#**  ' '  MM  OO  % %+  {{#### $$ -$  k@sD>c n|jdtratt|dk7ra|r_t j ddj d|Dddj d|Dd|jtrd }|D]}|cS|rt j d |d y) NrrzMCan't apply wildcard ('*') or load_only() loader option to multiple entities , c32K|]}t|ywr)rVrr;s rerz8_WildcardLoad._find_entity_basestring..s$B#SX$Brz?. Specify loader options for each entity individually, such as c3(K|] }d|d yw)rz).some_option('*')Nrrs rerz8_WildcardLoad._find_entity_basestring..s"&$'#(u,> ?&s.FzFQuery has only expression-based entities - can't find property named "".)rrrNlistrUrVjoinr)r]rrrr;s rerz%_WildcardLoad._find_entity_basestrings >>Ao./ 04>"a' ..>99$B$BBCDP!II&+3&    ^^N +H CJ  **338'= rgc&|j}|Sr)rirks rermz_WildcardLoad.__getstate__s  ! ! #rgc&|j|yr)rrrss reruz_WildcardLoad.__setstate__s &rgrrrrr)rz"Iterable[_InternalEntityType[Any]]rrVrrJrz"Optional[_InternalEntityType[Any]]rDict[str, Any]rtrrr)rrrrxrr,ry dp_plain_objdp_string_multi_dictr~rrrIrrrrrrrmrurrgrerr:s32I X77DDE 33@@A   . . C C 37/6'' && *!&8N$:;z$4$$ $ , $L'rgrcveZdZUdZdZdZdejjfdejjfdejjfdejjfdejjfd ejjfgZ d Zd ed<d ed <d ed<ded<ded<ded<ded<ded<d%dZdZed&dZd'dZd'dZd(dZd)dZdZ d*dZdZdZdZe d+ d,dZd-d Zd.d!Z d/d"Z!d0d#Z"e# d1d$Z$y )2r2aArepresents strategy information to select for a LoaderStrategy and pass options to it. :class:`._LoadElement` objects provide the inner datastructure stored by a :class:`_orm.Load` object and are also the object passed to methods like :meth:`.LoaderStrategy.setup_query`. .. versionadded:: 2.0 )rrrIrar,rTrdrrrar,rIrTNzTuple[Any, ...]rrrrJzutil.immutabledict[str, Any]is_token_strategyis_class_strategyct|Sr)rrs re__hash__z_LoadElement.__hash__+s $xrgc.tj||Sr)r+compare)r]others re__eq__z_LoadElement.__eq__.s!!$..rgcLt|jxr|jduSr)rJrarrs re is_opts_onlyz_LoadElement.is_opts_only1sDOO= (=>>rgc b|j}|j|}|j||Sr) __class__r_shallow_copy_to)r]kwrss rer#z_LoadElement._clone5s,nn KK  a rgc f|j}|jj||_|Sr)r#raunion)r]rnews re _update_optsz_LoadElement._update_opts<s(kkm--b1 rgc`|j}|jj|d<|Srgrhrks rermz_LoadElement.__getstate__Arnrgc\tj|d|d<|j|yrgrprss reruz_LoadElement.__setstate__Frvrgc |j}d}|D]}|j}|sd}n|stjd|ddtjd|dddj d |Dd ) NFTzGQuery has only expression-based entities; attribute loader options for rz can't be applied here.z Mapped class z@ does not apply to any of the root entities in this query, e.g. rc3^K|]%}|jrt|j'ywr)r8rV)rxs rerz3_LoadElement._raise_for_no_match.._s'AMMAMM*s+-zV. Please specify the full path from one of the root entities to the target attribute. )rr8rUrVr)r] parent_loaderrrfound_entitiesr;r<s re_raise_for_no_matchz _LoadElement._raise_for_no_matchJs!!" COOE!%   &&004Qy9##  &&Qy)5II!0   rgctj|j|}|syt|t|z }|j|}t j |f|ddz}|S)a4receives the 'current_path' entry from an :class:`.ORMCompileState` instance, which is set during lazy loads and secondary loader strategy loads, and adjusts the given path to be relative to the current_path. E.g. given a loader path and current path: .. sourcecode:: text lp: User -> orders -> Order -> items -> Item -> keywords -> Keyword cp: User -> orders -> Order -> items The adjusted path would be: .. sourcecode:: text Item -> keywords -> Keyword Nr)rrrrNrrrP)r]rrchopped_start_pathtokens_removed_from_start_pathloader_lead_path_elements re'_adjust_effective_path_for_current_pathz4_LoadElement._adjust_effective_path_for_current_pathhs~0"__  ' ' "),^).s;   9 9 %%a(  rIrz Attribute "rz" does not link from element "r)rMrrGr rUrVr rs` rerKz_LoadElement._prepend_path_froms  0046//0   &&diil^,!!'R 15  !!&++..rgc"|j}|j|jk(sJ|j|jk(sJ|j|jk(sJt j |dd|j ddz|_|S)Nrr)r#rrarrrPrr$s rer z_LoadElement._prepend_paths$--///  DOO333''4+A+AAAA"))$q*v{{1~*EF  rgc|jr|S|jdur|S|jr|S|jdur|S||ur|S|j|jk(r|j|jk(r|S|jr[|j }|jj |j|_|xj |j z c_|S|jr[|j }|jj |j|_|xj |j z c_|S|jjr|Stjd|jd)adefine behavior for when two Load objects are to be put into the context.attributes under the same key. :param replacement: ``_LoadElement`` that seeks to replace the existing one :param existing: ``_LoadElement`` that is already present. FzLoader strategies for z conflict) rTrrarr#rr,rrZrUInvalidRequestError) replacementexistings rerz_LoadElement._reconcilesn"  * *O  , , 5   ) )   ) )U 2O { "    !5!5 5##{'='==   % %(H"*"5"5";";&&#H   $ $ (C(C C $O  " "%,,.K%0%;%;%A%A##&K "  ' '8+C+C C '     & & (($[%5%5$6i @  rg)rint)rrJ)rrrr2rr)rrrrrOptional[PathRegistry])TNNN)rrr^z%Union[_AttrType, _StrPathToken, None]rrrrrarrIrJrrJrrrrrrrr2r)rr2)rrrr2)rrrr2)rr2rr2rr2)%rrrrxr__visit_name__r,ryrzrrr{dp_clauseelement_listr~rrrrpropertyrr#rrmrurrrrrrr^rrcrKr  staticmethodrrrgrer2r2s I$N 33DDE X77DDE   . . C C  H66LLM !;!;!H!HI  : : G GH  $$''$$ ,,/??  '<(*(:F( (T $ $56/3-148))4)) ) 1 ) ( )#))-)+)2) ))V$ /2 6 !6 -96 6 6 rgr2ceZdZUdZdZdZejdejjfdejjfgzZde d<de d<dZ dZd Zd Zd Zd Zfd ZfdZxZS)r`zLoader strategies against specific relationship or column paths. e.g.:: joinedload(User.addresses) defer(Order.name) selectinload(User.orders).lazyload(Order.items) )rO_path_with_polymorphic_pathattribute_strategy_load_elementrOrz*Union[Mapper[Any], AliasedInsp[Any], None]rFc|Jd|_d|_t|\}}} |jr!|} || }|jr |j }|S|j sJtj|d|jsB|r?|r||durtjdt|t||jny|r|jrJ||_n|j|_t|ddr;|j} t!| } | |_|j | |_|| | }n|| }|jr |j }|S)NrrzCan't apply wildcard ('*') or load_only() loader option to multiple entities in the same option. Use separate options per entity.rO)rOr_parse_attr_argument is_property has_entity entity_path is_attributer9rFrrUrVrOrVr,rZr&) r]rr^rrrrr_r[acext_infos rerz!_AttributeStrategyLoad._init_pathtsa +/(,T2 a    D:D''K"" 5<< Hdkk $jm"; ..H -T3t9dkkJ ++ ++#1D #'#7#7D 4T *Br{H$DM/3/?/?/ED ,:h'D:D ??##D rgc|jsJd|jj}|j}|j }|j }|j |t |jS)aApply the current bound parameters in a QueryContext to the immediate "extra_criteria" stored with this Load object. Load objects are typically pulled from the cached version of the statement from a QueryContext. The statement currently being executed will have new values (and keys) for bound parameters in the extra criteria which need to be applied by loader strategies when they handle this criteria for a result set. z8this should only be called if _extra_criteria is present)r,rr5queryr4r(r')r]r r6 current_queryk1k2s re_generate_extra_criteriaz/_AttributeStrategyLoad._generate_extra_criteriasw   F E F **;;   + + -  . . 0**2tT5I5I/JKKrgc|jsJ|j}|sJ|jsKttj j |jj|jfdd}|j}|r|j||}|y|}d|jf}||vr||}|}|j|} | ||<y|||<y)NT)aliased_use_mapper_pathpath_with_polymorphic) rrOis_aliased_classr&r9r"_with_polymorphic_factorymapper base_mapperrr _merge_with) r]r rpwpirrrexisting_aliased_inspthis_aliased_inspnew_aliased_insps re_set_of_type_infoz(_AttributeStrategyLoad._set_of_type_infos////}} t$$$$>>KK++[[N %) ?D55 CCLH!J& (?(?@ '>$+CL ! $ 4@@!  ,GCLGCLrgc*|j}|jj}|jjrJ|r|j sgS|j r|j|j||js|jsgS|r|s|j|||jjr|jj}n |j}|r|J|j||}|gSdtt |j"fgSNrx)rrrrrZrIrOrrrrarrrrrrr) r]rrrr@rrrrs rerz1_AttributeStrategyLoad._prepare_for_compile_states%11 "22EE 99%%%% d77I ==  " "=#;#;\ J}}T__I 2  $ $]O D 99  !YY--N!YYN !- --!II N% 4 n=JJKLLrgcBt|}d|d<|jr|jj|d<|jrU|jj rd|d<|S|jj r|jj|d<|SJd|S)Nrr,rrOzunexpected object for _of_type)superrmrrjrOr is_mapperclass_)r]rlrs rermz#_AttributeStrategyLoad.__getstate__.s G " "   + +00::< + , ==}}-- $*  (( $ 4 4* ?>>urgct|||jddrtj|d|_nd|_|jddrt |d|_yd|_y)NrrO)rrurbrrqrr&rO)r]rtrs reruz#_AttributeStrategyLoad.__setstate__Fsk U# 992D 9/;/G/G340D ,04D , 99Z &#E*$56DM DMrg)rrrrxrrr2r~r,rydp_multirzrrrrrrrrmru __classcell__)rs@rer`r`Ws98!77EN#LJ  D*MX0 ! !rgr`c,eZdZdZdZdZdZdZdZdZ y)r_aLoader strategies against wildcard attributes e.g.:: raiseload("*") Load(User).lazyload("*") defer("*") load_only(User.name, User.email) # will create a defer('*') joinedload(User.addresses).raiseload("*") token_strategy_load_elementTFc|]|jt}|jts|r|r|d|}|j|}|St j d|S)NrkStrings are not accepted for attribute names in loader options; please use class-bound attributes directly.)rrrrrUrV)r]rr^rrrr default_tokens rerz_TokenStrategyLoad._init_pathisl   MM.9M}}_-*^1TF3Dzz$' **K rgc|j}|jj}|jjsJ|r|j sgS|j s|jsgS|j}|r&tj|f|jddz}|r|j||} | gS| }tt|jD cgc]} d| fc} Scc} w)Nrrx)rrrrrZrIrrarrPrrr "_generate_natural_for_superclasses) r]rrrr@rrrrnew_effective_pathrs rerz-_TokenStrategyLoad._prepare_for_compile_state|s%11 "22EE yy!!!! d77I}}T__I !)00')N,?,?,CCN !%!M!M " ") /N!>446  | $   s C!N) rrrrxr inherit_cacherrrrrrgrer_r_Vs) 3NM&0 rgr_c,eZdZdZdZdZdZdZdZdZ y)r]zLoader strategies that deals with a class as a target, not an attribute path e.g.:: q = s.query(Person).options( selectin_polymorphic(Person, [Engineer, Manager]) ) TFclass_strategy_load_elementc|Srrrs rerz_ClassStrategyLoad._init_paths  rgc|j}|jj}|r|jsgS|js|j sgS|j }|r|j||} | gS| }d|jfgSr) rrrrIrrarrr) r]rrrr@rrrrr s rerz-_ClassStrategyLoad._prepare_for_compile_states%11 "22EE d77I}}T__I !%!M!M " ") /N>66788rgN) rrrrxrrrrrrrrgrer]r]s) M2N 9rgr]cd}d|ddfd|ddffD]\}}|D]}t|tr|jdtzrt j dd|d d}|tk(r2|rt jd | t}||tfi|}t jd |t|\}} }t| }|r!|s|j|}|||fd di|}|||fi|}|sJ|S) NTrrFrzThe undocumented `.{WILDCARD}` format is deprecated and will be removed in a future version as it is believed to be unused. If you have been using this functionality, please comment on Issue #4390 on the SQLAlchemy project tracker.rLrMrrYr r`) rUrV startswithrrrYrUrVrrrrr) methrchainedr lead_element is_default_keysr^r lead_entitys re_generate_from_keysrsg -1L#D2J/%bc1CC1B E0 BD$$??3#89((#!&  8D?*!$22- $+'4 #' n#K#KL!../  '((BD( $( d#Ab#ALa0 B1Bf < rgc, t|}t |r|j }|}n9t |r|j }|j}ntjd|||fS#tj$r}tjd|d}~wwxYw)aparse an attribute or wildcard argument to produce an :class:`._AbstractLoad` instance. This is used by the standalone loader strategy functions like ``joinedload()``, ``defer()``, etc. to produce :class:`_orm.Load` or :class:`._WildcardLoad` objects. z:expected ORM mapped attribute for loader strategy argumentN)r&rUNoInspectionAvailablerVrrrr[)r^rerrrr[s rerr' s 't}t$kk  4 kk yy"" H   d ""%  ' '"" H  s A%%B8BBctt|j}|j}d|jd|jd|_||_|S)zdecorator that applies docstrings between standalone loader functions and the loader methods on :class:`._AbstractLoad`. z=Produce a new :class:`_orm.Load` object with the :func:`_orm.z#` option applied. See :func:`_orm.z` for usage examples. )rZrHrrx)fnbound_fnfn_docs reloader_unbound_fnr#L sX }bkk2H   F [[M HBJ Irgc:tdtd|DS)Nrc3|K|]4}t|drtd|jn|fD]}|6yw)_column_strategy_attrsrFN)hasattrrr&)rr^as rerz0_expand_column_strategy_attrs..c sR 4!9:.5LLNW     s:<)rr)rqs rerprp^ s)       rgc:ttj|d|S)NT)rrrfrrs rerfrfs s t22D$ CCrgFrhcrt|}t|d\}}}t|j|d|iS)Nrri)rprrrs)rirqrrs rersrsx s@ *% 0E-eAh7A|Q '4  ' ' D) DDrgc:ttj|d|SNF)rrryr*s reryry s teR @@rgc:ttj|diSr-)rrr~rs rer~r~ s t00$r BBrg)rc>ttj|dd|iSNFr)rrrrrs rerr s&  4):O(L rgc:ttj|diSr-)rrrr/s rerr s t}}dE2 >>rgc>ttj|dd|iSr1)rrrr2s rerr s&  D%*;_)M rgc:ttj|diSr-)rrrr/s rerr s t{{D% <r JJrgct|rtjddttj|f|zdiS)NzThe *addl_attrs on orm.undefer is deprecated. Please use method chaining in conjunction with defaultload() to indicate a path.r9rMF)rrYrrr)rr:s rerr s;    t||cVj-@% LLrgc8t}|j|Sr)rr)rr!s rerr soG   &&rgc@ttj|fdd|iS)NFr)rrr)rrs rerr s'  sfelJ-G rgc:t|}|j|Sr)rr)base_clsruls rerr s hB " "7 ++rgc bt|dkDr|dj|djju}t |r t |}n|jj }tjd|d|dd|r d|ddnd |s||djsmtj|jt|jr:d |dd|d |djjj d |d fzd fztjd|d|dd)Nrrrz ORM mapped entity or attribute "z#" does not link from relationship "z%s".%sz .of_type(rz Did you mean to use "z,)" or "loadopt.options(selectin_polymorphic(z, [z ]), ...)" ?zORM mapped attribute "z" does not link mapped class "") rNrrrrrVrrUrVrr9r:r&)rrQrRpath_is_of_typeparent_entity_strs rerOrO sh 4y1}r(//b1G1GG  / #M 2  - 4 4 = = "".xj9''+Bxj 8,;)DH:Q'+ H55 77 W]%;%B%BRz 123,,0HOO,B,B,K,K+LM)*+ 7      *""$XJ/""&r(1 .  rg) rzCallable[..., _AbstractLoad]rrrrJrrrrH)r^rrzDTuple[InspectionAttr, _InternalEntityType[Any], MapperProperty[Any]])r r5rr5)rqrrr)rrrrrrH)rqrrirJrrH)rrrrH)rrrrrrH)rrr:rrirJrrH)rrr:rrrH)rrVrrH)rrrrrrH)r?rwrrrrH)trx __future__rtypingrrrrr r r r r rrrrBrr9_typingrrrrrrbaser interfacesr path_registryrrrrrrr r!r"r$rUr&sqlr'r(r)r*r+r,sql.baser- util.typingr.r/r0r2rr4r5 TYPE_CHECKINGr7r8r r9r:r;r<r=r>rr?r@ sql._typingrArB sql.cache_keyrCrDr_WildcardKeyTyperVrr_AttrGroupTypeGenerativeOnTraversalrHrr HasCacheKeyHasShallowCopy Traversibler2r`r_r]rrr#rprfrsryr~rrrrrirrrrrrrOrrgrerXs" *&#,* $)(*1+'(&"!6D3D*2 '2 e/0 $,&(%(*%2716( '#, 99 : 34S#X cN y#~&o  J44lo  dm'=m'` }'M}'@Z  :44h6J6JZ z |!\|!~V V r5959p= &= == =  =@"# "#I"#J$ *DD38EEAACC7; '4??7; '4==@@BB>CK K!*K7;KKK&MM''   >,,)<,,,  rg