§ <ˆjßáãóð—dZddlmZddlmZddlmZddlmZddlm Z ddlm Z ddl m Z dd l m Z dd l mZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZGd„dee ¦«ZGd„de¦«ZGd„de ¦«Z!e!¦«d@d„¦«Z"e"j#d„¦«Z"e!¦«d„¦«Z$e$j#d „¦«Z$e!¦«d@d!„¦«Z%e%j#d"„¦«Z%e%j&d#„¦«Z'e!¦«d$„¦«Z(e(j#d%„¦«Z(e(j&d&„¦«Z)e!¦«d'„¦«Z*e*j#d(„¦«Z*e*j&d)„¦«Z+e!¦«d*„¦«Z,e,j#d+„¦«Z,e,j&d,„¦«Z-e!¦«d-„¦«Z.e.j#d.„¦«Z.e!¦«d/„¦«Z/e/j#d0„¦«Z/e!¦«dAd2„¦«Z0e0j#d3„¦«Z0e!¦«d4„¦«Z1e1j#d5„¦«Z1e!¦«d6„¦«Z2e2j#d7„¦«Z2e!¦«d8„¦«Z3e3j#d9„¦«Z3e!¦«d:„¦«Z4e4j#d;„¦«Z4e!¦«d<„¦«Z5e5j#d=„¦«Z5e!¦«d>„¦«Z6e6j#d?„¦«Z6dS)Bz é)Úutil)ÚQueryableAttribute)Ú_class_to_mapper)Ú_is_aliased_class)Ú_is_mapped_class)ÚInspectionAttr)Ú MapperOption)ÚMapperProperty)ÚPropComparator)Ú_DEFAULT_TOKEN)Ú_WILDCARD_TOKEN)Ú PathRegistry)Ú TokenRegistry)Ú_orm_full_deannotateé)Úexc©Úinspect)Ú expression)Ú _generative)Ú Generativecó$‡—eZdZdZd„Zed„¦«Zd„Zˆfd„ZdZ dZ dZ dZ dZ d„Zd „Zd „Z dd „Zd „Zd„Zd„Zed„¦«Ze dd„¦«Zedd„¦«Zed„¦«Zed„¦«Z dd„Zdd„Zd„Zd„Zd„Zd„Z ˆxZ!S)ÚLoada£Represents loader options which modify the state of a :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:`.defer`, or similar. However, the :class:`_orm.Load` object can also be used directly, and in some cases can be useful. To use :class:`_orm.Load` directly, instantiate it with the target mapped class as the argument. This style of usage is useful when dealing with a :class:`_query.Query` that has multiple entities:: myopt = Load(MyClass).joinedload("widgets") The above ``myopt`` can now be used with :meth:`_query.Query.options`, where it will only take effect for the ``MyClass`` entity:: session.query(MyClass, MyOtherClass).options(myopt) One case where :class:`_orm.Load` is useful as public API is when specifying "wildcard" options that only take effect for a certain class:: session.query(Order).options(Load(Order).lazyload('*')) Above, all relationships on ``Order`` will be lazy-loaded, but other attributes on those descendant objects will load using their normal loader strategy. .. seealso:: :ref:`deferred_options` :ref:`deferred_loading_w_multiple` :ref:`relationship_loader_options` cóˆ—t|¦«}|j|_tj¦«|_i|_d|_dS©NF)rÚ_path_registryÚpathrÚ OrderedDictÚcontextÚ local_optsÚis_class_strategy)ÚselfÚentityÚinsps úV/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/strategy_options.pyÚ__init__z Load.__init__Ls>€Ý�v‰ŒˆØÔ'ˆŒ õÔ'Ñ)Ô)ˆŒ ؈ŒØ!&ˆÔÐÐócóh—| |¦«}||_i|_i|_d|_|S©N)Ú__new__rrr Ú_of_type)ÚclsrÚloads r%Úfor_existing_pathzLoad.for_existing_pathUs4€à�{Š{˜3ÑԈ؈Œ ؈Œ ؈ŒØˆŒ ؈ r'c óº‡ —|jdjrdSg}|j ¦«D�]—\\}}Š |dkrŒt |jj|¦«D] \}}||ur�naŒ ‰ jp‰ jjd}| ||¦«}| � |s‰ jsŒsg} |D]‚} t| tj ¦«r|   | ¦«Œ2| jrdS| j r|   | j ¦«Œ_| j sJ‚|   | j¦«Œƒ| r || dkr,|j r|   |j¦«n |jrdS|  t| ¦«‰ jpdz‰ jr-tˆ fd„t%‰ j¦«D¦«¦«ndz¦«�Œ™|sdSt|¦«S)NéFÚloaderéÿÿÿÿ©có.•—g|]}|‰j|f‘ŒSr3)r )Ú.0ÚkeyÚobjs €r%ú z,Load._generate_cache_key..•s5ø€ð!"ð!"ð!"à(+ð&)¨#¬.¸Ô*=Ð$>ð!"ð!"ð!"r')rÚis_aliased_classrÚitemsÚzipr+Ú _chop_pathÚ isinstancerÚ string_typesÚappendÚ is_propertyr6Ú is_mapperÚclass_ÚtupleÚstrategyr Úsorted) r"rÚ serializedr6Ú loader_pathÚ local_elemÚobj_elemÚendpointÚchoppedÚserialized_pathÚtokenr7s @r%Ú_generate_cache_keyzLoad._generate_cache_key^slø€Ø Œ9�QŒ<Ô (ð Ø�5àˆ Ø'+¤|×'9Ò'9Ñ';Ô';ð; ñ; Ñ #Ñ ˆS�+ Ø�hŠˆØå(+¨D¬I¬N¸KÑ(HÔ(Hð7 ð7 Ñ$� ˜HØ XÐ-Ð-Ø‘Eð.ðœ<Ð<¨3¬8¬=¸Ô+<�ØŸ/š/¨+°tÑ<Ô<�ð Øðð  ð ð œLððà"$�à$ð =ð =�EÝ! %­Ô):Ñ;Ô;ð=Ø'×.Ò.¨uÑ5Ô5Ð5Ð5ØÔ/ð=Ø$˜u˜u˜uØÔ*ð=Ø'×.Ò.¨u¬yÑ9Ô9Ð9Ð9à$œÐ.Ð.˜Ø'×.Ò.¨u¬|Ñ<Ô<Ð<Ð<à&ð%¨(°oÀbÔ6IÒ*IÐ*IØÔ)ð%Ø'×.Ò.¨x¬Ñ?Ô?Ð?Ð?Ø!Ô2ð%Ø$˜u˜uà×!Ò!å˜oÑ.Ô.Øœ<Ð-¨2ñ/ð #œ~ð $�Eð!"ð!"ð!"ð!"å/5°c´nÑ/EÔ/Eð!"ñ!"ô!"ñôðð"$ñ ñôðùð ð %Ø�4å˜Ñ$Ô$Ð $r'cód•—tt|¦« ¦«}i|_|Sr))ÚsuperrÚ _generater )r"ÚclonedÚ __class__s €r%rQzLoad._generate¤s+ø€Ý•t˜TÑ"Ô"×,Ò,Ñ.Ô.ˆØˆÔ؈ r'FNcó2—| |d¦«dS©NT©Ú_process©r"Úquerys r%Ú process_queryzLoad.process_query¯s€Ø � Š �e˜TÑ"Ô"Ð"Ð"Ð"r'có2—| |d¦«dSrrVrXs r%Úprocess_query_conditionallyz Load.process_query_conditionally²s€Ø � Š �e˜UÑ#Ô#Ð#Ð#Ð#r'cóæ—|j}|rH|j ¦«D],\\}}}| ||¦«}|� ||j||f<Œ-dS|j |j¦«dSr))Ú _current_pathrr:r<Ú _attributesÚupdate)r"rYÚraiseerrÚ current_pathrMÚ start_pathr1Úchopped_start_paths r%rWz Load._processµs–€ØÔ*ˆ Ø ð 3Ø/3¬|×/AÒ/AÑ/CÔ/Cð Lð LÑ+Ñ#�˜  VØ%)§_¢_°ZÀÑ%NÔ%NÐ"Ø%Ð1ØEK�EÔ% uÐ.@Ð&AÑBøð Lð Lð Ô × $Ò $ T¤\Ñ 2Ô 2Ð 2Ð 2Ð 2r'Tc óà—|j}d|_|rM|jsFt|t¦«rt jd¦«‚t jd|j›d�¦«‚t|tj¦«�r~|  t¦«}|}|  t¦«s|rF|rd|_ |r|›d|›�}|r|j s |j|}| |¦«}||_|S|rt#|¦«} n|j} t'| j|¦«} |jx}} n¼#t,$r`} t|t.¦«s@tjt jd|›d| ›dt3|¦«›d �¦«| ¬ ¦«n‚Yd} ~ nWd} ~ wwxYw#t,$rB} |r0tjt jd |›d| ›d �¦«| ¬ ¦«nYd} ~ dSYd} ~ nd} ~ wwxYw||}�nËt5|¦«rFt7j|j|d ¦«s$|r t jd|›d|j›d�¦«‚dS�nv|jx} } t7j|j|d ¦«sj|rft jd|›d|j›dt;|¦«dkr1|jjr%|jj rd|d›d|jj›d�nd›�¦«‚dSt'|dd¦«rÊ|j}t#|¦«x}}|j |  !|j"d¦«}|j sHt7j#|j$j%|j$dd|�t#|¦«nd¬¦«}t#|¦«}|j |  &|j"d|¦«|| |}||_n|| }|�|  '|¦«|jr|j }||_|S)Nz3Wildcard token cannot be followed by another entityzMapped attribute 'z#' does not refer to a mapped entityFú:zExpected attribute "z" on z' to be a mapped attribute; instead got z object.)Úreplace_contextzCan't find property named "z in this Query.r2z Attribute 'z' does not link from element 'ú'z Attribute "z" does not link from element "ú".rz Did you mean to use éþÿÿÿz .of_type(z)?Úr+Úpath_with_polymorphicT)ÚaliasedÚ_use_mapper_pathÚ_existing_alias)(r+Ú has_entityr=rÚsa_excÚ ArgumentErrorÚproprr>Úendswithr r Úpropagate_to_loadersr9ÚparentrMrrr#ÚgetattrrBÚpropertyÚAttributeErrorr Úraise_ÚtyperÚorm_utilÚ$_entity_corresponds_to_use_path_implÚlenrAÚ__name__Ú entity_pathÚgetrÚwith_polymorphicÚmapperÚ base_mapperÚsetÚ _get_strategy)r"rÚattrÚ for_strategyÚ wildcard_keyraÚexisting_of_typeÚ default_tokenÚ attr_str_nameÚentÚfound_propertyÚaeÚerrrsÚacÚext_infoÚ of_type_infoÚexistings r%Ú_generate_pathzLoad._generate_path¿s0€ð œ=ÐØˆŒ Ø ð ˜DœOð ݘ$¥ Ñ.Ô.ð ÝÔ*ØIñôðõÔ*Ð*à26´)°)°)ð>ñôðõ �d�DÔ-Ñ .Ô .ñ@ "Ø ŸMšM­.Ñ9Ô9ˆMØ ˆMØ�}Š}�_Ñ-Ô-ð °ð Ø ð6Ø05�DÔ-Øð:Ø&2 l l°D°DÐ9�Dð $ð9Ð,<Ô,Mð9Øœ;Ð'7Ô8�DØ—z’z $Ñ'Ô'�Ø �” Ø� àð "ÝÐ.Ñ/Ô/��à”k�ð õ˜sœz¨4Ñ0Ô0�ðØ,0¬MÐ9�D˜>˜>øÝ%ð ð ð Ý% d­NÑ;Ô;ð Ýœ Ý"Ô0Ð0ð$1 = =°#°#°#µt¸D±z´z°z°zð!Cñôð -/ðñôððððððððøøøøð øøøøõ"ð ð ð Øð  Ý”KÝÔ,Ð,à37°4°4¸¸¸ð>ñôð),ð ñôððð ˜4˜4˜4˜4˜4ðððððøøøøð øøøð8˜”:ˆD‰DÝ ˜dÑ #Ô #ðG "õÔ@Ø” ˜T "œXñôð ðð Ý Ô.Ð.à48°D°D¸$¼+¸+¸+ðGñôðð  ˜4ñ ð%)¤MÐ 1ˆD�>åÔ@Ø” ˜T "œXñôð ðð Ý Ô.Ð.ð!˜D˜DØ œK˜K˜Kõ $' t¡9¤9¨q¢= =Ø$(¤KÔ$9ð$1à$(¤KÔ$@ð$1 =ð$(¨¤8 8 8¨T¬[Ô-AÐ-AÐ-Að!Cð!Cð &(ð !(ð ñôðð$ ˜4å�t˜Z¨Ñ.Ô.ð "Ø”]�Ý*1°"©+¬+Ð5�˜<àÔ+¨DÔ1×5Ò5Ø”LÐ"9ñô�ð Ô0ð +Ý!Ô2Ø œÔ3Ø œØ $Ø)-à#Ð/õ)0°Ñ(9Ô(9Ð(9à!ðñô�Bõ ' r™{œ{�HàÔ  Ô&×*Ò*Ø”LÐ"9¸2ñôðð˜D”z (Ô+�à ,�” � ð˜D”z�à Ð #Ø × (Ò (¨Ñ 6Ô 6Ð 6Ø Œ?ð $ØÔ#ˆD؈Œ ؈ s1ÄFÄ' D1Ä1 FÄ;AFÆFÆ G*Æ(2G%Ç%G*có—d|j›d�S)NzLoad(strategy=ú))rD©r"s r%Ú__str__z Load.__str__Xs€€Ø&*¤m m mÐ5Ð5r'cóf—|�.tt| ¦«¦«¦«}|Sr))rCrEr:)r"rDs r%Ú _coerce_stratzLoad._coerce_strat[s,€Ø Ð Ý�V H§N¢NÑ$4Ô$4Ñ5Ô5Ñ6Ô6ˆH؈r'có —td¦«‚)NzHOnly 'unbound' loader options may be used with the Load.options() method)ÚNotImplementedError)r"rvÚappliedÚbounds r%Ú_apply_to_parentzLoad._apply_to_parent`s€Ý!ð $ñ ô ð r'có�—i}t|t¦« }|rtd¦«‚|D]}| |||¦«ŒdS)a�Apply 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("summary", "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:`relationship_loader_options` :ref:`deferred_loading_w_multiple` zMThe options() method is currently only supported for 'unbound' loader optionsN)r=Ú _UnboundLoadr�r )r"ÚoptsÚ apply_cacherŸÚopts r%Úoptionsz Load.optionsfsq€ðBˆ ݘt¥\Ñ2Ô2Ð2ˆØ ð Ý%ð/ñôð ðð ;ð ;ˆCØ × Ò   {°EÑ :Ô :Ð :Ð :ð ;ð ;r'cóЗ| |¦«}||_| ||d¦«}|j|_|j|_dx|_|_|j|_dS)NÚ relationshipF)r›ruÚ_clone_for_bind_strategyrr+r!)r"r‡rDrurRs r%Úset_relationship_strategyzLoad.set_relationship_strategy‘si€ð×%Ò% hÑ/Ô/ˆà$8ˆÔ!Ø×.Ò.¨t°X¸~ÑNÔNˆØ”KˆŒ ØœˆŒ Øð 'Ø!œYÔ-ˆNˆNà!œYˆNà Ô "ð Ø&×@Ò@ÑBÔBð ð �Ø×"Ò"Ø”LØØ Ø#Ô0ð #ñôððð ð × Ò Ø” ØØØÔ,ð ñ ô ð ðˆŒ ˆ ˆ r'có¼—|j ¦«}|d�tj|dd¦«|d<|j ¦«|d<|S)Nr)r1r)Ú__dict__ÚcopyrÚserialize_context_dictrÚ serialize©r"Úds r%Ú __getstate__zLoad.__getstate__ùs\€Ø ŒM× Ò Ñ Ô ˆØ ˆYŒ<Ð #Ý'Ô>Ø�)” ˜kñôˆAˆi‰Lð”I×'Ò'Ñ)Ô)ˆˆ&‰ ؈r'cóÄ—|j |¦«tj|j¦«|_|j� tj|j¦«|_dSdSr))rÁr`rÚ deserializerrÚdeserialize_context_dict)r"Ústates r%Ú __setstate__zLoad.__setstate__sT€Ø Œ ×Ò˜UÑ#Ô#Ð#Ý Ô,¨T¬YÑ7Ô7ˆŒ Ø Œ<Ð #Ý'Ô@ÀÄÑNÔNˆDŒLˆLˆLð $Ð #r'có°—d}tt||j¦«¦«D]¥\}\}}t|tj¦«rC|dkr!| dtz¦«r|cS|dt›�kr||j krdS||urŒjt|t¦«r$|j r|j r|  |¦«rŒ£dS||dzd…S©Nr2r0rfz relationship:r) Ú enumerater;rr=rr>rtr r r6rrAÚisa)r"Úto_choprÚiÚc_tokenÚp_tokens r%r<zLoad._chop_paths€Ø ˆå%.­s°7¸D¼IÑ/FÔ/FÑ%GÔ%Gð ð Ñ !ˆAÑ!�˜Ý˜'¥4Ô#4Ñ5Ô5ð ð˜’6�6˜g×.Ò.¨sµ^Ñ/CÑDÔD�6Ø"�N�N�Nà�GµO°OÐEÒEÐEØ 7¤;Ò.Ð.à˜4˜4à˜'Ð!Ð!Øå˜7¥NÑ3Ô3ð àÔ%ð ðÔ%ð ð—K’K Ñ(Ô(ð  ð à�t�tØ�q˜1‘u�w�wÔÐr')Tr)FN)TF)"rÚ __module__Ú __qualname__Ú__doc__r&Ú classmethodr.rNrQrµr!rDrur+rZr\rWr•r™r›r rr¦rªr¯r±r³r©rºr¶rÇrÌr<Ú __classcell__)rSs@r%rr!sø€€€€€ð(ð(ðT'ð'ð'ðððñ„[ððD%ðD%ðD%ðLððððð €LØÐØ€HØ ÐØ€Hð#ð#ð#ð$ð$ð$ð3ð3ð3ð@DðWðWðWðWðr6ð6ð6ðððð  ð ð ð ð(;ð(;ñ„[ð(;ðTà37ð @ð @ð @ñ„[ð @ðð/ð/ð/ñ„[ð/ðð/ð/ñ„[ð/ðð'ð'ñ„[ð'ðCGððððð. <ð <ð <ð <ðððð4ðððOðOðOð  ð ð ð ð ð ð r'rcó~—eZdZdZd„ZdZd„Zd„Zdd„Zd„Z d „Z d „Z d „Z e d „¦«Zd „Zdd„Zd„Zd„Zd„ZdS)r¢a<Represent a loader option that isn't tied to a root entity. The loader option will produce an entity-linked :class:`_orm.Load` object when it is passed :meth:`_query.Query.options`. This provides compatibility with the traditional system of freestanding options, e.g. ``joinedload('x.y.z')``. có0—d|_g|_i|_dS)Nr3)rÚ_to_bindr r˜s r%r&z_UnboundLoad.__init__1s€ØˆŒ ؈Œ ؈Œˆˆr'Fcó—d}|jD]q}t|j|j¦«D] \}}||urnJŒ | |jdgddd¦«}|r#| |¦«}|durdS|r||z }Œr|sdS|S)Nr3r0F)rÜr;rÚ _bind_loaderrN)r"rrFÚvalrHÚval_elemr¥Úc_keys r%rNz _UnboundLoad._generate_cache_key8sÀ؈ Ø”=ð ,ð ,ˆCÝ(+¨D¬I°s´xÑ(@Ô(@ð ,ð ,Ñ$� ˜HØ XÐ-Ð-Ø�Eð.ð×&Ò&¨¬ °!¬  ~°t¸TÀ5ÑIÔI�Øð,Ø×3Ò3°DÑ9Ô9�EØ �~�~Ø$˜u˜uØð,Ø" eÑ+˜ øØð Ø�4àÐ r'cóH—|j |¦«d|_dSr))rÜr?r˜s r%r¶z_UnboundLoad._set_path_strategyKs%€Ø Œ ×Ò˜TÑ"Ô"Ð"ðˆŒ ˆ ˆ r'NcóÚ‡‡‡‡—|‰vr‰|S‰€|jŠ| ¦«}|‰|<|j|_|jr™|jd}t |t j¦«r@| t¦«r&|  d¦«ddztz}|  ‰j|jdd…z||jd¦«|j |j ksJ‚|j |j ksJ‚|j|jksJ‚ˆˆˆˆfd„‰D¦«}‰j|_|j |¦«|j |j¦«|S)Nr2rfr0có@•—h|]}| ‰‰‰‰¦«’ŒSr3)r )r5ÚelemržrŸrvÚto_binds €€€€r%ú z0_UnboundLoad._apply_to_parent..ns=ø€ð ð ð àð × !Ò ! &¨'°5¸'Ñ BÔ Bð ð ð r')rÜrQrDrr=rr>rtr Úsplitr r•rur!rµÚextendr r`)r"rvržrŸrærRr‡Ú new_to_binds ```` r%r z_UnboundLoad._apply_to_parentRs›øøøø€Ø �7ˆ?ˆ?ؘ4”=Ð à ˆ?Ø”mˆGà—’Ñ!Ô!ˆàˆ�‰ àœ-ˆŒØ Œ9ð Ø”9˜R”=ˆDݘ$¥Ô 1Ñ2Ô2ð B°t·}²}Ýñ8ô8ð Bð—z’z #‘” qÔ)¨CÑ/µ/ÑA�Ø × !Ò !Ø” ˜dœi¨¨"¨œoÑ-¨t°T´]ÀDñ ô ð ð Ô*¨dÔ.GÒGÐGÐGÐGØÔ'¨4Ô+AÒAÐAÐAÐAØÔ" dÔ&7Ò7Ð7Ð7Ð7ð ð ð ð ð ð ð àð ñ ô ˆ ð!œ/ˆŒØŒ×Ò˜{Ñ+Ô+Ð+ØÔ× Ò  ¤Ñ1Ô1Ð1àˆ r'cóþ—|rCt|tj¦«r)|ttfvr|tkrd|_|›d|›�}|r&t |d¦«r|js |dd…}|r||fz}||_|S)NFrfr2r0) r=rr>r r rurr!r)r"rr‡rˆr‰s r%r•z_UnboundLoad._generate_pathxs¦€à ð 2å˜4¥Ô!2Ñ3Ô3ð 2ð�­.Ð9Ð9Ð9à•~Ò%Ð%Ø,1�Ô)Ø*˜l˜l¨D¨DÐ1ˆDØ ð Õ$ T¨"¤XÑ.Ô.ð °tÔ7Mð Ø˜˜"˜”:ˆDØ ð "ؘ4˜'‘>ˆD؈Œ ؈ r'cóv—|j ¦«}| |jd¬¦«|d<|S)NT)Úfilter_aliased_classr)rÁrÂÚ_serialize_pathrrÅs r%rÇz_UnboundLoad.__getstate__ˆs8€Ø ŒM× Ò Ñ Ô ˆØ×(Ò(¨¬ÈÐ(ÑNÔNˆˆ&‰ ؈r'cób—g}|dD]Š}t|t¦«r^t|¦«dkr|\}}d}n|\}}}t||¦«}|r| |¦«}| |¦«Œu| |¦«Œ‹t|¦«|d<||_dS)Nrr)r=rCr~rwÚof_typer?rÁ)r"rËÚretr6r,Úpropkeyrðrss r%rÌz_UnboundLoad.__setstate__�s¿€ØˆØ˜”=ð ð ˆCݘ#�uÑ%Ô%ð Ý�s‘8”8˜q’=�=à#&‘L�C˜Ø"�G�Gà,/Ñ)�C˜ 'ݘs GÑ,Ô,�Øð1ØŸ<š<¨Ñ0Ô0�DØ— ’ ˜4Ñ Ô Ð Ð à— ’ ˜3‘”��ݘc™ œ ˆˆf‰ ؈Œ ˆ ˆ r'cóÈ—|jd}|jD]L}||vrF| |¦«| d„|jD¦«|j|j|¦«ŒMdS)NÚ_unbound_load_dedupescó—g|] }|j‘Œ Sr3)Ú entity_zero©r5r�s r%r8z)_UnboundLoad._process..¦s€ÐGÐGÐG¨�S”_ÐGÐGÐGr')r_rÜÚaddrÞÚ_mapper_entitiesr^)r"rYraÚdedupesrßs r%rWz_UnboundLoad._process s„€ØÔ#Ð$;Ô<ˆØ”=ð ð ˆCؘ'Ð!Ð!Ø— ’ ˜CÑ Ô Ð Ø× Ò ØGÐG°Ô0FÐGÑGÔGØÔ'ØÔ%Øñ ôðøð ð r'cóà‡—t¦«}d„Šˆfd„|D¦«}|dd…D]+}d|_|r |||fi|¤Ž}Œ| |¦«}Œ,|||dfi|¤Ž}d|_|S)NcóÚ—t|tj¦«rO|tkrtfS| dtz¦«r |dd…}| d¦«S|fS)Nú.r)r=rr>r r Ú startswithrè©r6s r%Ú _split_keyz+_UnboundLoad._from_keys.._split_key°sh€Ý˜#�tÔ0Ñ1Ô1ð à�/Ò)Ð)Ý*Ð,Ð,à—^’^ C­/Ñ$9Ñ:Ô:ð"ؘa˜b˜bœ'�CØ—y’y ‘~”~Ð%à�v� r'có0•—g|]}‰|¦«D]}|‘ŒŒSr3r3)r5r6rMrs €r%r8z+_UnboundLoad._from_keys..¼s.ø€ÐIÐIÐI ¸¸ÀC¹¼ÐIÐI°�eÐIÐIÐIÐIr'r0r2TF)r¢Ú_is_chain_linkÚ defaultload) r,ÚmethÚkeysÚchainedÚkwr¥Ú all_tokensrMrs @r%Ú _from_keysz_UnboundLoad._from_keys¬s¹ø€å‰nŒnˆð ð ð ðJÐIÐIÐI tÐIÑIÔIˆ à  " Ô%ð -ð -ˆEð"&ˆCÔ Øð -Ø�d˜3 Ð,Ð,¨Ð,Ð,��à—o’o eÑ,Ô,��àˆd�3˜  2œÐ-Ð-¨"Ð-Ð-ˆØ"ˆÔàˆ r'cóö—d}tt|| ¦«¦«¦«D]¹\}\}\}}t|tj¦«rD|dkr!| dtz¦«r|cS|dt›�kr||j krdSŒit|t¦«r;|j |us/|j |ur)|j j r|j  |¦«sdSŒº|dz }||d…SrÎ)rÏr;Úpairsr=rr>rtr r r6r rxÚ _parententityrArÐ)r"rÑrrÒrÓÚp_entityÚp_props r%r<z_UnboundLoad._chop_pathÌs#€Ø ˆÝ09Ý �˜Ÿš™œÑ &Ô &ñ1 ô1 ð ð Ñ ,ˆAÑ,�Ñ+˜( Fõ˜'¥4Ô#4Ñ5Ô5ð Ø˜’6�6˜g×.Ò.¨sµ^Ñ/CÑDÔD�6Ø"�N�N�Nà�GµO°OÐEÒEÐEØ 6¤:Ò-Ð-à˜4˜4øÝ˜G¥^Ñ4Ô4ð ØÔ#¨6Ð1Ð1ØÔ)°Ð9Ð9à#Ô1Ô;ð:ð 'Ô4×8Ò8¸ÑBÔBð:ð  ˜4˜4øà �‰FˆAà�q�r�rŒ{Ðr'cóЗg}|D]à}t|t¦«rw|rH|jrAt|j¦«jr(| |jj|jdf¦«Œa| |jj|j|jf¦«ŒŽt|t¦«r(| |jj|jdf¦«ŒË| |¦«Œá|Sr)) r=rr+rr9r?Ú _parentmapperrBr6r )r"rrírñrMs r%rîz_UnboundLoad._serialize_pathçsù€ØˆØð "ð "ˆEݘ%Õ!3Ñ4Ô4ð "à(ð àœð õ  ¤Ñ/Ô/Ô@ð ð —J’J Ô 3Ô :¸E¼IÀtÐLÑMÔMÐMÐMà—J’JØÔ,Ô3°U´YÀÄÐOñôððõ˜E¥>Ñ2Ô2ð "Ø— ’ ˜EÔ/Ô6¸¼ À4ÐHÑIÔIÐIÐIà— ’ ˜5Ñ!Ô!Ð!Ð!؈ r'c óŽ—|j}|jr|r ||dfz }|r| ||¦«}|sdS|d}t|tj¦«r| |||¦«}nzt|t¦«r%|j}|  |||j |¦«}n@|jr%t|¦«rt|¦«}||vrd}ntjd¦«‚|sdS|} t| ¦«} |�|| _n| j}|j| _|j| _|j| _| j} | jsSt'|¦«D]C\} }|  | j|| t+|¦«dz kr|jndd|¦«sdSŒD| j |j¦«| js| jjr | jj} n| j} | jr<|  ¦«D]&} |  || |j |j¬¦«Œ'n$|  || |j |j¬¦«| S)a]Convert from an _UnboundLoad() object into a Load() object. The _UnboundLoad() uses an informal "path" and does not necessarily refer to a lead entity as it may use string tokens. The Load() OTOH refers to a complete path. This method reconciles from a given Query into a Load. Example:: query = session.query(User).options( joinedload("orders").joinedload("items")) The above options will be an _UnboundLoad object along the lines of (note this is not the exact API of _UnboundLoad):: _UnboundLoad( _to_bind=[ _UnboundLoad(["orders"], {"lazy": "joined"}), _UnboundLoad(["orders", "items"], {"lazy": "joined"}), ] ) After this method, we get something more like this (again this is not exact API):: Load( User, (User, User.orders.property)) Load( User, (User, User.orders.property, Order, Order.items.property)) r0Nz6mapper option expects string key or list of attributesrr¼)rr!r<r=rr>Ú_find_entity_basestringr rxÚ_find_entity_prop_comparatorr rrrqrrrrrDrµrÏr•r~r r`rprvr½r¾rºr)r"ÚentitiesrbrrarcrMr#rsÚ path_elementr1rÚidxr¿s r%rÞz_UnboundLoad._bind_loaderûsÚ€ðH”Yˆ à Ô !ð ) lð )Ø ˜8 Aœ;˜.Ñ (ˆJð ð CØŸš¨°\ÑBÔBˆJàð Ø�4ð˜1” ˆå �e�TÔ.Ñ /Ô /ð Ø×1Ò1°(¸EÀ8ÑLÔLˆFˆFÝ ˜�~Ñ .Ô .ð Ø”>ˆDØ×6Ò6ؘ$ Ô 3°XñôˆFˆFðÔ #ð Õ(8¸Ñ(?Ô(?ð ݘU‘^”^ˆFؘXÐ%Ð%Ø�øåÔ&ØKñôð ðð Ø ˆFàˆ õ �lÑ#Ô#ˆØ Ð Ø$ˆFŒNˆNà”nˆGàœ-ˆŒØ"Ô/ˆÔØ#'Ô#9ˆÔ àŒ{ˆàÔ'ð Ý'¨ Ñ3Ô3ð ð ‘ ��UØ×,Ò,Ø”KØØ%(­C° ©O¬O¸aÑ,?Ò%?Ð%?�D”M�MÀTØØñ ôðð�F�Fðð Ô× Ò  ¤Ñ1Ô1Ð1àÔ'ð )¨F¬KÔ,Bð )Ø#œ[Ô/ˆNˆNà#œ[ˆNð Ô "ð Ø&×@Ò@ÑBÔBð ð �Ø×$Ò$ØØØ $Ô 3Ð3Ø#Ô0ð %ñôððð ð × Ò ØØØ Ô/Ð/ØÔ,ð !ñ ô ð ðˆ r'c óŠ—t|¦«r|}nt|¦«}|D]}tj||¦«r|cSŒ|r�t |¦«s:t jdtjt|¦«¦«›d|›d�¦«‚t jd|›dd  d„|D¦«¦«›d�¦«‚dS) Nz@Query has only expression-based entities, which do not apply to z "ú"zMapped attribute "zA" does not apply to any of the root entities in this query, e.g. ú, c3ó4K—|]}t|¦«V—ŒdSr)©Ústr)r5Úxs r%ú z<_UnboundLoad._find_entity_prop_comparator..•s(èè€Ð*DÐ*D°a­3¨q©6¬6Ð*DÐ*DÐ*DÐ*DÐ*DÐ*Dr'zV. Please specify the full path from one of the root entities to the target attribute. ) rrr|Ú_entity_corresponds_toÚlistrqrrrÚclsname_as_plain_namer{Újoin)r"rrsrƒraÚ searchforr�s r%rz)_UnboundLoad._find_entity_prop_comparator~s€Ý ˜VÑ $Ô $ð 1؈IˆIå(¨Ñ0Ô0ˆIØð ð ˆCÝÔ.¨s°IÑ>Ô>ð Ø� � � ð ðð ݘH‘~”~ðÝ Ô.Ð.õ Ô5µd¸4±j´jÑAÔAÐAÐAÀ4À4À4ðIñôðõ !Ô.Ð.ð  ˜4˜4 §¢Ð*DÐ*D¸8Ð*DÑ*DÔ*DÑ!DÔ!DÐ!DÐ!Dð Fñôðð�tr'c ó¬—| dtz¦«rxtt|¦«¦«dkrW|rUt jdd d„|D¦«¦«›dd d„|D¦«¦«›d�¦«‚n| t¦«rd }|D]}|cS|rt jd |›d �¦«‚dS) NrfrzMCan't apply wildcard ('*') or load_only() loader option to multiple entities rc3ó4K—|]}t|¦«V—ŒdSr)rr÷s r%rz7_UnboundLoad._find_entity_basestring..¤s(èè€Ð%CÐ%C°3¥c¨#¡h¤hÐ%CÐ%CÐ%CÐ%CÐ%CÐ%Cr'z?. Specify loader options for each entity individually, such as c3ó K—|] }d|zV—Œ dS)zLoad(%s).some_option('*')Nr3r÷s r%rz7_UnboundLoad._find_entity_basestring..¥s;èè€ð&ð&à$'ð!<¸cÑ Að&ð&ð&ð&ð&ð&r'rýFzFQuery has only expression-based entities - can't find property named "ri)rtr r~r rqrrr"r )r"rrMrar�s r%rz$_UnboundLoad._find_entity_basestringšs €Ø �>Š>˜#¥Ñ/Ñ 0Ô 0ð Ý•4˜‘>”>Ñ"Ô" aÒ'Ð'Øð Ý Ô.Ð.ð !ŸIšIÐ%CÐ%C¸(Ð%CÑ%CÔ%CÑCÔCÐCÐCØ ŸIšIð&ð&à+3ð&ñ&ô&ñôððð ñ ô ð øð�^Š^�NÑ +Ô +ð ØˆHàð ð ˆCðˆJˆJˆJàð ÝÔ*Ð*à:?¸%¸%ðBñôðð �tr'r)©F)rrÕrÖr×r&rrNr¶r r•rÇrÌrWrØr r<rîrÞrrr3r'r%r¢r¢&s€€€€€ðððððð €Nðððð&ððð$ð$ð$ð$ðLððð ððð ððð& ð ð ðððñ„[ðð>ððð6ðððð(AðAðAðFððð8 ð ð ð ð r'r¢có&—eZdZd„Zd„Zd„Zd„ZdS)Ú loader_optioncó—dSr)r3r˜s r%r&zloader_option.__init__¾s€Ø ˆr'cóª—|jx|_}||_tt|¦«rt d|z¦«‚t t||¦«|S)Nz#Load class already has a %s method.)rÚnameÚfnÚhasattrrÚ TypeErrorÚsetattr)r"r-r,s r%Ú__call__zloader_option.__call__ÁsU€Øœ;Ð&ˆŒ �D؈ŒÝ •4˜Ñ Ô ð LÝÐAÀTÑJÑKÔKÐ KÝ•�d˜BÑÔÐàˆ r'cóf—||_|jj}dd|jiz|j_||_|S)Nz‡Produce a new :class:`_orm.Load` object with the :func:`_orm.%(name)s` option applied. See :func:`_orm.%(name)s` for usage examples. r,)Ú _unbound_fnr-r×r,)r"r-Úfn_docs r%Ú_add_unbound_fnzloader_option._add_unbound_fnÊs?€ØˆÔØ””ˆðð �D”Ið ñ  ˆŒŒðˆŒ ؈ r'cóŠ—dd|jiz|_tjddd|jizd¬¦«|¦«}||_|S)Na}Produce a standalone "all" option for :func:`_orm.%(name)s`. .. deprecated:: 0.9 The :func:`_orm.%(name)s_all` function is deprecated, and will be removed in a future release. Please use method chaining with :func:`_orm.%(name)s` instead, as in:: session.query(MyClass).options( %(name)s("someattribute").%(name)s("anotherattribute") ) r,z0.9z•The :func:`.%(name)s_all` function is deprecated, and will be removed in a future release. Please use method chaining with :func:`.%(name)s` insteadF)Úadd_deprecation_to_docstring)r,r×rÚ deprecatedÚ_unbound_all_fn)r"r-s r%Ú_add_unbound_all_fnz!loader_option._add_unbound_all_fnÙsr€ð ð �D”Ið ñ ˆŒ ð  �TŒ_Ø ð (à+1°4´9Ð*=ñ >ð*/ð  ñ ô ð ñ ôˆð "ˆÔ؈ r'N)rrÕrÖr&r1r5r:r3r'r%r)r)½sP€€€€€ð ð ð ðððð ð ð ðððððr'r)Ncó—|�,t|t¦«st|¦«}|j}n,t |dd¦«rt|j¦«}|j}| |ddid¬¦«}||jd<|S)aõIndicate 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 :meth:`_query.Query.populate_existing` method 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` Nr+ÚlazyÚjoinedF)ruÚeager_from_alias)r=rrÚ selectablerwr+rªr )Úloadoptr‡ÚaliasÚinfoÚotrRs r%Úcontains_eagerrDös•€ðN Ðݘ%¥Ñ%Ô%ð $ݘ5‘>”>ˆDØ”OˆEøå ��z 4Ñ (Ô (ðÝ �T”]Ñ #Ô #ˆØ” ˆà × .Ò .Ø ˆv�xÐ °uð/ñô€Fð-2€FÔÐ(Ñ)Ø €Mr'có^—t¦« tj|d|¦«SrU)r¢r rD©rrs r%rDrD-s*€å ‰>Œ>× $Ò $ÝÔ# T¨4°ñ ô ðr'cóp—| |dddœ¦«}| ddddœddi¦«|S)aQIndicate 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("name", "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("addresses").load_only("email_address") ) For a :class:`_query.Query` that has multiple entities, the lead entity can be specifically referred to using the :class:`_orm.Load` constructor:: session.query(User, Address).join(User.addresses).options( Load(User).load_only("name", "fullname"), Load(Address).load_only("email_address") ) .. note:: This method will still load a :class:`_schema.Column` even if the column property is defined with ``deferred=True`` for the :func:`.column_property` function. .. versionadded:: 0.9.0 FT©ÚdeferredÚ instrumentÚ*Ú undefer_pks©r¯)r@r®rRs r%Ú load_onlyrN4s\€ðL× (Ò (Ø ˜E°Ð6Ð6ñô€Fð ×ÒØ ˜$¨dÐ 3Ð 3°mÀTÐ5Jñôðð €Mr'có.—t¦«j|ŽSr))r¢rN)r®s r%rNrNcs€à #�<‰>Œ>Ô # UÐ +Ð+r'cóN—| |ddi¦«}|� ||jd<|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" query(User).options(joinedload(User.orders)) # joined-load Order.items and then Item.keywords query(Order).options( joinedload(Order.items).joinedload(Item.keywords)) # lazily load Order.items, but when Items are loaded, # joined-load the keywords collection query(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:: query(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:: query(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:: query(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. .. versionchanged:: 1.0.0 ``innerjoin=True`` now implies ``innerjoin="nested"``, whereas in 0.9 it implied ``innerjoin="unnested"``. In order to achieve the pre-1.0 "unnested" inner join behavior, use the value ``innerjoin="unnested"``. See :ref:`migration_3008`. .. note:: The joins produced by :func:`_orm.joinedload` are **anonymously aliased**. The criteria by which the join proceeds cannot be modified, nor can the :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:`_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` r<r=NÚ innerjoin)rªr )r@r‡rQr1s r%Ú joinedloadrRhs7€ðp× .Ò .¨t°f¸hÐ5GÑ HÔ H€FØÐØ)2ˆÔ˜+Ñ&Ø €Mr'cóP—t tj|d|¦«Sr©r¢r rRrFs r%rRrRÆs€å × "Ò "¥<Ô#:¸DÀ%ÈÑ LÔ LÐLr'cóP—t tj|d|¦«SrUrTrFs r%Újoinedload_allrVËs€å × "Ò "¥<Ô#:¸DÀ$ÈÑ KÔ KÐKr'có2—| |ddi¦«S)aIndicate 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" query(User).options(subqueryload(User.orders)) # subquery-load Order.items and then Item.keywords query(Order).options( subqueryload(Order.items).subqueryload(Item.keywords)) # lazily load Order.items, but when Items are loaded, # subquery-load the keywords collection query(Order).options( lazyload(Order.items).subqueryload(Item.keywords)) .. seealso:: :ref:`loading_toplevel` :ref:`subquery_eager_loading` r<Úsubquery©rª©r@r‡s r%Ú subqueryloadr[Ðs€ð< × ,Ò ,¨T°F¸JÐ3GÑ HÔ HÐHr'cóP—t tj|di¦«Sr©r¢r r[©rs r%r[r[ñó€å × "Ò "¥<Ô#<¸dÀEÈ2Ñ NÔ NÐNr'cóP—t tj|di¦«SrUr]r^s r%Úsubqueryload_allraöó€å × "Ò "¥<Ô#<¸dÀDÈ"Ñ MÔ MÐMr'có2—| |ddi¦«S)a9Indicate 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" query(User).options(selectinload(User.orders)) # selectin-load Order.items and then Item.keywords query(Order).options( selectinload(Order.items).selectinload(Item.keywords)) # lazily load Order.items, but when Items are loaded, # selectin-load the keywords collection query(Order).options( lazyload(Order.items).selectinload(Item.keywords)) .. versionadded:: 1.2 .. seealso:: :ref:`loading_toplevel` :ref:`selectin_eager_loading` r<ÚselectinrYrZs r%Ú selectinloadreûs€ð> × ,Ò ,¨T°F¸JÐ3GÑ HÔ HÐHr'cóP—t tj|di¦«Sr©r¢r rer^s r%rerer_r'cóP—t tj|di¦«SrUrgr^s r%Úselectinload_allri"rbr'có2—| |ddi¦«S)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` r<ÚselectrYrZs r%Úlazyloadrl's€ð × ,Ò ,¨T°F¸HÐ3EÑ FÔ FÐFr'cóP—t tj|di¦«Sr©r¢r rlr^s r%rlrl9s€å × "Ò "¥<Ô#8¸$ÀÀrÑ JÔ JÐJr'cóP—t tj|di¦«SrUrnr^s r%Ú lazyload_allrp>s€å × "Ò "¥<Ô#8¸$ÀÀbÑ IÔ IÐIr'có6—| |ddi¦«}|S)aIndicate that the given attribute should be loaded using an immediate load with a per-attribute SELECT statement. 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. .. seealso:: :ref:`loading_toplevel` :ref:`selectin_eager_loading` r<Ú immediaterY)r@r‡r1s r%Ú immediateloadrsCs#€ð&× .Ò .¨t°f¸kÐ5JÑ KÔ K€FØ €Mr'cóP—t tj|di¦«Sr)r¢r rsr^s r%rsrsZs€å × "Ò "¥<Ô#=¸tÀUÈBÑ OÔ OÐOr'có2—| |ddi¦«S)a€Indicate that the given relationship attribute should remain unloaded. 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; for column-based attributes, see :func:`_orm.defer`. .. seealso:: :ref:`loading_toplevel` r<ÚnoloadrYrZs r%rvrv_s€ð × ,Ò ,¨T°F¸HÐ3EÑ FÔ FÐFr'cóP—t tj|di¦«Sr)r¢r rvr^s r%rvrvrs€å × "Ò "¥<Ô#6¸¸eÀRÑ HÔ HÐHr'Fcó:—| |d|rdndi¦«S)a³Indicate that the given relationship attribute should disallow lazy loads. 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. :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 lazyload. This function is part of the :class:`_orm.Load` interface and supports both method-chained and standalone operation. :func:`_orm.raiseload` applies to :func:`_orm.relationship` attributes only. .. versionadded:: 1.1 .. seealso:: :ref:`loading_toplevel` :ref:`prevent_lazy_with_raiseload` r<Ú raise_on_sqlÚraiserY)r@r‡Úsql_onlys r%Ú raiseloadr|ws0€ðB × ,Ò ,Ø ˆv¨Ð>�~�~°wÐ?ñ ô ðr'cóP—t tj|d|¦«Sr)r¢r r|rFs r%r|r|�s€å × "Ò "¥<Ô#9¸4ÀÈÑ KÔ KÐKr'có.—| |d¦«S)a:Indicate an attribute should load using its default loader style. 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.query(MyClass).options( defaultload(MyClass.someattribute). defer("some_column"). undefer("some_other_column") ) .. seealso:: :meth:`_orm.Load.options` - allows for complex hierarchical loader option structures with less verbosity than with individual :func:`.defaultload` directives. :ref:`relationship_loader_options` :ref:`deferred_loading_w_multiple` NrYrZs r%rr¢s€ðD × ,Ò ,¨T°4Ñ 8Ô 8Ð8r'cóP—t tj|di¦«Sr)r¢r rr^s r%rrÇs€å × "Ò "¥<Ô#;¸TÀ5È"Ñ MÔ MÐMr'có6—| |fdddœ¦«S)a„Indicate 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("attribute_one"), defer("attribute_two")) 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("someattr").defer("some_column")) A :class:`_orm.Load` object that is present on a certain path can have :meth:`_orm.Load.defer` called multiple times, each will operate on the same parent entity:: session.query(MyClass).options( defaultload("someattr"). defer("some_column"). defer("some_other_column"). defer("another_column") ) :param key: Attribute to be deferred. :param \*addl_attrs: This option supports the old 0.8 style of specifying a path as a series of attributes, which is now superseded by the method-chained style. .. deprecated:: 0.9 The \*addl_attrs on :func:`_orm.defer` is deprecated and will be removed in a future release. Please use method chaining in conjunction with defaultload() to indicate a path. .. seealso:: :ref:`deferred` :func:`_orm.undefer` TrHrM©r@r6s r%Údeferr‚Ìs,€ðv × &Ò &Ø ˆ˜T°Ð6Ð6ñ ô ðr'có„—|rtjd¦«t tj|f|zdi¦«S)Nz}The *addl_attrs on orm.defer is deprecated. Please use method chaining in conjunction with defaultload() to indicate a path.F)rÚwarn_deprecatedr¢r r‚©r6Ú addl_attrss r%r‚r‚ sQ€àð Ý Ôð ñ ô ð õ × "Ò "ÝÔ˜S˜F ZÑ/°¸ñ ô ðr'có6—| |fdddœ¦«S)agIndicate 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("col1"), undefer("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 session.query(MyClass).options( defaultload(MyClass.items).undefer('text')) :param key: Attribute to be undeferred. :param \*addl_attrs: This option supports the old 0.8 style of specifying a path as a series of attributes, which is now superseded by the method-chained style. .. deprecated:: 0.9 The \*addl_attrs on :func:`_orm.undefer` is deprecated and will be removed in a future release. Please use method chaining in conjunction with defaultload() to indicate a path. .. seealso:: :ref:`deferred` :func:`_orm.defer` :func:`_orm.undefer_group` FTrHrMr�s r%Úundeferrˆs,€ðX × &Ò &Ø ˆ˜U°$Ð7Ð7ñ ô ðr'có„—|rtjd¦«t tj|f|zdi¦«S)NzThe *addl_attrs on orm.undefer is deprecated. Please use method chaining in conjunction with defaultload() to indicate a path.F)rr„r¢r rˆr…s r%rˆrˆJsQ€àð Ý Ôð ñ ô ð õ × "Ò "ÝÔ˜s˜f zÑ1°5¸"ñ ô ðr'có>—| ddd|zdid¬¦«S)aIndicate 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`:: session.query(MyClass).options( defaultload("someattr").undefer_group("large_attrs")) .. versionchanged:: 0.9.0 :func:`_orm.undefer_group` is now specific to a particular entity load path. .. seealso:: :ref:`deferred` :func:`_orm.defer` :func:`_orm.undefer` rKNzundefer_group_%sT)r­rM)r@r,s r%Ú undefer_groupr‹Ws5€ð> × &Ò &Ø ˆTÐ&¨Ñ-¨tÐ4Àð 'ñ ô ðr'cóD—t¦« |¦«Sr))r¢r‹)r,s r%r‹r‹{s€å ‰>Œ>× 'Ò '¨Ñ -Ô -Ð-r'có~—tjt|¦«¦«}| |fddid|i¬¦«S)a–Apply 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.:: sess.query(SomeClass).options( with_expression(SomeClass.x_y_expr, SomeClass.x + SomeClass.y) ) .. versionadded:: 1.2 :param key: Attribute to be undeferred. :param expr: SQL expression to be applied to the attribute. .. note:: the target attribute is populated only if the target object is **not currently loaded** in the current :class:`_orm.Session` unless the :meth:`_query.Query.populate_existing` method is used. Please refer to :ref:`mapper_querytime_expression` for complete usage details. .. seealso:: :ref:`mapper_querytime_expression` Úquery_expressionTr©r£)Úsql_exprÚ_labeledrr¯)r@r6rs r%Úwith_expressionr’€sO€õBÔ"Õ#7¸ Ñ#CÔ#CÑDÔD€Jà × &Ò &Ø ˆÐ# TÐ*°,À Ð1Kð 'ñ ô ðr'cóV—t tj|fdd|i¦«S)NFr)r¢r r’)r6rs r%r’r’¨s-€å × "Ò "ÝÔ$ s f¨e°lÀJÐ5Oñ ô ðr'c ó’—| ddidttd„|D¦«t¬¦«¦«i¬¦«|S)a~Indicate 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_polymorphicTrc3ó4K—|]}t|¦«V—ŒdSr)r)r5r,s r%rz'selectin_polymorphic..Ãs(èè€Ð8Ð8¨� ™ œ Ð8Ð8Ð8Ð8Ð8Ð8r'rÿr�)r³rCrEÚid)r@Úclassess r%Úselectin_polymorphicr™¯sc€ð  ×ÒØ # TÐ*à �ÝÐ8Ð8°Ð8Ñ8Ô8½bÐAÑAÔAñôð ðñôðð €Nr'có„—t¦«}d|_t|¦«f|_| |¦«|SrU)r¢r!rrr™)Úbase_clsr˜Úuls r%r™r™Ês>€å ‰Œ€BØ€BÔÝ�xÑ Ô Ð"€B„GØ×Ò˜GÑ$Ô$Ð$Ø €Ir'r)r')7r×rkrr|Ú attributesrÚbaserrrrÚ interfacesr r r Ú path_registryr r rrrrrqrÚsqlrr�Úsql.baserrrr¢Úobjectr)rDr5rNrRr:rVr[rarerirlrprsrvr|rr‚rˆr‹r’r™r3r'r%úr¤s ððððÐÐÐÐÐØ*Ð*Ð*Ð*Ð*Ð*Ø"Ð"Ð"Ð"Ð"Ð"Ø#Ð#Ð#Ð#Ð#Ð#Ø"Ð"Ð"Ð"Ð"Ð"Ø Ð Ð Ð Ð Ð Ø$Ð$Ð$Ð$Ð$Ð$Ø&Ð&Ð&Ð&Ð&Ð&Ø&Ð&Ð&Ð&Ð&Ð&Ø)Ð)Ð)Ð)Ð)Ð)Ø*Ð*Ð*Ð*Ð*Ð*Ø'Ð'Ð'Ð'Ð'Ð'Ø(Ð(Ð(Ð(Ð(Ð(Ø&Ð&Ð&Ð&Ð&Ð&ØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØ(Ð(Ð(Ð(Ð(Ð(Ø"Ð"Ð"Ð"Ð"Ð"Ø!Ð!Ð!Ð!Ð!Ð!ðB ðB ðB ðB ðB ˆ:�|ñB ôB ðB ðJTðTðTðTðT�4ñTôTðTðn 6ð6ð6ð6ð6�Fñ6ô6ð6ðr€�„ð3ð3ð3ñ„ð3ðlÔððñ Ôðð €�„ð+ð+ñ„ð+ð\ Ôð,ð,ñÔð,ð€�„ðZðZðZñ„ðZðz ÔðMðMñÔðMð ÔðLðLñ ÔðLð€�„ðIðIñ„ðIð@ÔðOðOñÔðOðÔ!ðNðNñ"Ô!ðNð€�„ðIðIñ„ðIðBÔðOðOñÔðOðÔ!ðNðNñ"Ô!ðNð€�„ðGðGñ„ðGð" ÔðKðKñÔðKð ÔðJðJñÔðJð€�„ððñ„ðð,ÔðPðPñÔðPð€�„ðGðGñ„ðGð$ÔðIðIñÔðIð€�„ð"ð"ð"ñ„ð"ðJ ÔðLðLñÔðLð€�„ð!9ð!9ñ„ð!9ðH ÔðNðNñÔðNð€�„ð<ð<ñ„ð<ð~Ôð ð ñÔð ð€�„ð-ð-ñ„ð-ð` Ôð ð ñÔð ð€�„ð ð ñ„ð ðFÔð.ð.ñÔð.ð€�„ð$ð$ñ„ð$ðNÔ ððñ!Ô ðð €�„ððñ„ðð4Ô%ððñ&Ô%ðððr'