widZddlZddlZddlmZddlmZddlmZddlmZddlmZ  ddl m Z d Z n#e $rd Z YnwxYw dd l mZd Zn#e $rd ZGddeZYnwxYwGddeZ ejjen #e $rYnwxYwGddeZGddeZGddeZGddeZGddeZGddeZdS)z[Define result set constructs including :class:`_engine.ResultProxy` and :class:`.RowProxy`.N)exc)util) expression)sqltypessafe_rowproxy_reconstructorc"t||SNr)clsstates /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/sqlalchemy/engine/result.pyrowproxy_reconstructorr!s*3666cZ||}|||Sr )__new__ __setstate__)r r objs rrr's,kk#  r) BaseRowProxyTFc<eZdZdZdZdZdZdZdZdZ dZ d S) r_parent_row _processors_keymapc>||_||_||_||_dS)z8RowProxy objects are constructed by ResultProxy objects.Nr)selfparentrow processorskeymaps r__init__zBaseRowProxy.__init__7s%"DLDI)D !DLLLrcFt|j|ffSr )r __class__ __getstate__rs r __reduce__zBaseRowProxy.__reduce__?s%&!2!2!4!45 rc t|S)z9Return the values represented by this RowProxy as a list.)listr&s rvalueszBaseRowProxy.valuesEs:: rc#rKt|j|jD]\}}||V ||VdSr )ziprr)r processorvalues r__iter__zBaseRowProxy.__iter__Is]$'(8$)$D$D + + 5$KKKK#)E******  + +rc*t|jSr )lenrr&s r__len__zBaseRowProxy.__len__Psty>> !rc8 |j|\}}}n#t$r)}|j||\}}}Yd}~nd}~wt$rt |t rug}t|j||j |D];\}}|| || ||z"RowProxy.items..s"888Sd3i 888r)keysr&s`ritemszRowProxy.itemss'9888DIIKK8888rc|jjS)zReturn the list of keys as strings represented by this :class:`.RowProxy`. This method is analogous to the Python dictionary ``.keys()`` method, except that it returns a list, not an iterator. )rr}r&s rr}z RowProxy.keyss|  rc4t|jjS)zReturn a an iterator against the :meth:`.RowProxy.keys` method. This method is analogous to the Python-2-only dictionary ``.iterkeys()`` method. )iterrr}r&s riterkeyszRowProxy.iterkeyssDL%&&&rc t|S)zReturn a an iterator against the :meth:`.RowProxy.values` method. This method is analogous to the Python-2-only dictionary ``.itervalues()`` method. )rr&s r itervalueszRowProxy.itervaluessDzzrcRtt|S)zReturn the values represented by this :class:`.RowProxy` as a list. This method is analogous to the Python dictionary ``.values()`` method, except that it returns a list, not an iterator. )superrQr*rr$s rr*zRowProxy.valuess!Xt$$++---r)rKrLrM__doc__rNrVr%r__hash__r\rarerhrkrnrqrvrxr~r}rrr* __classcell__r$s@rrQrQvs@ I***>>>&&& H   ,,,,,,,,,,,,,,,,,,...***(999 ! ! !'''.........rrQcteZdZdZdZdZdZdZdZdZ dZ e dd Z dd Z d Zdd ZdZdZdS)ResultMetaDatazRHandle cursor.description, applying additional info from an execution context.)rcase_sensitivematched_on_namerr}_orig_processorsc: |j}|j}|j_d_d_|jr|j\}}}t |}ndx}x}x}}||||||} i_tsBt | j d| Dfd| Dzd| D_ td| D |rt |krt} | D]H} | d} | | vr%js| n| } d| df | <| | Ij fd| Djs$j d| Dn$j d | Dj |s/|jr*j fd | DdSdSdS) NFcLg|]!}|d|d|d|dff"SrrOr{elems rr|z+ResultMetaData.__init__..6s4HHHD$q'DGT!Wd1g67HHHrcTg|]$}|dz |d|d|dff%SrrO)r{rlen_raws rr|z+ResultMetaData.__init__..7sJ!Ww&a$q'47(CDrcg|] }|d S)rrOrs rr|z+ResultMetaData.__init__..?s444DG444rcLg|]!}|d|d|d|dff"S)rrrrrOrs rr|z+ResultMetaData.__init__..Bs4NNN$Q$q'47DG!<=NNNrcVg|]%}|d |dD]}||df&S)rrrO)r{robj_elemby_keys rr|z+ResultMetaData.__init__..\s_ 7)-Q %"6$q'?3rchg|]/}|d |dd|d|d|dff0S)rrrrOrs rr|z+ResultMetaData.__init__..jsR $#Aw!!WQZ$q'47DG)DErcfg|].}|d |dD]}||d|d|dff/S)rrrrO)r{rrs rr|z+ResultMetaData.__init__..tsi 7)-Q %"DGT!Wd1g#>?rcVg|]%}|d |dj|df&S)r)r)r{rrs rr|z+ResultMetaData.__init__..s6MMMdT!WM$q'4<Q01MMMr)contextdialectrrrresult_column_structr1_merge_cursor_descriptionr_baserowproxy_usecextupdaterdictsetloweradd_translate_colname)rrcursor_descriptionrrresult_columnscols_are_orderedtextual_ordered num_ctx_colsrawseenrecr=rrs` @@rr"zResultMetaData.__init__ s ./%4$ $  ' 7 ,   ~..LL27 7N 7  7,,          $ #hhG L  HHCHHH #   54444NN#NNNOO 3  6{{l**uu""Ca&Cd{{261DMciikkk#'+S$&7s HHSMMMM  ##$'+L''(+ ##$' F###  :  L  MMMMcMMM         rc^jj|rE|rC|sA|tkr.d|D|_fdt |DS|r||}n0|r||}n|}fd|DS)a Merge a cursor.description with compiled result column information. There are at least four separate strategies used here, selected depending on the type of SQL construct used to start with. The most common case is that of the compiled SQL expression construct, which generated the column names present in the raw SQL string and which has the identical number of columns as were reported by cursor.description. In this case, we assume a 1-1 positional mapping between the entries in cursor.description and the compiled object. This is also the most performant case as we disregard extracting / decoding the column names present in cursor.description since we already have the desired name we generated in the compiled SQL construct. The next common case is that of the completely raw string SQL, such as passed to connection.execute(). In this case we have no compiled construct to work with, so we extract and decode the names from cursor.description and index those as the primary result row target keys. The remaining fairly common case is that of the textual SQL that includes at least partial column information; this is when we use a :class:`.TextAsFrom` construct. This construct may have unordered or ordered column information. In the ordered case, we merge the cursor.description and the compiled construct's information positionally, and warn if there are additional description names present, however we still decode the names in cursor.description as we don't have a guarantee that the names in the columns match on these. In the unordered case, we match names in cursor.description to that of the compiled construct based on name matching. In both of these cases, the cursor.description names and the column expression objects and names are indexed as result row target keys. The final case is much less common, where we have a compiled non-textual SQL expression construct, but the number of columns in cursor.description doesn't match what's in the compiled construct. We make the guess here that there might be textual column expressions in the compiled construct that themselves include a comma in them causing them to split. We do the same name-matching as with textual non-ordered columns. The name-matched system of merging is the same as that used by SQLAlchemy for all cases up through te 0.9 series. Positional matching for compiled SQL expressions was introduced in 1.0 as a major performance feature, and positional matching for textual :class:`.TextAsFrom` objects in 1.1. As name matching is no longer a common case, it was acceptable to factor it into smaller generator- oriented methods that are easier to understand, but incur slightly more performance overhead. cg|] }|d S)rrOrs rr|z.s<<.s   1C0#tS%(6@DJJLLLD00s$6s$;A$>    rc Xg|]&\}}}}}}||||||||f'SrO)r)r{rcolname mapped_typecoltyper untranslatedrs rr|z.sj 00#Wg  r)rrr1r} enumerate_merge_textual_cols_by_position_merge_cols_by_name_merge_cols_by_none) rrrrrrr raw_iteratorrs `` @rrz(ResultMetaData._merge_cursor_descriptions6|!7 =  = $= $6 7 777<<^<<n4M4M      #CC/     $77/   $77/   $"% rc#K|j}|j}|j}|jr|jnd}|jr|jnd}d}g|_t|D]w\} } | d} | d} |r || } |r|| \} }|r || } |j | |s| } | | || fVxdS)zExtract column names and data types from a cursor.description. Applies unicode decoding, column translation, "normalization", and case sensitivity rules to the names based on the dialect. Nrr) rrrdescription_encoding_description_decoderrequires_name_normalizenormalize_namer}rr:r) rrrrrtranslate_colnamedescription_decoderrrrrrrs r_colnames_from_descriptionz)ResultMetaData._colnames_from_descriptions-/ /#6+ G ( (  '.&E OG " "4   !"455 6 6HC!fG!fG" 7--g66  C(9(9'(B(B% 2(.11 I  W % % %! *!--//w g5 5 5 5 5# 6 6rc#K|rt|nd}|t|kr&tjd|t|fzt}|||D]\}}}} ||kr[||} | d} | d} | d|vrt jd| dz|| dntj } d} ||| | | |fVdS)NzVNumber of columns in textual SQL (%d) is smaller than number of columns requested (%d)rrrz8Duplicate column expression requested in textual SQL: %r) r1rwarnrrrr<rrNULLTYPE) rrrrrrrrrrctx_recrrs rrz.ResultMetaData._merge_textual_cols_by_position/sK/=Fs>***$ #011 1 1 I@%7!8!89:    uu  , ,W6H I I  H H    \!!(-aj%aj q6T>>1-/21v6Q    &/ w Wc<G G G G G) H Hrc# K|j}|j}|||}d|_|||D]I\}}} } ||} | d} | d} n#t $rt j} d} YnwxYw||| | | | fVJdS)NTrr)rr_create_result_maprrr5rr)rrrrrr result_maprrrrrrrs rrz"ResultMetaData._merge_cols_by_nameQs/ /,,^^LL #  , ,W6H I I  H H     )$W- aj%aj    &/   w Wc<G G G G G H Hs A%%B?Bc#nK|||D]\}}}}||tj|d|fVdSr )rrr)rrrrrrrs rrz"ResultMetaData._merge_cols_by_nonegsd  , ,W6H I I  O O    w 17D,N N N N N  O OrTci}|D]Q}|d|dd}}|s|}||vr||\}}} |||dz| f||<L|||<R|SNrr)r) r rrdrr=re_namee_obje_types rrz!ResultMetaData._create_result_mapps "  DAwQRRC! "iikkaxx )*#%vQ7##rcZ|j}d}t|tjr2||jr|n|}n t|tjr|j rW|jr|j n|j |vr.||jr|j n|j }nft|drV|jr|j n|j |vr-||jr|j n|j }|,|d$|dD]}| |rnd}|B|r>tj tjdtj|z|ndS|||<|S)NrHrz.Could not locate column in row for column '%s'rC)rr8r string_typesgetrrr ColumnElement_labelhasattrrH_compare_name_for_resultrErNoSuchColumnError_string_or_unprintable)rr=r?raiseerrmap_resultrs rr6zResultMetaData._key_fallbacks| c4, - -! "XXT%8IccciikkJJFF Z5 6 6 "  #'#6NSZZCJ  )H$;C@@A%( tDI rcJ||jvrdS||ddduS)NTF)rr6rUs rrTzResultMetaData._has_keys1 $,  4%%c477tC Crc||jvr|j|\}}}n!||d|}|dS|\}}}|+tjt jd|zdt j|S)Nr4)from_)rr6rrErr<r^ itemgetter)rr=rr-rr>rets r_getterzResultMetaData._getters $,  $(L$5 !IsEE$$S$99C{t$' !IsE = K'57:;     "5)))rctd|jD|j|j|jdS)Nc3zK|]6\}\}}}t|tjtjz0||fV7dSr )r8rr int_types)r{r=r-rr>s r z.ResultMetaData.__getstate__..s_$$0C0)S%c4#4t~#EFF$e $$$$$$r)_pickled_keymapr}rr)rrr~r}rrr&s rr%zResultMetaData.__getstate__s[#$$48L4F4F4H4H$$$   I"1#3   rcdtt|dD|_ix|_}|dD] \}}dd|f||<|d|_|d|_|d|_dS)Ncg|]}dSr rOr{_s rr|z/ResultMetaData.__setstate__..sDDDQDDDDrr}rrr)ranger1rrr~r}rr)rr r!r=r>s rrzResultMetaData.__setstate__sED%E&M0B0B*C*CDDD "" v 1288:: . .JC u-F3KK&M #$45$%67rNT)rKrLrMrrNr"rrrrr classmethodrr6rTrr%rrOrrrrs Iwwwr}}}~(6(6(6T H H HDHHH,OOO["2222hDDD ****(     8 8 8 8 8rrcpeZdZdZeZdZdZdZdZ dZ dZ d&dZ dZ dZd Zejd Zed Zed Zed ZdZdZdZdZdZeZejdZdZdZedZ dZ!dZ"dZ#dZ$dZ%dZ&d'dZ'dZ(d'dZ)d Z*d!Z+d'd"Z,d#Z-d$Z.d%Z/dS)( ResultProxyaxA facade around a DBAPI cursor object. Returns database rows via the :class:`.RowProxy` class, which provides additional API features and behaviors on top of the raw data returned by the DBAPI. .. seealso:: :ref:`coretutorial_selecting` - introductory material for accessing :class:`_engine.ResultProxy` and :class:`.RowProxy` objects. NFc||_|j|_|jx|_|_|j|_|jjo|j|_| dSr ) rrcursor _saved_cursorroot_connection connection_echoengine_should_log_debug_init_metadata)rrs rr"zResultProxy.__init__si  +2>9 d(!1 O ! Hgn&F&F&H&H  rTc |jj}|||S#t$r }|d|cYd}~Sd}~wwxYwr ) _metadatarrF _non_result)rr=rgetterr?s rrzResultProxy._getter sk )^+F6#x(( ( / / /##D#.. . . . . . . /s  A?AAc |jj}||S#t$r }|d|cYd}~Sd}~wwxYwr )rrTrFr)rr=rxr?s rrTzResultProxy._has_keysg n-G73<<  / / /##D#.. . . . . . . /s  A>AAc|}||jjr]d|jjvrO|jjjr|jjj|_n.*s&#E#EQAaD#E#E#E#E#E#Er) _cursor_descriptionrcompiledexecution_options_cached_metadatarrrrloggerdebugr;)rrs rrzResultProxy._init_metadatas!5577  ) % J$ (FFF<(9A%)\%:%KDNN't-?@@ADN ->>"06H!I!Iz  #*00e#E#E2D#E#E#EEE * )  rc,|jr |jjSgS)zYReturn the list of string keys that would represented by each :class:`.RowProxy`.)rr}r&s rr}zResultProxy.keys-s > >& &Irc |jjS#t$r3}|j|dd|j|jYd}~dSd}~wwxYw)aReturn the 'rowcount' for this result. The 'rowcount' reports the number of rows *matched* by the WHERE criterion of an UPDATE or DELETE statement. .. note:: Notes regarding :attr:`_engine.ResultProxy.rowcount`: * This attribute returns the number of rows *matched*, which is not necessarily the same as the number of rows that were actually *modified* - an UPDATE statement, for example, may have no net change on a given row if the SET values given are the same as those present in the row already. Such a row would be matched but not modified. On backends that feature both styles, such as MySQL, rowcount is configured by default to return the match count in all cases. * :attr:`_engine.ResultProxy.rowcount` is *only* useful in conjunction with an UPDATE or DELETE statement. Contrary to what the Python DBAPI says, it does *not* return the number of rows available from the results of a SELECT statement as DBAPIs cannot support this functionality when rows are unbuffered. * :attr:`_engine.ResultProxy.rowcount` may not be fully implemented by all dialects. In particular, most DBAPIs do not support an aggregate rowcount result from an executemany call. The :meth:`_engine.ResultProxy.supports_sane_rowcount` and :meth:`_engine.ResultProxy.supports_sane_multi_rowcount` methods will report from the dialect if each usage is known to be supported. * Statements that use RETURNING may not return a correct rowcount. N)rrowcount BaseExceptionr_handle_dbapi_exceptionrrrIs rrzResultProxy.rowcount6syV <( (    O 3 34t{DL            A (AA c |jjS#t$r3}|j|dd|j|jYd}~dSd}~wwxYw)a/Return the 'lastrowid' accessor on the DBAPI cursor. This is a DBAPI specific method and is only functional for those backends which support it, for statements where it is appropriate. It's behavior is not consistent across backends. Usage of this method is normally unnecessary when using insert() expression constructs; the :attr:`~ResultProxy.inserted_primary_key` attribute provides a tuple of primary key values for a newly inserted row, regardless of database backend. N)r lastrowidrrrrrs rrzResultProxy.lastrowidhsz  %/ /    O 3 34t14<          rc|jduS)zTrue if this :class:`_engine.ResultProxy` returns rows. I.e. if it is legal to call the methods :meth:`_engine.ResultProxy.fetchone`, :meth:`_engine.ResultProxy.fetchmany` :meth:`_engine.ResultProxy.fetchall`. N)rr&s r returns_rowszResultProxy.returns_rowss~T))rc|jjS)akTrue if this :class:`_engine.ResultProxy` is the result of a executing an expression language compiled :func:`_expression.insert` construct. When True, this implies that the :attr:`inserted_primary_key` attribute is accessible, assuming the statement did not include a user defined "returning" construct. )risinsertr&s r is_insertzResultProxy.is_inserts|$$rc|jjS)z May be overridden by subclasses.)r descriptionr&s rrzResultProxy._cursor_descriptions!--rc|jrdSd|_|j}|j||jr|jd|_dS)azSoft close this :class:`_engine.ResultProxy`. This releases all DBAPI cursor resources, but leaves the ResultProxy "open" from a semantic perspective, meaning the fetchXXX() methods will continue to return empty results. This method is called automatically when: * all result rows are exhausted using the fetchXXX() methods. * cursor.description is None. This method is **not public**, but is documented in order to clarify the "autoclose" process used. .. versionadded:: 1.0.0 .. seealso:: :meth:`_engine.ResultProxy.close` NT) _soft_closedrr_safe_close_cursor_autoclose_connectionclose)rrs r _soft_closezResultProxy._soft_closesc.    F  **6222  % $ O ! ! # # # rcN|js|d|_dSdS)aClose this ResultProxy. This closes out the underlying DBAPI cursor corresponding to the statement execution, if one is still present. Note that the DBAPI cursor is automatically released when the :class:`_engine.ResultProxy` exhausts all available rows. :meth:`_engine.ResultProxy.close` is generally an optional method except in the case when discarding a :class:`_engine.ResultProxy` that still has additional rows pending for fetch. In the case of a result that is the product of :ref:`connectionless execution `, the underlying :class:`_engine.Connection` object is also closed, which :term:`releases` DBAPI connection resources. After this method is called, it is no longer valid to call upon the fetch methods, which will raise a :class:`.ResourceClosedError` on subsequent use. .. versionchanged:: 1.0.0 - the :meth:`_engine.ResultProxy.close` method has been separated out from the process that releases the underlying DBAPI cursor resource. The "auto close" feature of the :class:`_engine.Connection` now performs a so-called "soft close", which releases the underlying DBAPI cursor, but allows the :class:`_engine.ResultProxy` to still behave as an open-but-exhausted result set; the actual :meth:`_engine.ResultProxy.close` method is never called. It is still safe to discard a :class:`_engine.ResultProxy` that has been fully exhausted without calling this method. .. seealso:: :ref:`connections_toplevel` TN)closedr*r&s rr)zResultProxy.closes6X{       DKKK  rc#BK |}|dS|V)zImplement iteration protocol.TN)fetchonerrs rr/zResultProxy.__iter__s0 --//C{  rcN|}|t|S)zImplement the Python next() protocol. This method, mirrored as both ``.next()`` and ``.__next__()``, is part of Python's API for producing iterator-like behavior. .. versionadded:: 1.2 )r. StopIterationr/s r__next__zResultProxy.__next__s%mmoo ;// !Jrc|jjstjd|jjstjd|jjrtjd|jjS)aReturn the primary key for the row just inserted. The return value is a list of scalar values corresponding to the list of primary key columns in the target table. This only applies to single row :func:`_expression.insert` constructs which did not explicitly specify :meth:`_expression.Insert.returning`. Note that primary key columns which specify a server_default clause, or otherwise do not qualify as "autoincrement" columns (see the notes at :class:`_schema.Column`), and were generated using the database-side default, will appear in this list as ``None`` unless the backend supports "returning" and the insert statement executed with the "implicit returning" enabled. Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed statement is not a compiled expression construct or is not an insert() construct. 1Statement is not a compiled expression construct.2Statement is not an insert() expression construct.z9Can't call inserted_primary_key when returning() is used.)rrrr<r!_is_explicit_returninginserted_primary_keyr&s rr7z ResultProxy.inserted_primary_key s6|$ )F & )G \ 0 )  |00rc|jjstjd|jjstjd|jjr |jjS|jjdS)aReturn the collection of updated parameters from this execution. Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed statement is not a compiled expression construct or is not an update() construct. r4z2Statement is not an update() expression construct.r)rrrr<isupdate executemanycompiled_parametersr&s rlast_updated_paramszResultProxy.last_updated_params5z|$ 7)F & 7)G \ % 7<3 3<3A6 6rc|jjstjd|jjstjd|jjr |jjS|jjdS)aReturn the collection of inserted parameters from this execution. Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed statement is not a compiled expression construct or is not an insert() construct. r4r5r)rrrr<r!r:r;r&s rlast_inserted_paramsz ResultProxy.last_inserted_paramsKr=rc|jjS)aReturn the values of default columns that were fetched using the :meth:`.ValuesBase.return_defaults` feature. The value is an instance of :class:`.RowProxy`, or ``None`` if :meth:`.ValuesBase.return_defaults` was not used or if the backend does not support RETURNING. .. versionadded:: 0.9.0 .. seealso:: :meth:`.ValuesBase.return_defaults` )rreturned_defaultsr&s rrAzResultProxy.returned_defaultsas |--rc4|jS)zReturn ``lastrow_has_defaults()`` from the underlying :class:`.ExecutionContext`. See :class:`.ExecutionContext` for details. )rlastrow_has_defaultsr&s rrCz ResultProxy.lastrow_has_defaultsss|00222rc|jjstjd|jjs |jjstjd|jjS)aMReturn ``postfetch_cols()`` from the underlying :class:`.ExecutionContext`. See :class:`.ExecutionContext` for details. Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed statement is not a compiled expression construct or is not an insert() or update() construct. r4>Statement is not an insert() or update() expression construct.)rrrr<r!r9postfetch_colsr&s rrFzResultProxy.postfetch_cols}sk|$ )F & t|/D )( |**rc|jjstjd|jjs |jjstjd|jjS)aLReturn ``prefetch_cols()`` from the underlying :class:`.ExecutionContext`. See :class:`.ExecutionContext` for details. Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed statement is not a compiled expression construct or is not an insert() or update() construct. r4rE)rrrr<r!r9 prefetch_colsr&s rrHzResultProxy.prefetch_colssk|$ )F & t|/D )( |))rc|jjS)zReturn ``supports_sane_rowcount`` from the dialect. See :attr:`_engine.ResultProxy.rowcount` for background. )rsupports_sane_rowcountr&s rrJz"ResultProxy.supports_sane_rowcounts|22rc|jjS)zReturn ``supports_sane_multi_rowcount`` from the dialect. See :attr:`_engine.ResultProxy.rowcount` for background. )rsupports_sane_multi_rowcountr&s rrLz(ResultProxy.supports_sane_multi_rowcounts|88rc |jS#t$r }|d|cYd}~Sd}~wwxYwr )rr.rFrrr?s r_fetchone_implzResultProxy._fetchone_impls_ /;'')) ) / / /##D#.. . . . . . . / AAAAc ||jS|j|S#t$r }|g|cYd}~Sd}~wwxYwr )r fetchmanyrFr)rsizer?s r_fetchmany_implzResultProxy._fetchmany_implsz -|{,,...{,,T222 - - -##B,, , , , , , , -s77 A!AA!A!c |jS#t$r }|g|cYd}~Sd}~wwxYwr )rfetchallrFrrNs r_fetchall_implzResultProxy._fetchall_impls_ -;'')) ) - - -##B,, , , , , , , -rPc|j*tjtjd|dS|jr*tjtjd|dS|S)NzJThis result object does not return rows. It has been closed automatically.rCzThis result object is closed.)rrrErResourceClosedErrorr,)rdefaultr?s rrzResultProxy._non_results > ! K'8!$       [  K'(GHH #       Nrc .|j|jjj|jr^|jjjj}g}|D]A}|dtj || |B|Sfd|DS)NzRow %rc,g|]}|SrOrO)r{rr!metadata process_rowr s rr|z,ResultProxy.process_rows..s6CF Hc:v>>r) _process_rowrrrrrrrrrtrur:) rrowslogr@rr!r]r^r s @@@@r process_rowszResultProxy.process_rowss' >!) : ,%,2CA I IHh055666XsJGGHHHHHJN rc ||}||S#t$r3}|j|dd|j|jYd}~dSd}~wwxYw)aFetch all rows, just like DB-API ``cursor.fetchall()``. After all rows have been exhausted, the underlying DBAPI cursor resource is released, and the object may be safely discarded. Subsequent calls to :meth:`_engine.ResultProxy.fetchall` will return an empty list. After the :meth:`_engine.ResultProxy.close` method is called, the method will raise :class:`.ResourceClosedError`. :return: a list of :class:`.RowProxy` objects N)rbrWr*rrrrr)rr@rIs rrVzResultProxy.fetchalls !!$"5"5"7"788A      H    O 3 34t{DL          s !##D)) ) %%''CC    O 3 34t{DL           ((#//2 JJLLLL JJLLLLLDJJLLLLs 3 A/(A**A/3B<<CcB|}||dSdS)a)Fetch the first column of the first row, and close the result set. After calling this method, the object is fully closed, e.g. the :meth:`_engine.ResultProxy.close` method will have been called. :return: a Python scalar value , or None if no rows remain Nr)rhr/s rscalarzResultProxy.scalar_s$jjll ?q6M4rrr )0rKrLrMrrQr_out_parametersr(rr&r,r"rrTrr}rmemoized_propertyrpropertyrrr"rr*r)r/r2nextr7r<r?rArCrFrHrJrLrOrTrWrrbrVrRr.rhrjrOrrrrs  LN!IL F))))   ( ///bX, * *X * % %X %... @...`    D )1)1)1V777,777,..X."333+++.***.333999/// ------- ""0868rrc \eZdZdZfdZddddddd d d Zd Zfd ZdZddZ dZ xZ S)BufferedRowResultProxyaA ResultProxy with row buffering behavior. ``ResultProxy`` that buffers the contents of a selection of rows before ``fetchone()`` is called. This is to allow the results of ``cursor.description`` to be available immediately, when interfacing with a DB-API that requires rows to be consumed before this information is available (currently psycopg2, when used with server-side cursors). The pre-fetching behavior fetches only one row initially, and then grows its buffer size by a fixed amount with each successive need for additional rows up to a size of 1000. The size argument is configurable using the ``max_row_buffer`` execution option:: with psycopg2_engine.connect() as conn: result = conn.execution_options( stream_results=True, max_row_buffer=50 ).execute("select * from table") .. versionadded:: 1.0.6 Added the ``max_row_buffer`` option. .. seealso:: :ref:`psycopg2_execution_options` c|jjdd|_|t t |dS)Nmax_row_buffer)rrr_max_row_buffer$_BufferedRowResultProxy__buffer_rowsrrprrs rrz%BufferedRowResultProxy._init_metadatas\#|=AA d    $d++::<<<<>>>>***    rrpcFeZdZdZfdZdZfdZdZd dZdZ xZ S) FullyBufferedResultProxyzA result proxy that buffers rows fully upon creation. Used for operations where a result is to be delivered after the database conversation can not be continued, such as MSSQL INSERT...OUTPUT after an autocommit. ctt|||_dSr )rrr _buffer_rows$_FullyBufferedResultProxy__rowbufferrs rrz'FullyBufferedResultProxy._init_metadatas: &--<<>>>,,..rcXtj|jSr )r~rrrVr&s rrz%FullyBufferedResultProxy._buffer_rowss! !5!5!7!7888rc z|jtt|jdi|dSr)rrrrr*rs rr*z$FullyBufferedResultProxy._soft_closesB    9&--9??B?????rcl|jr|jS|dSr )rrrr&s rrOz'FullyBufferedResultProxy._fetchone_impls6   *#++-- -##D)) )rNc||Sg}td|D]/}|}|n||0|Srrrs rrTz(FullyBufferedResultProxy._fetchmany_implrrc||js|gS|j}tj|_|Sr )rrrr~rrs rrWz'FullyBufferedResultProxy._fetchall_impls>{ (##B'' '&,.. rr ) rKrLrMrrrr*rOrTrWrrs@rrrs/////999@@@@@***    rrceZdZfdZxZS)BufferedColumnRowct|}d}|jD]}||||||<|dz }t|}tt|||||dSr)r)rr;rrr")rrrr r!r>r-r$s rr"zBufferedColumnRow.__init__s3ii0  I$&Ys5z22E QJEECjj &&// CV     r)rKrLrMr"rrs@rrrs8          rrc4eZdZdZeZfdZdZddZxZ S)BufferedColumnResultProxyaA ResultProxy with column buffering behavior. ``ResultProxy`` that loads all columns into memory each time fetchone() is called. If fetchmany() or fetchall() are called, the full grid of results is fetched. This is to operate with databases where result rows contain "live" results that fall out of scope unless explicitly fetched. .. versionchanged:: 1.2 This :class:`_engine.ResultProxy` is not used by any SQLAlchemy-included dialects. cVtt||j}|jr|j|_dt t|jD|_i}|j D]\}\}}}d||f||<||_ dSdS)Ncg|]}dSr rOrs rr|z.'s#L#L#LQD#L#L#Lr) rrrrrrrr1r}rr~)rr]r!kfuncrr>r$s rrz(BufferedColumnResultProxy._init_metadatas '..==???>  $ ,)1(  --//C{ HHSMMM   rNc||Sg}t|D]/}|}|n||0|Sr )rVrr.r:)rrSr@irs rrRz#BufferedColumnResultProxy.fetchmany8s^ <==?? " t  A--//C{ HHSMMMMrr ) rKrLrMrrr_rrVrRrrs@rrr sl  %L&&&&&$           rr)rr~r^rrsqlrrrtsqlalchemy.cresultproxyr r ImportErrorrrobjectrQcollections_abcSequenceregisterrrrprrrrOrrrs"""""" DCCCCC 7777FJ444444 BJBJBJ!?J?J?J?J?Jv?J?J?J?J?JBJJ.....|...D  !**84444   D g8g8g8g8g8Vg8g8g8TC C C C C &C C C L[[[[[[[[[|*****{***Z          88888 88888s0 4??A A$#A$6BBB