U kf|@sUdZddlmZddlmZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl m#Z#ddl m$Z$ddl m%Z%ddlm&Z&ddlm'Z'd d!lm(Z(d d"lm)Z*d d#lm+Z+d d$lm,Z,d dlmZd d%l,m-Z-d d&l,m.Z.d d'l/m0Z0d d(l1m2Z2d d)l1m3Z3d d*l1m4Z4ejr*dd+l5m6Z6dd,l5m7Z7dd-lm8Z8dd.lm9Z9dd/lm:Z:dd0l;mZ>dd2l?m@Z@dd3lAmBZBdd4lAmCZCdd5lDmEZEd d6lFmGZGd d7lHmIZId d8lJmKZKd d9lJmLZLd d:l/mMZMd d;l/mNZNd dlSmTZTd d?l1mUZUd d@l1mVZVd dAl1mWZWd dBl1mXZXedCe dDZYedEe dDZZGdFdGdGe$eYZ[ee\dHdIdJdKfZ]edLe dDZ^e_Z`dMeadN<GdOdPdPe#e^e"e[e^ZbGdQdRdRebeYeeYZcGdSdTdTe[eYZdGdUdVdVe[eYZeGdWdXdXeeeYeeYZfdS)YzDescriptor properties are more "auxiliary" properties that exist as configurational elements, but don't participate as actively in the load/persist ORM loop. ) annotations) is_dataclassN)Any)Callable)Dict)List)NoReturn)Optional)Sequence)Tuple)Type) TYPE_CHECKING)TypeVar)Union) attributes)util)_DeclarativeMapped)LoaderCallableStatus)Mapped) PassiveFlag)SQLORMOperations)_AttributeOptions)_IntrospectsAnnotations) _MapsColumns)MapperProperty)PropComparator) _none_set)de_stringify_annotation)event)exc)schema)sql expression) operators) BindParameter) is_fwd_ref) is_pep593)typing_get_args) _InstanceDict) _RegistryType)History)InstrumentedAttribute)QueryableAttribute)ORMCompileState)_ClassScanMapperConfig)Mapper)ColumnProperty MappedColumn) InstanceState) Connection)Row)_DMLColumnArgument) _InfoType) ClauseList) ColumnElement) OperatorType)Column)Select)_AnnotationScanType)CallableReference)DescriptorReference)RODescriptorReference_T)bound_PTc@sXeZdZUdZdZded<dZdZded<ej fdd d d d d dZ dddddZ dS)DescriptorPropertyzO:class:`.MapperProperty` which proxies access to a user-defined descriptor.N Optional[str]docFzDescriptorReference[Any] descriptorInstanceState[Any]r+rr-statedict_passivereturncCs tdSN)NotImplementedErrorselfrMrNrOrUO/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/orm/descriptor_props.py get_historyeszDescriptorProperty.get_history Mapper[Any]NonemapperrPcsGfdddtj}jdkrHtjjd}j|rH|_jdkrddddfdd }dddfd d }dddfd d }t|||d _tjj jjjfddj d}|j|_ j j|dS)NcsZeZdZdZdZdZeddfdd Zddd d Ze j fd d d ddfdd Z dS)z7DescriptorProperty.instrument_class.._ProxyImplFTboolrPcsjSrQ) uses_objectsrTproprUrVr^uszDDescriptorProperty.instrument_class.._ProxyImpl.uses_objectsstrkeycSs ||_dSrQrc)rTrdrUrUrV__init__ysz@DescriptorProperty.instrument_class.._ProxyImpl.__init__rKr+rr-rLcs|||SrQ)rWrSr`rUrVrW|szCDescriptorProperty.instrument_class.._ProxyImpl.get_historyN) __name__ __module__ __qualname__Zaccepts_scalar_loaderZload_on_unexpireZ collectionpropertyr^rer PASSIVE_OFFrWrUr`rUrV _ProxyImplpsrkrrY)objvaluerPcst|j|dSrQ)setattrname)rlrmr_rUrVfsetsz1DescriptorProperty.instrument_class..fset)rlrPcst|jdSrQ)delattrrorlr_rUrVfdelsz1DescriptorProperty.instrument_class..fdelcs t|jSrQ)getattrrorrr_rUrVfgetsz1DescriptorProperty.instrument_class..fget)rurprscs SrQ)_comparator_factoryrU)r[rTrUrVz5DescriptorProperty.instrument_class..)rIZoriginal_property)rZ AttributeImplrJrtclass_rdZ_is_userland_descriptorriZcreate_proxied_attributeparentrIimpl class_managerZinstrument_attribute)rTr[rkdescrprsru proxy_attrrU)r[rarTrVinstrument_classms*     z#DescriptorProperty.instrument_class) rfrgrh__doc__rI__annotations__r^Z_links_to_entityrrjrWrrUrUrUrVrGZs  rGz Column[_T]zMappedColumn[_T]zInstrumentedAttribute[_T]z Mapped[_T]_CCzFweakref.WeakKeyDictionary[Type[Any], Callable[[Any], Tuple[Any, ...]]]_composite_gettersc s0eZdZUdZded<ded<ded<ded <dad d d d d d d d ddddddddd fddZdddfdd Zdddd d!Zdd"d#d$Ze Z dd"d%d&Z e d'd(d)d*dd+d,d-d-ddd. d/d0Zdd"d1d2Ze d'e d3d)d*dd+dd4d5d6Ze jd7d"d8d9Ze je d:d;d"dd"d?d@ZedAd"dBdCZedDd"dEdFZe d:dd"dGdHZdd"dIdJZe jdKd"dLdMZdNd"dOdPZejfdQdRdSdTdUdVdWZddXddYdZZ Gd[d\d\e!j"e#Z$Gd]d^d^e%e&Z'd+d"d_d`Z(Z)S)bCompositePropertyzDefines a "composite" mapped attribute, representing a collection of columns as one attribute. :class:`.CompositeProperty` is constructed using the :func:`.composite` function. .. seealso:: :ref:`mapper_composite` z$Union[Type[_CC], Callable[..., _CC]]composite_classz#Tuple[_CompositeAttrType[Any], ...]attrsz=CallableReference[Optional[Callable[[_CC], Tuple[Any, ...]]]]_generated_composite_accessorzType[Comparator[_CC]]comparator_factoryNF)attribute_optionsactive_historydeferredgrouprinfozCUnion[None, Type[_CC], Callable[..., _CC], _CompositeAttrType[Any]]z_CompositeAttrType[Any]Optional[_AttributeOptions]r\rHzOptional[Type[Comparator[_CC]]]Optional[_InfoType]r) _class_or_attrrrrrrrrkwargsc stj|dt|tttjfr4|f||_d|_n ||_||_||_ ||_ ||_ |dk r^|n|j j |_d|_|dk r|j|t|||dSN)r)superre isinstancerrbr#r<rrrrr __class__ Comparatorrrrupdaterset_creation_order_create_descriptor_init_accessor) rTrrrrrrrrrrrUrVres&   zCompositeProperty.__init__rXrYrZcst||dSrQ)rr_setup_event_handlersrTr[rrUrVrs z"CompositeProperty.instrument_classrzTuple[Any, ...]rmrPc Cs`|jr||Sz |j}Wn:tk rT}ztd|jjd|W5d}~XYnX|SdS)NzComposite class zX is not a dataclass and does not define a __composite_values__() method; can't get state)r__composite_values__AttributeErrorsa_excInvalidRequestErrorrrf)rTrmaccessorZaerUrUrV_composite_values_from_instances  z1CompositeProperty._composite_values_from_instancer]cCs |dS)zwInitialization which occurs after the :class:`.Composite` has been associated with its parent mapper. N)_setup_arguments_on_columnsr_rUrUrVdo_initszCompositeProperty.do_initcsTdddfdd ddddfdd }dddfd d }t||_d S) ztCreate the Python descriptor that will serve as the access point on instances of the mapped class. r)instancerPcst}t}j|krxfddjD}j|krx|jdk sPt|sxj||j<|jj |j jg| jdS)Ncsg|]}t|qSrU)rt.0rdrrUrV szFCompositeProperty._create_descriptor..fget..) r instance_dictinstance_staterd_attribute_keysr issupersetrmanagerdispatchrefresh_COMPOSITE_FGETget)rrNrMvaluesr_rrVrus$     z2CompositeProperty._create_descriptor..fgetrY)rrmrPcst|}t|}|jj}|jjr2|}n|jtj }|jj D]}|||||j }qJ||j<|dkrj D]}t ||dqxn(tj |D]\}}t |||qdSrQ)rrrrrdr_active_historyrrNO_VALUEsetr{rrnzipr)rrmrNrMattrpreviousfnrdrurTrUrVrp0s"        z2CompositeProperty._create_descriptor..fsetcst|}t|}|jj}|jjr@|}|jdn|jtj }|jj}|j |||j j D]}t ||dqtdSrQ)rrrrrdrrpoprrremover{rrn)rrMrNrrrdrrUrVrsGs     z2CompositeProperty._create_descriptor..fdelN)rirJ)rTrprsrUrrVrsz$CompositeProperty._create_descriptorsqlalchemy.orm.propertiesr1r,z Type[Any]rbzOptional[Type[Mapped[Any]]]zOptional[_AnnotationScanType]) decl_scanregistryclsoriginating_modulerdmapped_container annotationextracted_mapped_annotationis_dataclass_fieldrPc Cs tjjj} |jdkr(|dkr(||||} t| r@t| d} | r|jdkrt| t sdt | ddr|dkrt | dr|| j nt | } t d| d| dt|| |dd} | |_t|jr|||||n0|jD](} t| | tjfr| jdkrt d q|dS) NrT)Z check_generic__forward_arg__zCan't use forward ref z9 for composite class argument; set up the type as Mapped[])Zinclude_genericzIComposite class column arguments must be named unless a dataclass is used)r preloadedorm_propertiesr5rZ_raise_for_requiredr)r*rrbr(hasattrrr ArgumentErrorrr_setup_for_dataclassrr"r>ror)rTrrrrrdrrrrr5argumentZstr_argrrUrUrVdeclarative_scanYsP      z"CompositeProperty.declarative_scancst|jr`t|jds`t|j}tjdd|jDt |jdkrZfdd|_ n|_ |jdk rt |jt r|jt kr|j dk r|j t |j<nt|jdrddt |j<dS)NrcSsg|] }|jqSrU)ro)rprUrUrVrsz4CompositeProperty._init_accessor..rcs |fSrQrUrrgetterrUrVrwrxz2CompositeProperty._init_accessor..cSs|SrQrrrrUrUrVrwrx)rrrinspect signatureoperator attrgetter parametersrlenrrtyper)rTinsprUrrVrs.      z CompositeProperty._init_accessorzsqlalchemy.orm.decl_base)rrrrdrPc Cstjjj}tjj}t|j}t |j |j D]\}} |dkrnt dt|j d|jjdt|j | dkr|} |j | f7_ t| |r| |||||j|jq2t| tjr2||j| q2dS)Nznumber of composite attributes z3 exceeds that of the number of attributes in class  )rrrr5Z orm_decl_baserrr itertools zip_longestrrrrrrrfrZdeclarative_scan_for_compositerorr"r>Z_undefer_column_name) rTrrrrdr5 decl_baserparamrrUrUrVrs2   $  z&CompositeProperty._setup_for_dataclass!Sequence[QueryableAttribute[Any]]csfddjDS)Ncsg|]}tjj|jqSrU)rtrzryrdrrar_rUrVrsz:CompositeProperty._comparable_elements..propsr_rUr_rV_comparable_elementssz&CompositeProperty._comparable_elementszorm.propertieszSequence[MapperProperty[Any]]cCsg}tjjj}|jD]}t|tr4|jj|dd}nLt|t j rN|jj |}n2t||rh|jj |j }nt|t jr||j}nd}t|tstd|||q|S)NF)Z_configure_mapperszYComposite expects Column objects or mapped attributes/attribute names as arguments, got: )rrrr5rrrbrzZ get_propertyr"r>_columntopropertycolumnrr.rirrrappend)rTrr5rrarUrUrVrs$        zCompositeProperty.propszSequence[Column[Any]]cstjjjfdd|jDS)Ncs0g|](}t|tjfrt|r(|jn|qSrU)rr"r>r)rar4rUrVrsz-CompositeProperty.columns..)rrrr5rr_rUr4rVcolumnss  zCompositeProperty.columnszOptional[MapperProperty[_CC]]cCs|SrQrUr_rUrUrVmapper_property_to_assignsz+CompositeProperty.mapper_property_to_assignz$List[Tuple[schema.Column[Any], int]]cCsdd|jDS)NcSsg|]}|jdkr|dfqS)Nr)table)rcrUrUrVrs z7CompositeProperty.columns_to_assign..)rr_rUrUrVcolumns_to_assignsz#CompositeProperty.columns_to_assigncCsPtjjj}|jD]:}t||s"qn|}|j|_|jrB|j|_d|_|j |_ qdS)zwPropagate configuration arguments made on this composite to the target columns, for those that apply. ))rT)Z instrumentTN) rrrr3rrrrZ strategy_keyr)rTr3raZcproprUrUrVrs   z-CompositeProperty._setup_arguments_on_columnscs ddddfdd }dddddfd d }dddd dd fd d ddddfdd }dddddfdd }tjjd|ddtjjd|ddtjjd|dddtjjd|dddtjjd|dddjjj}|j|j_j|jj_dS) z>Establish events that populate/expire the composite attribute.rKr0rY)rMcontextrPcs||ddddS)NF is_refreshrU)rMr)_load_refresh_handlerrUrV load_handlersz=CompositeProperty._setup_event_handlers..load_handlerzOptional[Sequence[str]])rMrto_loadrPcs.|rjhj|r*|||dddS)NTr)rdunionr intersection)rMrrrrTrUrVrefresh_handler$s z@CompositeProperty._setup_event_handlers..refresh_handlerr\)rMrrrrPcs`j}|r|jkr"j|kr"dSjD]}||kr(dSq(jfddjD|j<dS)Ncsg|]}j|qSrU)dictrrMrUrVrNszZCompositeProperty._setup_event_handlers.._load_refresh_handler..)rrrdrr)rMrrrrNkr_rrVr0s  zFCompositeProperty._setup_event_handlers.._load_refresh_handler)rMkeysrPcs,|dkstj|r(|jjddSrQ)rrrrrrd)rMrr_rUrVexpire_handlerQsz?CompositeProperty._setup_event_handlers..expire_handlerrXr7)r[ connectionrMrPcs|jjddS)zAfter an insert or update, some columns may be expired due to server side defaults, or re-populated due to client side defaults. Pop out the composite value here so that it recreates. N)rrrd)r[rrMr_rUrVinsert_update_handlerWs zFCompositeProperty._setup_event_handlers..insert_update_handlerZ after_insertT)rawZ after_updateload)r propagaterZexpireN) r listenrzr|rdrr{rr)rTrrrrr~rUrrVrsR ! z'CompositeProperty._setup_event_handlers Sequence[str]cCsdd|jDS)NcSsg|] }|jqSrUrcrrUrUrVr}sz5CompositeProperty._attribute_keys..rr_rUrUrVr{sz!CompositeProperty._attribute_keysz Callable[[Dict[str, Any]], None]csJjrjndddddddjDdd d fd d }|S) Nrz Tuple[Any])valrPcSs|SrQr)rrUrUrV get_valuesszOCompositeProperty._populate_composite_bulk_save_mappings_fn..get_valuescSsg|] }|jqSrUrcrrUrUrVrszOCompositeProperty._populate_composite_bulk_save_mappings_fn..zDict[str, Any]rY) dest_dictrPc s*|ddt|jDdS)NcSsi|]\}}||qSrUrU)rrdrrUrUrV szaCompositeProperty._populate_composite_bulk_save_mappings_fn..populate..)rrrrd)r rrrTrUrVpopulateszMCompositeProperty._populate_composite_bulk_save_mappings_fn..populate)rr)rTr rUr rV)_populate_composite_bulk_save_mappings_fns  z;CompositeProperty._populate_composite_bulk_save_mappings_fnrKr+rr-rLc Csg}g}d}|jD]j}|j}|j|j||} | rProvided for userland code that uses attributes.get_history().FTNrU) rrdrr{rWZ has_changes non_deletedextendrdeletedrr-r) rTrMrNrOaddedrZ has_historyrardhistrrUrUrVrWs,      zCompositeProperty.get_historyzComposite.Comparator[_CC]cCs |||SrQ)rrrUrUrVrvsz%CompositeProperty._comparator_factorycs8eZdZdddfdd Zdddd d d d ZZS) z!CompositeProperty.CompositeBundlez Composite[_T]r;) property_exprcs||_tj|jf|dSrQ)rirrerd)rTrrrrUrVresz*CompositeProperty.CompositeBundle.__init__z Select[Any]z#Sequence[Callable[[Row[Any]], Any]]rzCallable[[Row[Any]], Any])queryprocslabelsrPcsdddfdd }|S)NzRow[Any]r)rowrPcsjjfddDS)Ncsg|] }|qSrUrU)rprocrrUrVrszXCompositeProperty.CompositeBundle.create_row_processor..proc..)rirrrrTrrVrszDCompositeProperty.CompositeBundle.create_row_processor..procrU)rTrrrrrUrrVcreate_row_processorsz6CompositeProperty.CompositeBundle.create_row_processor)rfrgrhrer __classcell__rUrUrrVCompositeBundlesrc@seZdZUdZdZded<ejddddZd dd d Z ejd dd d Z dddddZ ejddddZ dddddZ dddddZdddddZdddddZdddd d!Zdddd"d#Zd$ddd%d&d'ZdS)(zCompositeProperty.ComparatoraProduce boolean, comparison, and other operators for :class:`.Composite` attributes. See the example in :ref:`composite_operations` for an overview of usage , as well as the documentation for :class:`.PropComparator`. .. seealso:: :class:`.PropComparator` :class:`.ColumnOperators` :ref:`types_operators` :attr:`.TypeEngine.comparator_factory` Nz%RODescriptorReference[Composite[_PT]]rar;r]cCstj|jddiS)NrF)r%r;rr_rUrUrVclausess z$CompositeProperty.Comparator.clausesz&CompositeProperty.CompositeBundle[_PT]cCs|jSrQr$r_rUrUrV__clause_element__sz/CompositeProperty.Comparator.__clause_element__cCs*|j|j|j|jjd}t|j|S)N)Z parententityZ parentmapper proxy_key)rZ _annotateZ _parententityrardrr)rTrrUrUrVr%sz'CompositeProperty.Comparator.expressionrz(Sequence[Tuple[_DMLColumnArgument, Any]]rcCszt|tr|j}|dkr,dd|jjD}n>t|jjtrVt||jjrV|j|}nt d|j|ft t |j |S)NcSsg|]}dqSrQrUrrUrUrVr szDCompositeProperty.Comparator._bulk_update_tuples..z)Can't UPDATE composite attribute %s to %r) rr'rmrarrrrrrlistrr)rTrmrrUrUrV_bulk_update_tupless" z0CompositeProperty.Comparator._bulk_update_tuplesrcs(jrfddjjDSjjSdS)Ncsg|]}tjj|jqSrU)rt_adapt_to_entityentityrdrr_rUrVrszECompositeProperty.Comparator._comparable_elements..)r$rarr_rUr_rVrs  z1CompositeProperty.Comparator._comparable_elementszColumnElement[bool])otherrPcCs|tj|SrQ)_comparer&eqrTr&rUrUrV__eq__%sz#CompositeProperty.Comparator.__eq__cCs|tj|SrQ)r'r&ner)rUrUrV__ne__(sz#CompositeProperty.Comparator.__ne__cCs|tj|SrQ)r'r&ltr)rUrUrV__lt__+sz#CompositeProperty.Comparator.__lt__cCs|tj|SrQ)r'r&gtr)rUrUrV__gt__.sz#CompositeProperty.Comparator.__gt__cCs|tj|SrQ)r'r&ler)rUrUrV__le__1sz#CompositeProperty.Comparator.__le__cCs|tj|SrQ)r'r&ger)rUrUrV__ge__4sz#CompositeProperty.Comparator.__ge__r=)rr&rPcst|dkrdgtjj}n j|}fddtjj|D}jrjjdk sXtfdd|D}tj |S)Ncsg|]\}}||qSrUrU)rrb)rrUrVrFsz9CompositeProperty.Comparator._compare..csg|]}|qSrU)adapter)rxr_rUrVrLs) rrarrrr$r6AssertionErrorr#and_)rTrr&rZ comparisonsrU)rrTrVr'>s   z%CompositeProperty.Comparator._compare)rfrgrhr__hash__rrmemoized_propertyrr r%r#rr*r,r.r0r2r4r'rUrUrUrVrs$    rcCst|jjjd|jS)N.)rbrzryrfrdr_rUrUrV__str__OszCompositeProperty.__str__)N)*rfrgrhrrrerrrobjectrrrpreload_modulerrrr;rrZnon_memoized_propertyrrirrrrrr rrjrWrvorm_utilZBundlerDrrrFrr=rrUrUrrVrsb  &(J"9'_%xrc@seZdZdZdZdS) CompositeaSDeclarative-compatible front-end for the :class:`.CompositeProperty` class. Public constructor is the :func:`_orm.composite` function. .. versionchanged:: 2.0 Added :class:`_orm.Composite` as a Declarative compatible subclass of :class:`_orm.CompositeProperty`. .. seealso:: :ref:`mapper_composite` TNrfrgrhrZ inherit_cacherUrUrUrVrASsrAcs6eZdZdZdddddZddfd d ZZS) ConcreteInheritedPropertya4A 'do nothing' :class:`.MapperProperty` that disables an attribute on a concrete subclass that is only present on the inherited mapper, not the concrete classes' mapper. Cases where this occurs include: * When the superclass mapper is mapped against a "polymorphic union", which includes all attributes from all subclasses. * When a relationship() is configured on an inherited mapper, but not on the subclass mapper. Concrete mappers require that relationship() is configured explicitly on each subclass. rXzType[PropComparator[_T]]rZcCsPd}|jD]*}|j|j}t|dddk r|j}q:q|dk sFt|||S)Nr)rzZiterate_to_rootZ_propsrdrtrr8)rTr[Zcomparator_callablemrrUrUrVrvws  z-ConcreteInheritedProperty._comparator_factoryrYr]cs<tddfdd Gfddd}|_dS)Nrr]cstdjjjfdS)NzgConcrete %s does not implement attribute %r at the instance level. Add this property explicitly to %s.)rrzrdrUr_rUrVwarns z0ConcreteInheritedProperty.__init__..warncsTeZdZdddddfdd Zddddfdd Zddddd fd d Zd S) zDConcreteInheritedProperty.__init__..NoninheritedConcreteProprr)srlrmrPcs dSrQrU)rFrlrmrErUrV__set__szLConcreteInheritedProperty.__init__..NoninheritedConcreteProp.__set__)rFrlrPcs dSrQrU)rFrlrGrUrV __delete__szOConcreteInheritedProperty.__init__..NoninheritedConcreteProp.__delete__)rFrlownerrPcs|dkrjSdSrQ)rJ)rFrlrJrTrErUrV__get__szLConcreteInheritedProperty.__init__..NoninheritedConcreteProp.__get__N)rfrgrhrHrIrLrUrKrUrVNoninheritedConcretePropsrM)rrerJ)rTrMrrKrVres  z"ConcreteInheritedProperty.__init__)rfrgrhrrvrerrUrUrrVrCfs rCc seZdZUdZded<d&dddddd d d fd d ZesLeddddZe j ddddZ dddddZ e jfddddddd Ze d!ddd"d#d$d%ZZS)'SynonymPropertya8Denote an attribute name as a synonym to a mapped property, in that the attribute will mirror the value and expression behavior of another attribute. :class:`.Synonym` is constructed using the :func:`_orm.synonym` function. .. seealso:: :ref:`synonyms` - Overview of synonyms z"Optional[Type[PropComparator[_T]]]rNrbzOptional[bool]z Optional[Any]rrrH)ro map_columnrJrrrrIcsjtj|d||_||_||_||_|r2||_n|rF|jrF|j|_nd|_|r\|j |t |dSr) rrerorOrJrrIrrrrr)rTrorOrJrrrrIrrUrVres    zSynonymProperty.__init__r\r]cCst|jj|jjjSrQ)rtrzryror{r^r_rUrUrVr^szSynonymProperty.uses_objectsz/Union[MapperProperty[_T], SQLORMOperations[_T]]cCsht|jj|j}t|dr&t|jtsbt|tj r8|j St|t rF|St d|jjj|j|f|jS)NrizGsynonym() attribute "%s.%s" only supports ORM mapped attributes, got %r)rtrzryrorrrirrr/Z comparatorrrrrf)rTrrUrUrV_proxied_objects   zSynonymProperty._proxied_objectrXzSQLORMOperations[_T]rZcCs<|j}t|tr4|jr$|||}n |||}|S|SdSrQ)rPrrr)rTr[racomprUrUrVrvs  z#SynonymProperty._comparator_factoryrKr+rr-rLcCs"t|jj|j}|jj|||dS)N)rO)rtrzryror{rW)rTrMrNrOrrUrUrVrWszSynonymProperty.get_historyrrY)rzinitrPcCstjj}|jr|j|jjkr:td|j |jj |jfnN|jj|j|j kr|j |jj|jj|j krtd|j|j |j |jf| |jj|j}|j |j ||dd|j|_||_dS)Nz>Can't compile synonym '%s': no column on table '%s' named '%s'zpCan't call map_column=True for synonym %r=%r, a ColumnProperty already exists keyed to the name %r for column %rT)rRZ setparent)rrrrOrdZpersist_selectablerrrro descriptionrr3Z_configure_propertyZ_mapped_by_synonymrz)rTrzrR propertiesrrUrUrV set_parents@   zSynonymProperty.set_parent)NNNNNN)rfrgrhrrrer rir^rr;rPrvrrjrWr?rUrrUrUrrVrNs&    rNc@seZdZdZdZdS)SynonymaKDeclarative front-end for the :class:`.SynonymProperty` class. Public constructor is the :func:`_orm.synonym` function. .. versionchanged:: 2.0 Added :class:`_orm.Synonym` as a Declarative compatible subclass for :class:`_orm.SynonymProperty` .. seealso:: :ref:`synonyms` - Overview of synonyms TNrBrUrUrUrVrV%s rV)gr __future__r dataclassesrrrrtypingrrrrrr r r r r rrweakrefrrr@baserrrrrZ interfacesrrrrrrrr r!rr"r#r%r&Z sql.elementsr'Z util.typingr(r)r*Z_typingr+r,r-r.r/rr0rr1r[r2rTr3r5rMr6Z engine.baser7Z engine.rowr8Z sql._typingr9r:r;r<Z sql.operatorsr=Z sql.schemar>Zsql.selectabler?r@rArBrCrDrFrGrbZ_CompositeAttrTyperWeakKeyDictionaryrrrrArCrNrVrUrUrUrVs                                                                 H   %8