mò &ÜGc@sdZdklZlZlZlZlZlZdkl Z l Z l Z l Z l Z dklZdklZdkZdkZdkTdefd„ƒYZd efd „ƒYZeieƒe_ee _d efd „ƒYZeieƒe_d efd„ƒYZdS(sGdefines a set of mapper.MapperProperty objects, including basic column properties as well as relationships. the objects rely upon the LoaderStrategy objects in the strategies.py module to handle load operations. PropertyLoader also relies upon the dependency.py module to handle flush-time dependency sorting and processing.(ssqlsschemasutils exceptionsssql_utilslogging(smapperssyncs strategiess attributess dependency(ssession(sutilN(t*tSynonymPropertycBs/tZed„Zd„Zd„Zd„ZRS(NcCs||_||_dS(N(tnametselftproxy(RRR((t=/home/holguin2/public_html/spyce/sqlalchemy/orm/properties.pyt__init__s cKsdS(N((Rt querycontexttkwargs((RtsetupscCsdS(N((Rt selectcontexttinstancetrowt identitykeytisnew((RtexecutescsKˆipdSndtf‡d†ƒY}tˆiiˆi|ƒƒdS(Nt SynonymPropcs,tZ‡d†Z‡d†Z‡d†ZRS(Ncs*t|ˆi|ƒˆid||ƒdS(N(tsetattrtobjRRtvaluetsettNone(tsRR(R(Rt__set__ scst|ˆiƒdS(N(tdelattrRRR(RR(R(Rt __delete__#scs%|djo|Snt|ˆiƒS(N(RRRtgetattrRR(RRtowner(R(Rt__get__%s (t__name__t __module__RRR((R(RRs  (RRtobjectRRtparenttclass_tkey(RR((RRtdo_inits  (RRtFalseRR RR#(((RRs   tColumnPropertycBs>tZdZd„Zd„Zd„Zd„Zed„ZRS(sAdescribes an object attribute that corresponds to a table column.cOs=t|ƒ|_|iddƒ|_|idtƒ|_dS(sÐthe list of columns describes a single object property. if there are multiple tables joined together for the mapper, this list represents the equivalent column as it appears across each table.tgrouptdeferredN( tlisttcolumnsRRtpopRR&R$R'(RR)R((RR-scCs,|ioti|ƒSnti|ƒSdS(N(RR't strategiestDeferredColumnLoadert ColumnLoader(R((Rtcreate_strategy4s cCst||idƒS(N(RRRR"R(RR((RR9scCst||i|ƒdS(N(RRRR"R(RRR((RR;scCstii||id|ƒS(Ntpassive(t sessionlibtattribute_managert get_historyRRR"R/(RRR/((RR2=s( RRt__doc__RR.RRR$R2(((RR%+s     tPropertyLoadercBs³tZdZeeeeeeeeeeeeeed„Zed„ƒZd„Z d„Z d„Z d„Z d„Z d„Zd „Zd „Zd „Zd „Zd „ZRS(swdescribes an object property that holds a single item or list of items that correspond to a related database table.cCsS||_||_||_||_||_| |_d|_||_ ||_ t i |ƒ|_ ||_||_|dj oti|ƒ|_n0|otidƒ|_ntidƒ|_||_| |_| |_t| tƒoK|dj ot| d|d|ƒ|_qFt| d|d|ƒ|_n | |_| |_dS(Nsall, delete-orphans save-updatet primaryjoint secondaryjoin(tuselistRtargumentt secondaryR5R6t post_updateRt directiontviewonlytlazytutiltto_sett foreignkeytcollection_classtpassive_deletestcascadet mapperutiltCascadeOptionstprivatet associationtorder_byt attributeextt isinstancetbackreftstrtBackReft is_backref(RR8R9R5R6R@R7RFRGRHRIRKRNR:RCR<R=RARB((RRGs4                 cCs |iiS(N(RRCt delete_orphan(R((RtlscCsa|ioti|ƒSnC|itjoti|ƒSn"|idjoti|ƒSndS(N(RR=R+t LazyLoaderR$t EagerLoaderRtNoLoader(R((RR.ns  cCs7|iidt|iƒd|idt|iƒS(Nt s->(Rt __class__RRLR R"tmapper(R((Rt__str__vsc cs@||ijodSn|djp|i}tii||i d|ƒ}|djodSn|i i ƒ}xÉ|iƒ|iƒ|iƒD]§}|dj o”||jo‡t||i iƒp8tid|i t|iiƒt|iƒfƒ‚n|i|ƒ|Vx%|i|||ƒD] }|Vq&Wq‘q‘WdS(NtdeleteR/s@Attribute '%s' on class '%s' doesn't handle objects of type '%s'(ttypeRRCRBR/R0R1R2RR"t childlistRRVtprimary_mappert added_itemst deleted_itemstunchanged_itemstct recursiveRJR!t exceptionstAssertionErrorRLR RUtaddtcascade_iteratortc2( RRYRR`RVR_RZR/Re((RRdys" !8 cCs ||ijodSn|iiƒ}|djp|i}xÅtii ||i d|ƒD]¥}|dj o’||jo…t||iiƒp8tid|i t|iiƒt|iƒfƒ‚n|i|ƒ|||iƒ|i||||ƒq\q\WdS(NRXR/s@Attribute '%s' on class '%s' doesn't handle objects of type '%s'(RYRRCRVR[RBR/R0R1t get_as_listRR"R_RR`RJR!RaRbRLR RURct callable_t entity_nametcascade_callable(RRYRRgR`RVR_R/((RRiŠs8 cCs,t|itƒo |iSn |iiSdS(s[return the target class of the relation, even if the property has not been initialized yet.N(RJRR8RYR!(R((Rt_get_target_class˜s cCs:t|itƒo%ti|idtƒiƒ|_nRt|itiƒo|iiƒ|_n&t i d|i t|iƒfƒ‚|ii ƒiƒ|_|i dj o<t|i tƒo%ti|i dtƒiƒ|_ qín|ii|_|iion|ii|iijo)t i d|i |iiifƒ‚n|iiƒii|i |iifƒn|idj o.|idjot i d|i dƒ‚ny·|idj on|idjo%ti|ii|iƒi|_n|idjo%ti|ii|iƒi|_qkn6|idjo%ti|ii|iƒi|_nWnFt i j o7}t i d|i |i|it!|ƒfƒ‚nXt"|i#ƒ o|idjo|i$ƒn|i%djo|i&ƒ|_%n|i'djo |i%t(i)jo t|_'n|i'djo t*|_'n|i+pt,i-|ƒ|_.n|i/ƒoN|i0dj o|i0i1ƒ|_2n|i0dj o|i0i3|ƒq#nUt4i5i6|ii|i ƒp5t i d|i |iii|iiifƒ‚nt7t8|ƒi9ƒdS(NtcompilesArelation '%s' expects a class or a mapper argument (received: %s)sÊCant establish 'delete-orphan' cascade rule on a self-referential relationship (attribute '%s' on class '%s'). You probably want cascade='all', which includes delete cascading but not orphan detection.s Property 'sC' specified with secondary join condition but no secondary argumentsÆError determining primary and/or secondary join for relationship '%s' between mappers '%s' and '%s'. If the underlying error cannot be corrected, you should specify the 'primaryjoin' (and 'secondaryjoin', if there is an association table present) keyword arguments to the relation() function (or for backrefs, by specifying the backref using the backref() function with keyword arguments) to explicitly specify the join conditions. Nested error is "%s"sºAttempting to assign a new relation '%s' to a non-primary mapper on class '%s'. New relations can only be added to the primary mapper, i.e. the very first mapper created for class '%s' (:RJRR8RYRVt class_mapperR$t_check_compiletMapperRat ArgumentErrorR"tget_select_mapperRGRt mapped_tablettargetRCROR R!RR[tdelete_orphanstappendR6R9tsqltjointunjoined_tabletonclauseR5teRLtlenR@t_find_dependentR;t_get_directionR7tsynct MANYTOONEtTrueR<t dependencytcreate_dependency_processort_dependency_processort is_primaryRKt get_extensionRIRkR0R1tis_class_managedtsuperR4R#(RRy((RR#ŸsX%%) ), %))3!#    5cCs)|ii|ijp|ii|ijS(N(RR RqRrt select_table(R((Rt_is_self_referentialæscCsC|idj o tiSn%|iƒo4x|iD]}|ip ti Sq2q2Wti Snät g}|iD]0}|iii|tƒdj o ||qmqm~ƒo ti Sn‹t g}|iD]0}|iii|tƒdj o ||qÆqÆ~ƒo ti Sn2tid|it|iƒt|iƒfƒ‚dS(sPdetermines our 'direction', i.e. do we represent one to many, many to many, etc.sQCant determine relation direction for '%s' in mapper '%s' with primary join '%s'N(RR6RR}t MANYTOMANYRˆR@tft primary_keyt ONETOMANYR~Rzt_[1]R_RVRwtcorresponding_columnR$R RaRoR"RLR5(RRŠR_R((RR|és     N N cs€tiƒ‰‡d†}ti|ƒ}|ii |ƒt ˆƒdjo)t i d|i t|iƒfƒ‚nˆ|_dS(sÑsearches through the primary join condition to determine which side has the foreign key - from this we return the "foreign key" for this property which helps determine one-to-many/many-to-one.csÌ|idjp.t|itiƒ pt|itiƒ odSnx>|iiD]0}|i |ii ƒoˆi |iƒqSqSWx>|iiD]0}|i |ii ƒoˆi |iƒq”q”WdS(Nt=( tbinarytoperatorRJtlefttschematColumntrightt foreign_keysRŠt referencesttablet foreignkeysRc(RRŠ(R™(Rtfoos>  isOn relation '%s', can't figure out which side is the foreign key for join condition '%s'. Specify the 'foreignkey' argument to the relation.N(R>tSetR™RšRDt BinaryVisitortvisitorRR5taccept_visitorRzRaRoR"RLR@(RRRšR™((R™RR{ýs  )cCs-|idj o|i|i@Sn|iSdS(N(RR6RR5(R((Rtget_joinscCs"|ip|ii|ƒndS(N(RR<R‚tregister_dependenciest uowcommit(RR¡((RR s (RRR3RR$RRtpropertyRFR.RWRdRiRjR#RˆR|R{RŸR (((RR4Ds 3%      G    RMcBs)tZdZd„Zd„Zd„ZRS(sostores the name of a backreference property as well as options to be used on the resulting PropertyLoader.cKs||_||_dS(N(R"RR(RR"R((RR s c Cs’|iiƒ}|ii|iƒp}|iiddƒ}|iiddƒ}|i iƒ}t ||i||d|idt|i}|i|i|ƒnít|i|it ƒp&tid|it|ƒfƒ‚n­|i iƒ}|i|i|iiƒj oBtid|it|iƒt|i|iiiƒfƒ‚n|i|iip't|_|ipt|i_qŽndS(secalled by the owning PropertyLoader to set up a backreference on the PropertyLoader's mapper.R5R6RKRNs]Cant create backref '%s' on mapper '%s'; an incompatible property of that name already existssjBackrefs do not match: backref '%s' expects to connect to %s, but found a backref already connected to %sN(tpropRVR[tpropsthas_keyRR"RR*RtpjtsjR R4R9Rtrelationt_compile_propertyRJRaRoRLR!RjRNR<R‚(RR£RVR R§R¨R¦((RRk#s"-& B  cCsti|iƒS(s>returns an attribute extension to use with this backreference.N(t attributestGenericBackrefExtensionRR"(R((RR„:s(RRR3RRkR„(((RRMs   (R3t sqlalchemyRuR“R>Ratsql_utiltloggingtsqlalchemy.ormRVR}R+RªR€tsessionR0RDtsetstrandomtsqlalchemy.orm.interfacestMapperPropertyRtStrategizedPropertyR%t class_loggertloggerR4RRM(R“R²R}RRDR+R>RuRVR0R®R%R€R±RaRªRMR4R­((Rt? s+%   ×