gJ|dZddlmZddlZddlZddlZddlZddlmZddl Z ddl m Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd l mZddl mZddl mZddl mZddl mZddl mZddl mZddlZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddl&m'Z'ddl&m(Z(d d!lm)Z)d d"lm*Z*d d#lm+Z+d d$lm,Z,d d%l-m.Z.d d&l-m/Z/d d'l-m0Z0d d(l-m1Z1d d$l-m,Z2d d)l3m4Z4d d*l5m6Z6d d+l7m8Z8d d,l7m9Z9d d-l7m:Z:d d.l;mZ>d d0l=m?Z?e j.rdd1l@mAZAdd2lmBZBdd3lmCZCdd4lmDZDdd5lmEZEdd6lmFZFdd7lmGZGdd8lmHZHdd9lmIZIdd:lmJZJdd;lmKZKddlOmPZPd d?l)mQZQd d@l+mRZRd dAl+mSZSd dBl-mTZTd dCl7mUZUd dDl7mVZVd dEl7mWZWd dFlXmYZYd dGlXmZZZd dHl;m[Z[d dIl\m]Z]d dJl^m_Z_d dKl^m`Z`d dLl^maZaejdMejejzZeefe!\ZgZhZiZjZkGdNdOe#ZlGdPdQelZmGdRdSe%Znenel_oy)TaDefault implementations of per-dialect sqlalchemy.engine classes. These are semi-private implementation classes which are only of importance to database dialect authors; dialects will usually use the classes here as the base class for their own corresponding classes. ) annotationsN) perf_counter)Any)Callable)cast)Dict)List)Mapping)MutableMapping)MutableSequence)Optional)Sequence)Set)Tuple)Type) TYPE_CHECKING)Union)characteristics)cursor) interfaces) Connection) CacheStats) DBAPICursor)Dialect) ExecuteStyle)ExecutionContext) ObjectKind) ObjectScope)event)exc)pool)util)compiler)dml) expression)type_api) is_tuple_type)_NoArg) DDLCompiler)InsertmanyvaluesSentinelOpts) SQLCompiler) quoted_name)Final)Literal) ModuleType)Engine)ResultFetchStrategy)_CoreMultiExecuteParams)_CoreSingleExecuteParams)_DBAPICursorDescription)_DBAPIMultiExecuteParams)_ExecuteOptions)_MutableCoreSingleExecuteParams) _ParamStyle)DBAPIConnection)IsolationLevel)Row)URL)_ListenerFnType)Pool)PoolProxiedConnection) Executable)Compiled)Linting)ResultColumnsEntry)DMLState) UpdateBase) BindParameter)Column)_BindProcessorType)_ResultProcessorType) TypeEnginez \s*SELECTc .eZdZUdZej ZejZejZ ejZ dZ dZdZdZdZdZej(j*ZdZded<dZded<dZeZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2e3jhe5jle5jnd Z8e3jhe3jre3jtd e3jtd e3jre3jre3jre3jvd ZdZ?dZ@ded<dZAded<dZBded<dZCded<dZDdZEiZFded<dZGdZH dZI dZJ dZK dZLdZMded<dZNded<eOjZQded<dZRd ed!<d"ZSdZTdZUdZVdZWdZXdZYded#<dZZdZ[dZ\d$Z]e3jd%d&'ddddddde_jdeaejdf dhd(Zcede3jd)d*d+Zfe3jd,Zhe3jd-ZidZjdZke3jdid.Zle3jd/Zmd0Zne3jd1Zoe3jd2Zpedd3Zqedd4Zresdjd5Ztdjd6Zuesd7Zvdkd8Zwd9Zxd:Zyd;Zzd<Z{d=Z|dld>Z} dmd?Z~d@ZdAZdBZ dndCZ dodDZdEZdFZdGZdHZdIZdJZdKZe3jdLZdpdMZdpdNZdOZdPZdQZdRZdSZdldTZdldUZdldVZdWZe3j.dXZdYZdZZd[Zd\Zd]Zd^Zd_Zd`ZdaZdbZdcZddZdeZdfZdgZy)qDefaultDialectz!Default implementation of DialectTFNzOptional[Set[Any]]include_set_input_sizesexclude_set_input_sizesr)isolation_level logging_tokendebug) pool_timeoutecho echo_pool pool_recycle pool_size max_overflowfutureMapping[str, Any]engine_config_typesdefaulti' Optional[int]#_user_defined_max_identifier_lengthz Optional[str]rQmax_index_name_lengthmax_constraint_name_lengthz :: ))4&!EE zzrcN|jtjjuSr)r}rr{ RENDER_CASTSrs r_bind_typing_render_castsz(DefaultDialect._bind_typing_render_castss:#8#8#E#EEErcvt|ts)tjdtdt |dy)Nz7The argument passed to Dialect.has_table() should be a z, got z. Additionally, the Dialect.has_table() method is for internal dialect use only; please use ``inspect(some_engine).has_table(>)`` for public API use.) isinstancerr"rxtype)rargs r_ensure_has_table_connectionz+DefaultDialect._ensure_has_table_connections5#z*##*4T#Y @ +rc|jjjdd}|2tjd|j d|j ddt|S)Nsupports_statement_cacher:a will not make use of SQL compilation caching as it does not set the 'supports_statement_cache' attribute to ``True``. This can have significant performance implications including some performance degradations in comparison to prior SQLAlchemy versions. Dialect maintainers should seek to set this attribute to True after appropriate development and testing for SQLAlchemy 1.4 caching support. Alternatively, this attribute may be set to False which will disable this warning.cprf)code) __class____dict__getr$warnnamedriverre)rsscs r_supports_statement_cachez(DefaultDialect._supports_statement_cachesUnn%%))*DdK ; II#ii 6 Cyrc*tjSr)weakrefWeakKeyDictionaryrs r _type_memoszDefaultDialect._type_memoss((**rc:|jdz|jzS)N+)rrrs rdialect_descriptionz"DefaultDialect.dialect_descriptionsyy3,,rc|jS)zTrue if this dialect supports sane rowcount even if RETURNING is in use. For dialects that don't support RETURNING, this is synonymous with ``supports_sane_rowcount``. )supports_sane_rowcountrs r supports_sane_rowcount_returningz/DefaultDialect.supports_sane_rowcount_returnings***rc8t|dtjS)N poolclass)ryr# QueuePool)clsurls rget_pool_classzDefaultDialect.get_pool_classssK88rc$|j|Sr)r)rrs rget_dialect_pool_classz%DefaultDialect.get_dialect_pool_classs""3''rcdj|jjddd} t|dzy#t$rYywxYw)N.rz .provision)join __module__split __import__ ImportError)rpackages rload_provisioningz DefaultDialect.load_provisioningsJ((3>>//4Qr:;  w- .   s> A  A c,jfd}|Sy)Nc>j|jyr)_assert_and_set_isolation_levelr) dbapi_connconn_recrs rbuiltin_connectz:DefaultDialect._builtin_onconnect..builtin_connects44 @ @r)r)rrs` r_builtin_onconnectz!DefaultDialect._builtin_onconnects  + + 7  # "rc. |j||_ |j||_ |j |j j|_|js|j|}|r||_ |jrH|j|jkDr.tjd|j|jfzyy#t$r d|_YwxYw#t$r d|_YwxYw#t$r d|_YwxYw)NzQLabel length of %d is greater than this dialect's maximum identifier length of %d)_get_server_version_infoserver_version_infoNotImplementedError_get_default_schema_namerkget_default_isolation_level connectiondbapi_connectiondefault_isolation_levelr__check_max_identifier_lengthrrr"rx)rrmax_ident_lengths r initializezDefaultDialect.initializes* ,'+'D'D(D $  ,'+'D'D(D $  0+/+K+K%%66,D ( 77#@@L -=*   !!D$>$>>##3$$d&@&@AB ? -# ,'+D $ , # ,'+D $ ,# 0+/D ( 0s3CC+*DC('C(+C>=C>DDcyrrs r on_connectzDefaultDialect.on_connect*srcy)zPerform a connection / server version specific check to determine the max_identifier_length. If the dialect's class level max_identifier_length should be used, can return None. .. versionadded:: 1.3.9 Nrrrs rrz+DefaultDialect._check_max_identifier_length.src$|j|S)aGiven a DBAPI connection, return its isolation level, or a default isolation level if one cannot be retrieved. May be overridden by subclasses in order to provide a "fallback" isolation level for databases that cannot reliably retrieve the actual isolation level. By default, calls the :meth:`_engine.Interfaces.get_isolation_level` method, propagating any exceptions raised. .. versionadded:: 1.3.22 )get_isolation_levelrrs rrz*DefaultDialect.get_default_isolation_level:s'' 33rcBtj||jS)a)Provide a database-specific :class:`.TypeEngine` object, given the generic object which comes from the types module. This method looks for a dictionary called ``colspecs`` as a class or instance-level variable, and passes on to :func:`_types.adapt_type`. )r( adapt_typerb)rtypeobjs rtype_descriptorzDefaultDialect.type_descriptorJs""7DMM::rc ||j||fd|i|sy|j||fd|i|D] }|d|k(s yy)NschemaFrT) has_table get_indexes)rr table_name index_namerkwidxs r has_indexzDefaultDialect.has_indexUsat~~j*JVJrJ#4##   +1 57 C6{j(  rc ,||j|fi|vSr)get_schema_names)rr schema_namers r has_schemazDefaultDialect.has_schema`s"3d33JE"EEErc|t||jkDr$tjd||jfzy)Nz7Identifier '%s' exceeds maximum length of %d characters)lenrr"IdentifierError)ridents rvalidate_identifierz"DefaultDialect.validate_identifieresB u:22 2%%I$4456  3rc:|jj|i|Sr)rconnect)rcargscparamss rr zDefaultDialect.connectls (t  ((%;7;;rc`|j}|j|jg|fSr)translate_connect_argsupdatequery)rroptss rcreate_connect_argsz"DefaultDialect.create_connect_argsps*))+ CIIDzrctjj}|r>tjfd|Dt j |dfd}yy)Nc3,K|] }||f ywrr.0rrs r z>DefaultDialect.set_engine_execution_options..}D/>ttDz"engine_connectc*j|yr)_set_connection_characteristics)rrrs rset_connection_characteristicszSDefaultDialect.set_engine_execution_options..set_connection_characteristicss44r)setconnection_characteristics intersectionr$ immutabledictr! listens_for)renginersupported_namesrrs` ` @rset_engine_execution_optionsz+DefaultDialect.set_engine_execution_optionsvsnd==>KK   151C1CD/>D2O  v'7 8 9  rct|jj}|r1tjfd|D}|j ||yy)Nc3,K|] }||f ywrrrs rrzBDefaultDialect.set_connection_execution_options..rr)rrrr$r r)rrrr#rs ` r set_connection_execution_optionsz/DefaultDialect.set_connection_execution_optionss^d==>KK   151C1CD/>D2O  0 0_ M rcR|jDcgc]\}}||j||f}}}|jrU|Dcgc]\}}}|jr||f}}}}|r.t j ddj d|Dz|jj} |D]\}} }| j||| ||jjjjtj|j|ycc}}wcc}}}w)NzThis connection has already initialized a SQLAlchemy Transaction() object via begin() or autobegin; %s may not be altered unless rollback() or commit() is called first., c3&K|] \}}| ywrr)rrobjs rrzADefaultDialect._set_connection_characteristics..s Bz)$zs)itemsrin_transaction transactionalr"rrrrset_connection_characteristic_connection_recordfinalize_callbackappend functoolspartial_reset_characteristics) rrrrvaluecharacteristic_valuesr+_ trans_objsrcharacteristics rrz.DefaultDialect._set_connection_characteristicss> 5446! 6 e42248% @6 !  $ $ &%:$9LD#q$$s $9  --'yy Bz BB D&00AA(= $A~u  8 8j"2E )> 00BBII   d99? K 3! s D D"cT|D]#}|j|}|j||%yr)rreset_characteristic)rrrcharacteristic_namer:s rr5z%DefaultDialect._reset_characteristicss3#2 !<<#N  / /6F G $3rcyrrrrs rdo_beginzDefaultDialect.do_begin rc$|jyr)rollbackr?s r do_rollbackzDefaultDialect.do_rollbacks!!#rc$|jyr)commitr?s r do_commitzDefaultDialect.do_commits!rc&|j|yr)do_closer?s r do_terminatezDefaultDialect.do_terminates &'rc$|jyr)closer?s rrIzDefaultDialect.do_closes rc^ttjdj|S)Nrdialect)strr'selectcompilers r_dialect_specific_select_onez+DefaultDialect._dialect_specific_select_ones&:$$Q'///=>>rcF |j|S#|jj$rt}|j||d}|jrH t j |||ddn,#tj$r}|j}Yd}~nd}~wwxYw|rYd}~yd}~wwxYw)NFT) is_disconnectinvalidate_pool_on_disconnect is_pre_ping) do_pingrErrorrU _has_eventsr$_handle_dbapi_exception_noconnectionr"StatementErrorconnection_invalidated)rrerrrUnew_errs r_do_ping_w_eventzDefaultDialect._do_ping_w_events << 01 1  &&  ..s4DdKM CCC&36;$( ))C$+$B$BMC% sDB B A'&B'B: B B BBBB cd}|j} |j|j|jy#|jwxYw)NT)rexecuterSrL)rrrs rrXzDefaultDialect.do_pingsE!((*  NN4<< = LLN LLNs AAc:dtjdddzzS)zCreate a random two-phase transaction ID. This id will be passed to do_begin_twophase(), do_rollback_twophase(), do_commit_twophase(). Its format is unspecified. z _sa_%032xrr )randomrandintrs r create_xidzDefaultDialect.create_xidsV^^Aq#v666rcL|jtj|yr)rbr'SavepointClauserrrs r do_savepointzDefaultDialect.do_savepoints:55d;}|| s |j|}|J| j,r|j.s| j,dkD}| j0r4|rJ|j3t5t7j8d | j:sJ| j<sJ| j,}| s|rTt?| j<|j@| dDcgc]$\}}|jBjE||d&}}}n9| j<d jBjE||j@dd} d} |r/Dcic]#}tGd t?|| d|D|%}}n/| rDcic]}| |d|}}nDcic]}|d| }}tI|tI|jJk7r8tMjNd tI|jJd tI|d |jPDcgc]}|| }}|j3|.|j3Ay#t $rI}|j#|t%j&|j(|j*d|dYd}~sd}~wwxYwcc}}wcc}wcc}wcc}wcc}w#tR$r,}tMjNd|jTd d|d}~wwxYww)NrFrjschema_translate_mapT) is_sub_execrr)keyrc3:K|]\}}|r||n|ywrr)rvalprocs rrzCDefaultDialect._deliver_insertmanyvalues_batches..ss+"2"IC/3c!;2"szASentinel-keyed result set did not produce correct number of rows z ; produced zP. Please ensure the sentinel column is fully unique and populated in all cases.zACan't match sentinel values in result set to parameter sets; key aT was not found. There may be a mismatch between the datatype passed to the DBAPI driver vs. that which it returns in a result row. Ensure the given Python value matches the expected result type *exactly*, taking care to not rely upon implicit conversions which may occur such as when using strings in place of UUID or integer values, etc. )+rDefaultExecutionContextr-compiledcompiled_parameters_insertmanyvaluesreeffective_returningexecution_optionsrrjrs_insertmanyvalues_rowssort_by_parameter_order!_deliver_insertmanyvalues_batchesfetchall_for_returning BaseException_handle_dbapi_exceptionsql_util_long_statementreplaced_statementreplaced_parametersnum_sentinel_columns is_downgradedimplicit_sentinelextendsortedoperator itemgettersentinel_param_keyssentinel_columnszip descriptionr_cached_result_processortuplerbatchr"rsentinel_valuesKeyErrorargs)rrr statement parametersgeneric_setinputsizescontextrz_composite_sentinel_proc_scalar_sentinel_proc_sentinel_proc_initializedr{imv is_returning batch_sizersresultr imv_batchrowsbecomposite_sentinel_nsccol cursor_descrowrows_by_sentinel sentinel_keys ordered_rowskes rrz0DefaultDialect._deliver_insertmanyvalues_batchess.8 W%5%56  !FJ+0"%99(($()E)E$F ..22 ($*I*I   ( (#*#<#<#@#@&$ $( *,F-3G *&)&A&A #', #F!CC    !  #  IO "99&AD)))++I4K4K),)A)AA)E&,,$655 "4X-@-@-DE!2222////33D5- 9<$'$8$8$*$6$6uv$>9" 89"$4C!$ A A$(+a.!"9" 58!$ 4 4Q 7"d#;#; $f&8&8& N AO'N5 NN(O+ M=4>M82O8M==ON O#'O  OOc(|j||yr) executemanyrrrrrs rdo_executemanyzDefaultDialect.do_executemanys9j1rc(|j||yrrbrs r do_executezDefaultDialect.do_executesy*-rc&|j|yrr)rrrrs rdo_execute_no_paramsz#DefaultDialect.do_execute_no_paramssy!rcy)NFr)rerrs rrUzDefaultDialect.is_disconnectsrc R t|j|}|Dcgc]"}|jddj$}}||k7rH!=GE c3'--/Z !.. tyym,,c*o889JKLMO *+ +!#  sB'B B&%B&c |jddj}|j|}|r;||vr7tjd|d|j ddj ||j||y)Nr8rzInvalid value z1 for isolation_level. Valid isolation levels for z are r))rrrr"rxrrset_isolation_level)rrr_allowed_isolation_levelss rrz.DefaultDialect._assert_and_set_isolation_levels c3'--/$($F$F % ! &66##  *..2ii]%99678:    U3rc|jG|jdk(s|j|jk(sJ|j||jy|jJ|j||jy)N AUTOCOMMIT)rrrrs rreset_isolation_levelz$DefaultDialect.reset_isolation_levels  + + 700L@33//0 0  0 0D<< //; ;;  0 0,, rc|y|j}|j}||k(r|S||k(r|jj|s|S||k(r t |dS|S)NT)quote)lowerrr_requires_quotesr.rr name_lower name_uppers rnormalize_namezDefaultDialect.normalize_namesy <ZZ\ ZZ\  #K 4   $ $ 5 5 &)   4 t40 0Krc|y|j}|j}||k(r|S||k(r|jj|s|}|Sr)rrrrrs rdenormalize_namezDefaultDialect.denormalize_names_ <ZZ\ ZZ\  #K 4   $ $ 5 5 &)D rc|Srrrs rget_driver_connectionz$DefaultDialect.get_driver_connectionsrcttt||jtt|juSr)ryr__code__rN)rmethods r_overrides_defaultz!DefaultDialect._overrides_defaults0 DJ ' 0 0>62;; < rc+Kg}g} tj|vr6|j|j| j|jtj |vr6|j|j | j|jtj|vr|j|j|jdi} |r'|tjur|tjur|} npg} d|i|} g} tj|vr| j|tj|vr| j| | D]} | j||fi| |r t#|}| D]}|r||vs ||f} ||||fd|i|f y#t $rYZwxYw#t$j&$r}|| vr|| |<Yd}~Rd}~wt$j($rYjwxYww)N unreflectabler)rTABLEr2get_table_namesget_temp_table_namesVIEWget_view_namesget_temp_view_namesMATERIALIZED_VIEWget_materialized_view_namespoprANYrdr TEMPORARYrrr"UnreflectableTableErrorNoSuchTableError)rsingle_tbl_methodrkindr filter_namesscoper names_fnstemp_names_fnsrnamesname_kwfnsfntablerur^s r_default_multi_reflectz%DefaultDialect._default_multi_reflect s    t #   T11 2  ! !$";"; < ??d "   T00 1  ! !$":": ;  ' '4 /   T== >3  ( &!EE.2.GC""e+ 9%$$- >*LLJ!:'!:; |,LE5L#8uo )&6<@B +"221-/-0 c*++sfEG,F -G,G, F/G, F,)G,+F,,G,/G) G G,G)&G,(G))G,c >|j|j|fi|Sr)rget_table_optionsrrrs rget_multi_table_optionsz&DefaultDialect.get_multi_table_optionsi**t**  " "J 24  rc >|j|j|fi|Sr)r get_columnsrs rget_multi_columnsz DefaultDialect.get_multi_columnsn"*t**4+;+;ZN2NNrc >|j|j|fi|Sr)rget_pk_constraintrs rget_multi_pk_constraintz&DefaultDialect.get_multi_pk_constraintqrrc >|j|j|fi|Sr)rget_foreign_keysrs rget_multi_foreign_keysz%DefaultDialect.get_multi_foreign_keysvs**t**  ! !: 13  rc >|j|j|fi|Sr)rrrs rget_multi_indexesz DefaultDialect.get_multi_indexes{rrc >|j|j|fi|Sr)rget_unique_constraintsrs rget_multi_unique_constraintsz+DefaultDialect.get_multi_unique_constraints~s**t**  ' ' 79  rc >|j|j|fi|Sr)rget_check_constraintsrs rget_multi_check_constraintsz*DefaultDialect.get_multi_check_constraintss**t**  & &  68  rc >|j|j|fi|Sr)rget_table_commentrs rget_multi_table_commentz&DefaultDialect.get_multi_table_commentrr)rzOptional[_ParamStyle]rQzOptional[IsolationLevel]rzOptional[ModuleType]rz Literal[True]rOptional[bool]rr^rr^rjzUnion[_NoArg, int]rfrrrDrnrerr)returnr1)rr>rz Type[Pool])rzOptional[_ListenerFnType]r)rrrrPrrrre)r"r2rr[rNone)rrrr[rr)rr;rre)__name__r __qualname____doc__r%r-statement_compilerr+ ddl_compilerrrIdentifierPreparerrsupports_altersupports_commentssupports_constraint_commentsinline_commentsrdiv_is_floordivrr{NONEr}rO__annotations__rPdefault_sequence_baserexecute_sequence_formatsupports_schemassupports_viewssupports_sequencessequences_optional"preexecute_autoincrement_sequencessupports_identity_columnspostfetch_lastrowidfavor_returning_over_lastrowid#insert_null_pk_still_autoincrementsrrupdate_returning_multifromdelete_returning_multifromrcte_follows_insertsupports_native_enumrsupports_native_uuidreturns_native_bytes#non_native_boolean_check_constraintsupports_simple_order_by_labeltuple_in_valuesr$r rIsolationLevelCharacteristicLoggingTokenCharacteristicrasint bool_or_strasboolr\supports_native_decimalrrr_rQr`rarsupports_sane_multi_rowcountrbrsupports_default_valuessupports_default_metavaluedefault_metavalue_tokensupports_empty_insertsupports_multivalues_insertrfrgr, NOT_SUPPORTEDrhrjinsertmanyvalues_max_parameterssupports_is_distinct_fromrwrnsupports_for_update_ofrrkrequires_name_normalizeis_async has_terminate$_legacy_binary_type_literal_encodingdeprecated_paramsr*rri NO_LINTINGrproperty deprecatedrmemoized_propertyrrupdate_executemany_returningdelete_executemany_returningrrrrrrr classmethodrrrrrrrrrrrrr rr$r'rr5r@rDrGrJrIrSr`rXrgrkrnrqrrrrrUmemoized_instancemethodrrrrrrrrrrrrr r rrrrrrNrNss`+!--''L 44**HN#( O#O'',,K26/626/6$N).& %%*"*/'!&!& #  *.'%)"O!3!3!3KKKMG_GGI ".@T-?-? JJ$D$$W-)))'2 JJ JJkk  .* $ D!9='=%)O]) ,0=/04 4!#' MOHJO #:!&<' !."'!&$&.3%t3 %22'(D'+*&+# $#( #)--$HM ,3(T  *-148&*,026/3&*9?/3%((;(;$<$)PI)PI2PI$ PI * PI "0 PI -PI$PI%7PI-PI"PI"PIPI'&PIdT__  -      C C CC,$) #(   FF  & ++--++99( "H 4 ; F$F36F>AF F < $5 " N$ N,= N  N <H $"(! ??.7=GDj(X2." !!,",$4$"4" GR O  O   rrNceZdZejZej ZejZ ejZ dZ dZ dZdZdZdZdZdZdZdZdZy)StrCompileDialectTFN)rrrr%StrSQLCompilerrr+rStrSQLTypeCompilerrrrrrrrr*r'r(r)rrBr5rrrrUrUsr!00''L 33**H# $).&""&%)"rrUceZdZUdZdZdZdZdZdZe jZ de d<dZ de d<dZde d<dZd e d <ej"Zd e d <ej(ZdZd e d<dZdZdZdZdZdZde d<dZde d<ej<Zde d< e Z!de d<de d<de d<de d<de d<de d <d!e d"<d#e d$<e"d%ej"Z#dZ$d&e d'<d(Z%d)e d*<e& dXd+Z'e&e(jRf dYd,Z*e& dZd-Z+e& d[d.Z,d\d/Z-e.d0Z/ej`d1Z1ej`d2Z2ej`d]d3Z3ej`d]d4Z4ej`d5Z5d^d6Z6ej`d7Z7d8Z8d9Z9d:Z:d;Z;d<ZZ>d?Z?d@Z@dAZAdBZBejd_dCZDe.dDZEdEZFdFZGdGZHdHZIdIZJej`dJZKdKZLdLZMdMZNdNZO d`dOZPdPZQdQZRdZSdRe dS< dadTZTdUZUdVZVdWZWy)bryFr execute_styleNzOptional[Compiled]rzzAOptional[Tuple[List[ResultColumnsEntry], bool, bool, bool, bool]]result_column_structzOptional[Sequence[Row[Any]]]returned_default_rowsr8r~zOptional[Executable]invoked_statementr^ _rowcountzOptional[Callable[[str], str]]_translate_colnamezMapping[str, List[str]]_expanded_parametersrroot_connectionrA_dbapi_connectionrrOrPunicode_statementrrz%List[_MutableCoreSingleExecuteParams]r{r7r&Optional[Sequence[BindParameter[Any]]]extracted_parametersr[zOptional[List[Tuple[Any, ...]]]rrri_num_sentinel_colsc&|j|}||_||_|j|_|x|_}d|_||_t||_|jrJ|j jdi}|jj} | |j||_|j|_ |j|_g|_|j"r|j%g|_|S|j(g|_|S)zKInitialize execution context for an ExecutableDDLElement construct.Trs)__new__r`rarOrzisddlr~rPrbrsrr_render_schema_translatesr create_cursorrr{r~r$r_empty_dict_params) rrOrrr~ compiled_ddlrrzrsrsts r _init_ddlz!DefaultExecutionContext._init_ddls{{3)!1!)) #//  !2!$X  ( (#'#9#9#=#=&$ ##==C%(&&(<&D "//((* #%   &>>@ADO  $667DO rc  |j|} || _|| _|j| _|| _|| _|| _| | _|| _|j|j|j|j|jf| _|jx| _} |j x| _} |j"x| _} |j$| _| s| s| r|j(j*}t,rt/|t0sJd| _t5|j6x| _}t5|j:x| _}|r|j>rd| _ |r|rJ|s|rf|jBrY| rC| jjDs-tGjHd| jjJd| rO|jLrC| jjNs-tGjHd| jjJd| r7| jjPr!|jRstGjHd| rC| jjTs-tGjHd| jjJd| rC| jjVs-tGjHd| jjJd|s|jY|d g| _-nt]|Dcgc]\}}|jY|d|| c}}| _-t_|d kDrl| jrK|jRr?t`jb| _2|jR}|jf'|jh| _5nt`jl| _2|jn| _8| js| _:| j jvs| j jxr| j{|j|}|}|j~s |jr| jrtGjHd |j| jZd}|j*| _8|j| _Dt|}|j|j|j}n%|jr| j j}nd }|jrJ| jjdi}|jj}|| jp|| _8| jp| _|jrdg}|J| jZD]F}|Dcgc]}||vr||||n||}}|j|j|H|| _P| Sg}|j}| jZD]p}|r6|Dcic]*}|j||||vr||||n||,} }n%|Dcic]}|||vr||||n||} }|j| r|| _P| Scc}}wcc}wcc}wcc}w)z6Initialize execution context for a Compiled construct.Trz] with current server capabilities does not support INSERT..RETURNING when executemany is usedz} with current server capabilities does not support INSERT..RETURNING with deterministic row ordering when executemany is usedznStatement does not have "insertmanyvalues" enabled, can't use INSERT..RETURNING with executemany in this case.z] with current server capabilities does not support UPDATE..RETURNING when executemany is usedz] with current server capabilities does not support DELETE..RETURNING when executemany is usedF)rd escape_names)rp _group_numberrdrNzL'literal_execute' or 'expanding' parameters can't be used with executemany()rrs)Rrgr`rarOrdr\rz cache_hitr~_result_columns_ordered_columns_textual_ordered_columns_ad_hoc_textual_loose_column_name_matchingrZisinsertisupdateisdelete isplaintextis_text compile_staterrrrGis_crudre _returning_is_explicit_returningr_is_implicit_returning_supplemental_returning_is_supplemental_returningfor_executemanyrr"rr_sort_by_parameter_orderrrfr|rPrQconstruct_paramsr{ enumeraterrINSERTMANYVALUESrYrrre EXECUTEMANYstringrbrjrinsert_prefetchupdate_prefetch_process_execute_defaults_bind_processorsliteral_execute_paramspost_compile_paramsr#_process_parameters_for_postcompileparameter_expansionr_dictr processors positiontupr~rsrrrir2r$rescaped_bind_names)!rrOrrr~rzrr\rdrrriiiuid_ dml_statementieriirgrpmrrflattened_processorsexpanded_staterrsrmcore_positional_parameterscompiled_paramsrul_paramcore_dict_parameters escaped_namesd_params! r_init_compiledz&DefaultExecutionContext._init_compileds{{3)!1!)) $8!!2  "!2  $ $  % %  - -  $ $  0 0 % !&... %... &/// ++ s$22<> LL]]11"4<<#C#C"DE33 99$66114  I I11"4<<#C#C"DEEE !J!J11"4<<#C#C"DEEE )))=!&*(D $( 3(4FC ))!&"%)= * 4(D $:"==X%?%?)5)F)FD&"44C++7252J2J/)5)A)AD&!)((* == ( (DMM,I,I  * * ,..     * *h.J.J--. &II((+N &4%=%=D "(6(J(JD %#' #3 ' '(A(A B(44K  --33KK  ( (#'#9#9#=#=&$ ##==C%(&&(<&D " //   IK &* **#'#;#; + & +"662,S1/#2FG,S12 + &+1133G<$<9DOF CEG $77M$(#;#; $3  $3C &))#s3"&::605oc6JK!0!56 $3 $3  $3C "&::605oc6JK!0!56 $3 %++G4)$<,3DO {(\&2sY/Y/YY c\|j|}||_||_|j|_d|_||_|s@|jj r|jg|_ns|jg|_n`t|d|jr||_n?t|dtr||_n$|Dcgc]}|j|c}|_t|dkDrtj|_|x|_|_|j%|_|Scc}w)z8Initialize execution context for a string SQL statement.Trr)rgr`rarOr|r~r~r$rrkrrrrrrYrrbrjr) rrOrrr~rrrps r_init_statementz'DefaultExecutionContext._init_statements{{3)!1!))  !2||&&#*#B#B#D"E#'#:#:";  1 w'F'F G(DO  1 t ,(DO=G*;; ; # #&$*@*@@5**+BC(N9 03>2CCC % %A !! ##hE  rcZ|jtjtjfvSr)rYrrrrs rrz#DefaultExecutionContext.executemanyTs,!!  $ $  ) )&   rc|jr|jjSd|jvr2|jjj |jdS|jjS)Nrs)rzrr~rOr_with_schema_translaters rrz+DefaultExecutionContext.identifier_preparer[se ====)) ) #t'='= =<<33JJ&&'=> <<33 3rc.|jjSr)r`r"rs rr"zDefaultExecutionContext.enginefs##***rcrtrt|jtsJ|jjSr)rrrzr- postfetchrs rpostfetch_colsz&DefaultExecutionContext.postfetch_colsjs) dmm[9 99}}&&&rctrt|jtsJ|jr|jj S|j r|jjSy)Nr)rrrzr-rxrryrrs r prefetch_colsz%DefaultExecutionContext.prefetch_colspsJ dmm[9 99 ====00 0 ]]==00 0rc:|jjddS)N no_parametersF)r~rrs rrz%DefaultExecutionContext.no_parameters{s%%))/5AArc$|j}d|jvr;|jjdi}|jj}|||}|s3|j j r|j j}ni}|j|j||||jj}||d}nd}|@|j|j |jjdd} | r| |S|S)aExecute a string statement on the current cursor, returning a scalar result. Used to fire off sequences, default phrases, and "select lastrowid" types of statements individually or in the context of a parent INSERT or UPDATE statement. rs)rNrr) r`r~rrrirOr~r$_cursor_executerfetchonerr) rstmttype_rconnrsrmrrrxs r_execute_scalarz'DefaultExecutionContext._execute_scalars## !T%;%; ;#'#9#9#=#=&$ **DDCt12D||&&!\\AAC   T[[$ DIkk""$ ?AAA  11 dkk55a8;DAwrc|jSr)r`rs rrz"DefaultExecutionContext.connections###rc,|jjsy|jjr|jj ddxr|j xr.t |j jtjxsl|j xs.t |j jtjxr-|jxrtj|j}|S|jj dd}|S)NFstream_resultsT)rOrwrnr~rrzrrr' Selectable TextClauserbSERVER_SIDE_CURSOR_REmatch)ruse_server_sides r_use_server_side_cursorz/DefaultExecutionContext._use_server_side_cursors||88 << + +"4488 $ Ot}}66 8M8MN !MM)% MM33Z5J5JL .. L.33D4J4JK * #4488 %Orc|jjrY|jjdds&|jjr'|j rd|_|jSd|_|jS)NrFT) rOrwr~rrnr_is_server_sidecreate_server_side_cursorcreate_default_cursorrs rrjz%DefaultExecutionContext.create_cursorsq LL 5 5&&**+;UCLL44446$(D 113 3#(D --/ /rc"|jSr)fetchall)rrs rrz.DefaultExecutionContext.fetchall_for_returnings  rc6|jjSr)rarrs rrz-DefaultExecutionContext.create_default_cursors%%,,..rctrrrs rrz1DefaultExecutionContext.create_server_side_cursors !##rcyrrrs rpre_execz DefaultExecutionContext.pre_execrArctd)Nz,This dialect does not support OUT parametersr)rrs rget_out_parameter_valuesz0DefaultExecutionContext.get_out_parameter_valuess! :  rcyrrrs r post_execz!DefaultExecutionContext.post_execrArc:|j|j|S)zReturn a 'result processor' for a given type as present in cursor.description. This has a default implementation that dialects can override for context-sensitive result type handling. )rrO)rrcolnamecoltypes rget_result_processorz,DefaultExecutionContext.get_result_processors--dllGDDrc.|jjS)a return self.cursor.lastrowid, or equivalent, after an INSERT. This may involve calling special cursor functions, issuing a new SELECT on the cursor (or a new one), or returning a stored value that was calculated within post_exec(). This function will only be called for dialects which support "implicit" primary key generation, keep preexecute_autoincrement_sequences set to False, and when no explicit id value was bound to the statement. The function is called once for an INSERT statement that would need to return the last inserted primary key for those dialects that make use of the lastrowid concept. In these cases, it is called directly after :meth:`.ExecutionContext.post_exec`. )r lastrowidrs r get_lastrowidz%DefaultExecutionContext.get_lastrowids"{{$$$rcyrr)rrs rhandle_dbapi_exceptionz.DefaultExecutionContext.handle_dbapi_exception rArc^|j |jS|jjSr)r]rrowcountrs rrz DefaultExecutionContext.rowcounts& >> %>> !;;'' 'rc|jduSr)r]rs r _has_rowcountz%DefaultExecutionContext._has_rowcounts~~T))rc.|jjSr)rOrrs rrz.DefaultExecutionContext.supports_sane_rowcounts||222rc.|jjSr)rOr=rs rr=z4DefaultExecutionContext.supports_sane_multi_rowcounts||888rcN|j}|j-|jddr|jj|_|j s |j r|j}dx}}n|jdd}|jxs|jdd}|j}|r<|tjur*tj|j|j}|jxs|jj}|tj}tj |||}|j"}|r7|j$s+t't(|j*r|j-||j.|_|r|j1|}|S)Npreserve_rowcountF yield_perr)r~r]rrrr~r|_setup_dml_or_text_resultrcursor_fetch_strategy_cursor_DEFAULT_FETCHBufferedRowCursorFetchStrategyalternate_cursor_descriptionr_NO_CURSOR_DQL CursorResultrzrhrr-has_out_parameters_setup_out_parameters _soft_closedr)rexec_optrypsrstrategycursor_descriptionrzs r_setup_result_proxyz+DefaultExecutionContext._setup_result_proxy sc)) >> !hll3F&N![[11DN <<4<<335FOBk40B%%N6F)NB11Hh'"8"88"AAKK!7!755+;;** ")"11))$:LMF== JJ[(+>>  & &v ."// %%b)F rc vtt|j}|jj Dcgc]\}}|j r||f}}}i}t |Dcgc]\}}| c}}|j|Dcgc]\}}| c}}D]\}}|j} | j|j} | j|jj} | j|j| } | | |}|||j<||_ycc}}wcc}}wcc}}wr)rr-rz bind_namesr, isoutparamrrr dialect_implrOget_dbapi_typerresult_processorruout_parameters) rrrzparamrout_bindparamsr bindparam raw_valuer impl_type dbapi_typer s rrz-DefaultExecutionContext._setup_out_parametersJs3 T]]3 (2288: : tDM:  $'&4 5n{udUn 5  ) ))78+%8 % Iy NNE**4<<8I"11$,,2K2KLJ(99 j   +,Y7 ,5N9== )% !//  68sD)! D/ D5ctt|j}|j}|jr|j t jurB|jr6tj|j|j|j}|jr|j|_|j"r<|tj$ur*tj&|j|j(}|tj*urd}n$|jxs|jj,}|tj*}n:|j.r.|j t jusJ|d|j. }tj0|||}|jr|j2rw|j5}||_|j9|||_|j:j<sJ|j>r|jA||S|jC|S|jDs|jC|S|j2rq|j5}|r||_tG||_$|j>r|jA|n|jC|j:j<sJ|S|j:j<s9|jH|jjJ|_$|jC|S|jLs |jNr'|jH|jjJ|_$|S)N)initial_bufferalternate_descriptionr)(rr-rzrrxrYrrr}r FullyBufferedCursorFetchStrategyrrrr+_setup_ins_pk_from_lastrowidinserted_primary_key_rowsrrrr~_NO_CURSOR_DMLrrerrallr[%_setup_ins_pk_from_implicit_returning _metadata returns_rowsr_rewind _soft_closerrr]rryrz)rrzrrrrs rrz1DefaultExecutionContext._setup_dml_or_text_resultfs T]]3(,(B(B ==""l&C&CC00"CCKK#'#>#>!== ++557.   H0F0F$F== T33H w-- -!% 55+;;**   %--H  $ $%%)F)FF FF"4T,,," -4,@,@ (.-  ==**zz|-1*>>vtL.''4444 22NN4(J G&&(F E00""$B 3 ( (::??rctt|jj}|jDcgc] }|d| c}Scc}wr)rr-rzr%r{)rr&rs rr#z0DefaultExecutionContext._setup_ins_pk_from_emptysG  5 5 261I1IJ1ItU#1IJJJsAc|sgStt|jj}|j}t ||Dcgc]\}}|||c}}Scc}}wr)rr-rz+_inserted_primary_key_from_returning_getterr{r)rrrr&rrrs rrz=DefaultExecutionContext._setup_ins_pk_from_implicit_returningsiI  5 5 2225T?1K 1K:3F3 1K   sAc|jxs |jxr-ttt|j j Sr)rxryrerr-rzrrs rlastrow_has_defaultsz,DefaultExecutionContext.lastrow_has_defaultss7 . D dmm , 6 65  rc |js |jrytt|j}|j }|y|j }|jrHt|}|jj||j|j|j||jr |j nd |jr-|j xsdDcgc]}||j"|f}}n.|j$j'Dcgc] \}}||f }}}g}|D]\}|j(vr||j*vrt-j.rXt1j.j2 | |j5 fdt7|j*|D|j9d |j5 fd|j*|D|j9d  j9||n|}|j;| j.f|Scc}wcc}}w)aGiven a cursor and ClauseParameters, prepare arguments in order to call the appropriate style of ``setinputsizes()`` on the cursor, using DB-API types from the bind parameter's ``TypeEngine`` objects. This method only called by those dialects which set the :attr:`.Dialect.bind_typing` attribute to :attr:`.BindTyping.SETINPUTSIZES`. Python-oracledb and cx_Oracle are the only DBAPIs that requires setinputsizes(); pyodbc offers it as an option. Prior to SQLAlchemy 2.0, the setinputsizes() approach was also used for pg8000 and asyncpg, which has been changed to inline rendering of casts. Nrc3K|]@\}}j||n||zjj|zfBywr)rrtypes)rr paramnamerdbtypesrnums rrzCDefaultExecutionContext._prepare_set_input_sizes..>s` ./NC $6#A!3 6 6y) L%.#C#I.%NN00s;/sAA c3dK|]'}j||n|jf)ywr)rr)rr/rdbtypers rrzCDefaultExecutionContext._prepare_set_input_sizes..NsF .*HI $6#A!3 6 6y) L%."%NN*Hs-0)rhr|rr-rz_get_set_input_sizes_lookuprOrZrdispatchdo_setinputsizesrrrrr~rbindsr r,rr_r)rrr.rrrr2) rrz inputsizesrOrur,rgeneric_inputsizes escaped_namer3r0rr1s ` @@@@r_prepare_set_input_sizesz0DefaultExecutionContext._prepare_set_input_sizessU& :: T]]399;  ,,   j)J    - -DKK$   & &!)!>:[$b"!y s %I Ic|jr|j||S|jr||_|j |S|j r|j |||S|jSr) is_sequence fire_sequence is_callablecurrent_columnris_clause_element_exec_default_clause_element)rcolumnr]rs r _exec_defaultz%DefaultExecutionContext._exec_defaultisj   %%gu5 5  #)D ;;t$ $  & &44VWeL L;; rc T|js!tj|j|}n |j}tj|j |j }|j}|j}|jrM|j j|jxsdDcgc]}||vr||||n||c}} n%|Dcic]}|||vr||||n||} }|jt||| Scc}wcc}w)NrNr)r) _arg_is_typedr' type_coercerrQrRrOrrr~r$rrrP) rrCr]r default_argrzrrrurs rrBz4DefaultExecutionContext._exec_default_clause_elementxsY$$$00eDK!++K$$[199$,,9O"335..   == (339r9  :*,( 3(<=,S12 :  J"+  +C j($JsOOC$89(-. + ## M5Z$  %s 8D "D%z"Optional[_CoreSingleExecuteParams]current_parametersc |j|j}|JJt dt t |jj}|J|rtj|r|jr|jr5|jdz|jj|ji}n|j|ji}d|j J|j j#}|j%fd|D|SS#t$rtjdwxYw)aiReturn a dictionary of parameters applied to the current row. This method can only be used in the context of a user-defined default generation function, e.g. as described at :ref:`context_default_functions`. When invoked, a dictionary is returned which includes entries for each column/value pair that is part of the INSERT or UPDATE statement. The keys of the dictionary will be the key value of each :class:`_schema.Column`, which is usually synonymous with the name. :param isolate_multiinsert_groups=True: indicates that multi-valued INSERT constructs created using :meth:`_expression.Insert.values` should be handled by returning only the subset of parameters that are local to the current column default invocation. When ``False``, the raw parameters of the statement are returned including the naming convention used in the case of multi-valued INSERT. .. versionadded:: 1.2 added :meth:`.DefaultExecutionContext.get_current_parameters` which provides more functionality over the existing :attr:`.DefaultExecutionContext.current_parameters` attribute. .. seealso:: :attr:`.DefaultExecutionContext.current_parameters` :ref:`context_default_functions` zdget_current_parameters() can only be invoked in the context of a Python side column default functionrFrrc36K|]}|d|fzfyw)z%s_m%dNr)rruindexrs rrzADefaultExecutionContext.get_current_parameters..s(FJsjS%L!89:ds)rIr@AttributeErrorr"rrr-rzr}r&rx_has_multi_parameters_is_multiparam_columnrLoriginalru_dict_parameterskeysr)risolate_multiinsert_groupsrCr}drRrLrs @@rget_current_parametersz.DefaultExecutionContext.get_current_parameterssEB *00J((F% %%) )) [$--8FF ((( & ]+33++ q(__((*VZZ*@AZZFJJ!78 11= == 11668D HHFJ H = ))C  s DD=cj|jy|j||j|jSr)r]rDrrrCs rget_insert_defaultz*DefaultExecutionContext.get_insert_defaults, >> !%%ffnnfkkJ Jrcj|jy|j||j|jSr)onupdaterDrrWs rget_update_defaultz*DefaultExecutionContext.get_update_default s, ?? "%%ffoov{{K KrcFtt|j}|j}d}|jr8|jDcgc]"}||||j |j f$}}nF|jr8|jDcgc]"}||||j|jf$}}ng}|jD]T}||_ |D]F\}}\}} } } } | r |||<|dz }| r|||<"| r||_ ||||<7| |} | B| ||<HV|` ycc}wcc}w)Nrr) rr-rz_within_exec_param_key_getterr_default_description_tuplerXr_onupdate_description_tupler[r{rIr@)rrz key_gettersentinel_counterc prefetch_recsr param_keyr is_scalarr? is_sentinelfallbackrws rrz1DefaultExecutionContext._process_execute_defaults sv T]]3;;   # #"112A qM00++  2  % %"112A qM11++  2 M--E&+D # :ik'7E)$$)$'*E)$ *+D''*4yE)$"1+C+.i(.,  #Ys 'D'D) rOrrrrrAr~r8rlr+rr)rOrrrrrAr~r8rzr-rr4r\rBrdrcrrrrr)rOrrrrrAr~r8rrPrr7rr) rOrrrrrAr~r8rr)rrP)rzOptional[Sequence[Column[Any]]]r)rri)rz0Optional[List[Tuple[str, Any, TypeEngine[Any]]]])T)Xrrrrxryrzr~r|rhrEXECUTErYr"rzrZr[r$ EMPTY_DICTr~rrrr\rrrrrr]r^r r_rrrrrkrrerRrnrrrrrrrMrrOrr"rrrrrrrjrrrrrrrrrnon_memoized_propertyrrrr=rrrrrr#rr+r;rDrBrIrUrXr[rrrrryrysdHHHGG E"."6"6M<6#'H '  ;?7>)-8#22.2+2""!&OL#I}# :>6=4FD4F4F4H1H I,,  >>((@@14??C>B;B***0 * + * " * **X!+ ; ;ccc0 c + c  c,c&cEcc ccJ'''0 ' + '  '-' ''R0  +   & D   44 ++ ''   BB'R $$:0$!/$   E%&  ( ( **39(T/8pd // @K   i" 9i"V % N>B:A0BHK L 4$rry)pr __future__rr3rreretimertypingrrrrr r r r r rrrrrrrrrrrbaserrrrrr reflectionrrr!r"r#r$sqlr%r&r'r(r sql._typingr)sql.baser* sql.compilerr+r,r- sql.elementsr. util.typingr/r0r.r1r2r3r4r5r6r7r8r9r:r;r<rr=rr>r?r@rArBrCrDrEsql.dmlrFrGrH sql.schemarI sql.type_apirJrKrLrRIUNICODErrrrrrrrNrUryexecution_ctx_clsrrrr~sw#  !" "#$("#"'&7&&!  +3434+;'+*', '&1"$,#13)# < 1BC   X WX v **0V$.V$r$$; r