zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
U
¸ý°d +ã    @sUdZddlmZddlZddlZddlZddlZddlmZddlmZddlm    Z    ddlm
Z
ddlm Z dd    lm Z dd
lm Z dd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl!m#Z#ddl!m Z$ddl%m&Z&dd l'm(Z(dd!l'm)Z)dd"l'm*Z*dd#l'm+Z+dd$l'm,Z,dd%l-m.Z.dd&l m/Z/dd'l0m1Z1dd(l0m2Z2ejr†dd)l3m4Z4dd*l5m6Z6dd+l7m8Z8dd,l7m9Z9dd-l7m:Z:dd.l7m;Z;dd/lm<Z<dd0lm=Z=dd1lm>Z>dd2lm?Z?dd3lm@Z@dd4lmAZAdd5l-mBZBed6ed7ZCdZDd8eEd9<dZFd:eEd;<dZGd<eEd=<d>ZHd?eEd@<dAZIdBeEdC<dDZJdEeEdF<dGZKdHeEdI<eeeLeLe eeMeMedJeeMfZNe dKeNfZOeeLeLe eeMeMedJeMfZPGdLdM„dMeƒZQGdNdO„dOƒZRGdPdQ„dQeRƒZSGdRdS„dSeSƒZTeTƒZUGdTdU„dUeSƒZVeVƒZWGdVdW„dWeRƒZXeXƒZYGdXdY„dYeXƒZZGdZd[„d[eXƒZ[Gd\d]„d]eƒZ\e\ƒZ]d^d_œd`da„Z^Gdbdc„dceeCƒZ_e_Z`dS)dzNDefine cursor-specific result set constructs including
:class:`.CursorResult`.é)Ú annotationsN)ÚAny)Úcast)ÚClassVar)ÚDict)ÚIterator)ÚList)ÚMapping)ÚNoReturn)ÚOptional)ÚSequence)ÚTuple)Ú TYPE_CHECKING)ÚTypeVar)ÚUnioné)ÚIteratorResult)Ú MergedResult)ÚResult)ÚResultMetaData)ÚSimpleResultMetaData)Ú tuplegetter)ÚRowé)Úexc)Úutil)Úelements)Úsqltypes)Ú _generative)ÚResultColumnsEntry)ÚRM_NAME)Ú
RM_OBJECTS)ÚRM_RENDERED_NAME)ÚRM_TYPE)Ú
TypeEngine)Úcompat)ÚLiteral)ÚSelf)Ú
Connection)ÚDefaultExecutionContext)Ú_DBAPICursorDescription)Ú DBAPICursor)ÚDialect)ÚExecutionContext)Ú _KeyIndexType)Ú_KeyMapRecType)Ú _KeyMapType)Ú_KeyType)Ú_ProcessorsType)Ú_TupleGetterType)Ú_ResultProcessorTypeÚ_T)Úboundz
Literal[0]ÚMD_INDEXz
Literal[1]ÚMD_RESULT_MAP_INDEXz
Literal[2]Ú
MD_OBJECTSéz
Literal[3]Ú MD_LOOKUP_KEYéz
Literal[4]ÚMD_RENDERED_NAMEéz
Literal[5]Ú MD_PROCESSORéz
Literal[6]ÚMD_UNTRANSLATEDr4r1c
@s|eZdZUdZdZded<ded<ded<d    ed
<d    ed <d ed <dZded<dd    dœdd„Zddœdd„Zd    ddddd d    dddœ    dd„Z    ddœdd „Z
ddd!œd"d#„Z d$dd%œd&d'„Z d(dd)œd*d+„Z d,d-d.œd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„ZedWd:d    d;d<œd=d>„ƒZd?d@„Zes4dXddAd    dBdCœdDdE„ZdFdG„ZdYdd    dHdIœdJdK„ZdLdM„ZdNdOd%œdPdQ„ZdRdS„ZdTdU„ZdVS)ZÚCursorResultMetaDataz"Result metadata for DBAPI cursors.)    Ú_keymapÚ _processorsÚ_keysÚ_keymap_by_result_column_idxÚ _tuplefilterÚ_translated_indexesÚ_safe_for_cacheÚ
_unpickledÚ _key_to_indexÚ_CursorKeyMapTyperCr2rDz#Optional[Dict[int, _KeyMapRecType]]rFÚboolrJrIzOptional[List[int]]rHTzClassVar[bool]Ú returns_rowsr)ÚkeyÚreturncCs
||jkS©N©rC©ÚselfrO©rUúOd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/engine/cursor.pyÚ_has_key¨szCursorResultMetaData._has_keyr©rPcstˆj‡fdd„ˆjDƒdS)Ncsg|]}ˆj|t‘qSrU)rCr9©Ú.0rO©rTrUrVÚ
<listcomp>®sz4CursorResultMetaData._for_freeze.<locals>.<listcomp>)Úextra)rrEr[rUr[rVÚ _for_freeze«sþz CursorResultMetaData._for_freezez Sequence[str]r0zOptional[_TupleGetterType])    Ú    unpickledÚ
processorsÚkeysÚkeymapÚ tuplefilterÚtranslated_indexesÚsafe_for_cacheÚkeymap_by_result_column_idxrPc
CsP|j |j¡}    ||    _||    _||    _||    _||    _||    _||    _||    _    | 
|t ¡|    _ |    SrQ) Ú    __class__Ú__new__rJrDrErCrGrHrIrFÚ_make_key_to_indexr7rK)
rTr_r`rarbrcrdrerfZnew_objrUrUrVÚ_make_new_metadata±s z'CursorResultMetaData._make_new_metadatac
CsH|jr
t‚|j|jdgt|jƒdddd„|j ¡Dƒ|j|j    |j
dS)NcSs.i|]&\}}||dd…d|dd…“qS)rr>rQr@NrU©rZrOÚvaluerUrUrVÚ
<dictcomp>Ðsÿz;CursorResultMetaData._remove_processors.<locals>.<dictcomp>)r_r`rcrdrbrarerf) rGÚAssertionErrorrjrJÚlenrDrCÚitemsrErIrFr[rUrUrVÚ_remove_processorsÉs
þõz'CursorResultMetaData._remove_processors)ÚotherrPc sz|jr
t‚t|jƒ‰t|jƒ‰ˆ ‡‡fdd„|j ¡Dƒ¡|j|j    |j
|j
dd|j|jˆ|j dd„ˆ  ¡DƒdS)NcsNi|]F\}}||ddk    r.|ˆkr.|dˆnd|dˆf|dd…˜“qS)rNrrrUrk©rbÚoffsetrUrVrmâs    ø
ÿÿ
û
úz=CursorResultMetaData._splice_horizontally.<locals>.<dictcomp>cSsi|]}|t|“qSrU©r8©rZÚmetadata_entryrUrUrVrmösÿ)r_r`rcrdrarbrerf) rGrnÚdictrCrorEÚupdaterprjrJrDrIÚvalues)rTrrrUrsrVÚ_splice_horizontallyÙs(
 
 
     ÷ÿ 
 
þøz)CursorResultMetaData._splice_horizontallyzSequence[_KeyIndexType])rarPc
s tˆ |¡ƒ}dd„|Dƒ}dd„|Dƒ}ˆjrB‡fdd„|Dƒ}t|Ž}dd„t|ƒDƒ}dd„|Dƒ}| dd    „|Dƒ¡ˆjˆjˆj||||ˆj    ˆj
d
S) NcSsg|] }|t‘qSrU)r7©rZÚrecrUrUrVr\ÿsz0CursorResultMetaData._reduce.<locals>.<listcomp>cSsg|] }|t‘qSrU©r;r|rUrUrVr\scsg|]}ˆj|‘qSrU)rH)rZÚidxr[rUrVr\scSs"g|]\}}|f|dd…‘qS©rNrU)rZÚindexr}rUrUrVr\scSsi|]}|t|“qSrUr~r|rUrUrVrmsz0CursorResultMetaData._reduce.<locals>.<dictcomp>css(|] }|tpdD]}||fVqqdS)rUN©r9)rZZnew_recÚerUrUrVÚ    <genexpr> sþz/CursorResultMetaData._reduce.<locals>.<genexpr>)r_r`rarcrdrbrerf) ÚlistÚ_metadata_for_keysrHrÚ    enumerateryrjrJrDrIrF)rTraZrecsZindexesZnew_keysÚtupZnew_recsrbrUr[rVÚ_reduceüs*
þøzCursorResultMetaData._reducer-)ÚcontextrPc
sÀ|jr|jjs|S|jj}|j}tr4t|tjƒs4t‚||kr@|S|dk    sLt‚|j    ‰ˆdkrtdd„|j
  ¡Dƒ‰|_    |j r~t‚|j t |j
‡fdd„t|jƒDƒ¡|j|jdd|j|j|j    dS)a[When using a cached Compiled construct that has a _result_map,
        for a new statement that used the cached Compiled, we need to ensure
        the keymap has the Column objects from our new statement as keys.
        So here we rewrite keymap with new entries for the new columns
        as matched to those of the cached statement.
 
        NcSsi|]}|t|“qSrUrurvrUrUrVrm@sÿz:CursorResultMetaData._adapt_to_context.<locals>.<dictcomp>cs"i|]\}}|ˆkr|ˆ|“qSrUrU)rZrÚnew©Zkeymap_by_positionrUrVrmIsü)rbr_r`rcrdrarerf)ÚcompiledÚ_result_columnsÚ    statementÚinvoked_statementrÚ
isinstancerZ ClauseElementrnrFrCrzrGrjr%Z
dict_unionr‡Z_all_selected_columnsrJrDrErI)rTrŠZcompiled_statementrrUrŒrVÚ_adapt_to_contexts@    
þ 
 
ÿþþ
ïz&CursorResultMetaData._adapt_to_contextúCursorResult[Any]r*)ÚparentÚcursor_descriptionc
sŒ|j}dˆ_dˆ_dˆ_ˆ_|jr>|j\}}}}}t|ƒ}    nd}}}    }}}ˆ ||||    ||||¡}
dd„|
Dƒˆ_dˆ_    |    r@dd„|
Dƒ} t| ƒ|    kr"i} t
ƒ‰|
D]B} | t f| t pÊdD]&}| t }|  ||¡|krΈ |¡qÎq´‡fdd„|
Dƒˆ_|  dd„ˆDƒ¡nd    d„|
Dƒˆ_ˆj | ¡nd
d„|
Dƒˆ_|    sx|jrxˆj ‡fd d„|
Dƒ¡ˆ ˆjt ¡ˆ_dS) NFcSsg|] }|t‘qSrU)r?rvrUrUrVr\…sz1CursorResultMetaData.__init__.<locals>.<listcomp>cSsi|]}|t|“qSrUr~rvrUrUrVrm”sÿz1CursorResultMetaData.__init__.<locals>.<dictcomp>rUcs0i|](}|tr|tD]}|ˆkr||“qqSrUr‚©rZrwZobj_elem)ÚdupesrUrVrm¶s
üc
Ss i|]}|ddg||ddf“qSrQrUrYrUrUrVrmÁsÿcSs(i|] }|tr|tD]
}||“qqSrUr‚r–rUrUrVrmÍs 
ýcSsi|]}|t|“qSrUr~rvrUrUrVrmØsÿcs(i|] }|tr|tˆj|t“qSrU)rArCr;rvr[rUrVrmçs üÿ)rŠrGrHrIrJZresult_column_structroÚ_merge_cursor_descriptionrDrFÚsetr=r9r7Ú
setdefaultÚaddrCryÚ_translate_colnamerirK)rTr”r•rŠÚresult_columnsÚcols_are_orderedÚtextual_orderedÚad_hoc_textualÚloose_column_name_matchingÚ num_ctx_colsÚrawÚby_keyZ index_by_keyrwrOrrU)r—rTrVÚ__init__Zs’ ú
úÿýûø ÿþ
ÿ
þ
þÿ þþ 
üÿ
zCursorResultMetaData.__init__c    
s´|rF|rF|sF|tˆƒkrFdd„|Dƒ|_d|_‡‡fdd„t|ƒDƒS|sZ|rptˆƒ|krpd|_| ˆˆ|¡}    n.|rŒd|_| ˆˆ||¡}    nd|_| ˆˆ¡}    ‡fdd„|    DƒSdS)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:`_expression.TextualSelect` 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 the 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:`_expression.TextualSelect` 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.
 
        cSsg|] }|d‘qS©rrU)rZÚelemrUrUrVr\:szBCursorResultMetaData._merge_cursor_description.<locals>.<listcomp>Tc sHg|]@\}}|||t|t|tˆ |t|tˆ|d¡df‘qSr€)r!r r"Úget_result_processorr#)rZrZ
rmap_entry©rŠr•rUrVr\Csô
ýõFc s6g|].\}}}}}}}|||||ˆ |||¡|f‘qSrU)r¨)rZrÚridxZcursor_colnameÚ mapped_typeÚcoltypeÚobjÚ untranslated)rŠrUrVr\ts( ïÿ÷N)rorErIr‡Ú_merge_textual_cols_by_positionÚ_merge_cols_by_nameÚ_merge_cols_by_none)
rTrŠr•rr¢ržrŸr r¡Z raw_iteratorrUr©rVr˜òsPCÿþý
ü òÿ
ÿÿü    ÿ
ìz.CursorResultMetaData._merge_cursor_descriptionc cs‚|j}|j}|jr|jnd}d}g|_t|ƒD]N\}}|d}    |d}
|rV||    ƒ\}    }|rb||    ƒ}    |j |    ¡||    ||
fVq.dS)zÖExtract 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)ÚdialectrœZrequires_name_normalizeÚnormalize_namerEr‡Úappend) rTrŠr•r²Ztranslate_colnamer³r®rr}Úcolnamer¬rUrUrVÚ_colnames_from_description‹sÿ  z/CursorResultMetaData._colnames_from_descriptionccsÂt|ƒ}|t|ƒkr*t d|t|ƒf¡tƒ}| ||¡D]€\}}}}    ||krš||}
|
t} |} |
t} | d|krŠt d| d¡‚|     | d¡nt
j } d} d} || || |    | |fVq<dS)NzVNumber of columns in textual SQL (%d) is smaller than number of columns requested (%d)rz8Duplicate column expression requested in textual SQL: %r) rorÚwarnr™r¶r!r#rÚInvalidRequestErrorr›rÚNULLTYPE)rTrŠr•rr¢Úseenrrµr®r¬Úctx_recr­rªr«rUrUrVr¯ªs< 
þÿ
û ÿÿz4CursorResultMetaData._merge_textual_cols_by_positionc    cs†| ||¡}| ||¡D]h\}}}}    z ||}
Wn"tk
rRtj} d} d} YnX|
d} |
d} |
d} || || |    | |fVqdS)Nrrr:)Ú_create_description_match_mapr¶ÚKeyErrorrr¹)rTrŠr•rr¡Z    match_maprrµr®r¬r»r«r­Zresult_columns_idxrUrUrVr°Ís6ÿ
 
û 
ùz(CursorResultMetaData._merge_cols_by_nameFzList[ResultColumnsEntry]zKDict[Union[str, object], Tuple[str, Tuple[Any, ...], TypeEngine[Any], int]])rr¡rPc     Cs¢i}t|ƒD]\}}|t}||krN||\}}}    }
|||t|    |f||<n|t|t|t|f||<|r |tD]$} | | |t|t|t|f¡qvq |S)zÚwhen matching cursor.description to a set of names that are present
        in a Compiled object, as is the case with TextualSelect, get all the
        names we expect might match those in cursor.description.
        )r‡r"r!r r#rš) Úclsrr¡Údrªr§rOZe_nameZe_objÚe_typeZe_ridxZr_keyrUrUrVr¼ósý þz2CursorResultMetaData._create_description_match_mapccs4| ||¡D]"\}}}}|d|tj|d|fVq dSrQ)r¶rr¹)rTrŠr•rrµr®r¬rUrUrVr±s
ûùz(CursorResultMetaData._merge_cols_by_nonezOptional[Exception]zOptional[NoReturn])rOÚerrÚraiseerrrPcCsD|r<|jr$t|tjƒr$t d¡|‚q@t dt |¡¡|‚ndSdS)Nz9Row was unpickled; lookup by ColumnElement is unsupportedz.Could not locate column in row for column '%s')rJr‘rZ ColumnElementrZNoSuchColumnErrorrZstring_or_unprintable)rTrOrÁrÂrUrUrVÚ _key_fallback0sÿýÿÿýz"CursorResultMetaData._key_fallbackcCst d|t¡‚dS)Nz<Ambiguous column name '%s' in result set column descriptions)rr¸r;)rTr}rUrUrVÚ _raise_for_ambiguous_column_nameBs
ÿÿz5CursorResultMetaData._raise_for_ambiguous_column_nameú Optional[int])rOrÂrPc
Cs„t|tƒr|j|}z|j|}WnBtk
rd}z$| |||¡}|dksNt‚WY¢dSd}~XYnX|d}|dkr€| |¡|S©Nr)r‘ÚintrErCr½rÃrnrÄ)rTrOrÂr}ÚkeÚxrrUrUrVÚ_index_for_keyHs
 
 
z#CursorResultMetaData._index_for_keyc
sPz‡fdd„|DƒWStk
rJ}zt ˆ|jd|¡W5d}~XYnXdS)Ncsg|]}ˆj|d‘qSr¦rRrYr[rUrVr\^sz:CursorResultMetaData._indexes_for_keys.<locals>.<listcomp>r)r½rBrÃÚargs)rTrarÈrUr[rVÚ_indexes_for_keys[sz&CursorResultMetaData._indexes_for_keysz Sequence[Any]z&Iterator[_NonAmbigCursorKeyMapRecType]c cs|D]†}t|jjkr|j|}z|j|}Wn6tk
rb}zt ||jd|¡W5d}~XYnX|t    }|dkr~| 
|¡t t |ƒVqdSrÆ) rÇrgÚ__mro__rErCr½rBrÃrËr7rÄrÚ_NonAmbigCursorKeyMapRecType)rTrarOr}rÈrrUrUrVr†cs 
&
z'CursorResultMetaData._metadata_for_keyscCs dd„|j ¡Dƒ|j|jdœS)Nc
Ss>i|]6\}}t|ttfƒr||t|tg||tddf“qSrQ)r‘ÚstrrÇr7r8r=)rZrOr}rUrUrVrmzs
öùz5CursorResultMetaData.__getstate__.<locals>.<dictcomp>)rCrErH)rCrprErHr[rUrUrVÚ __getstate__ws 
ö ñz!CursorResultMetaData.__getstate__cCs‚dd„tt|dƒƒDƒ|_|d|_d|_| |jt¡|_|d|_d|_    |drrt
d|dƒ|_ t |j Ž|_ n d|_ |_ dS)NcSsg|]}d‘qSrQrU)rZÚ_rUrUrVr\Œsz5CursorResultMetaData.__setstate__.<locals>.<listcomp>rErCTrHz    List[int])ÚrangerorDrCrFrir7rKrErJrrHrrG)rTÚstaterUrUrVÚ __setstate__‹s
 
ÿz!CursorResultMetaData.__setstate__N)F)T)T)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú    __slots__Ú__annotations__rNrWr^rjrqr{r‰r’r¥r˜r¶r¯r°Ú classmethodr¼r±rrÃrÄrÊrÌr†rÐrÔrUrUrUrVrBŽsH
 # >#&ý)ÿrBc@s¬eZdZUdZdZdZded<dddd    œd
d „Zdddd    œd d „Zdddddœdd„Z    d$dddddœdd„Z
d%dddddœdd„Z dddd    œdd„Z dddd d!œd"d#„Z dS)&ÚResultFetchStrategyzQDefine a fetching strategy for a result object.
 
 
    .. versionadded:: 1.4
 
    rUNú!Optional[_DBAPICursorDescription]Úalternate_cursor_descriptionr“úOptional[DBAPICursor]ÚNone©ÚresultÚ dbapi_cursorrPcCs
tƒ‚dSrQ©ÚNotImplementedError©rTrârãrUrUrVÚ
soft_close§szResultFetchStrategy.soft_closecCs
tƒ‚dSrQrärærUrUrVÚ
hard_close¬szResultFetchStrategy.hard_closerÇ©rârãÚnumrPcCsdSrQrU©rTrârãrêrUrUrVÚ    yield_per±szResultFetchStrategy.yield_perFr+rMr©rârãrèrPcCs
tƒ‚dSrQrä©rTrârãrèrUrUrVÚfetchone¹szResultFetchStrategy.fetchonerÅ©rârãÚsizerPcCs
tƒ‚dSrQrä©rTrârãrñrUrUrVÚ    fetchmanyÁszResultFetchStrategy.fetchmanycCs
tƒ‚dSrQrärærUrUrVÚfetchallÉszResultFetchStrategy.fetchallÚ BaseExceptionr
©rârãrÁrPcCs|‚dSrQrU©rTrârãrÁrUrUrVÚhandle_exceptionÐsz$ResultFetchStrategy.handle_exception)F)N)rÕrÖr×rØrÙrÞrÚrçrèrìrïrórôrørUrUrUrVrܛs
  ü ürÜc@sJeZdZdZdZdd„Zdd„Zddd    „Zdd d „Zd d„Z    ddd„Z
d
S)ÚNoCursorFetchStrategyzèCursor strategy for a result that has no open cursor.
 
    There are two varieties of this strategy, one for DQL and one for
    DML (and also DDL), each of which represent a result that had a cursor
    but no longer has one.
 
    rUcCsdSrQrUrærUrUrVrçäsz NoCursorFetchStrategy.soft_closecCsdSrQrUrærUrUrVrèçsz NoCursorFetchStrategy.hard_closeFcCs | |d¡SrQ©Ú _non_resultrîrUrUrVrïêszNoCursorFetchStrategy.fetchoneNcCs | |g¡SrQrúròrUrUrVróíszNoCursorFetchStrategy.fetchmanycCs | |g¡SrQrúrærUrUrVrôðszNoCursorFetchStrategy.fetchallcCs
tƒ‚dSrQrä©rTrâÚdefaultrÁrUrUrVrûósz!NoCursorFetchStrategy._non_result)F)N)N) rÕrÖr×rØrÙrçrèrïrórôrûrUrUrUrVrùÙs
 
rùc@seZdZdZdZddd„ZdS)ÚNoCursorDQLFetchStrategya°Cursor strategy for a DQL result that has no open cursor.
 
    This is a result set that can return rows, i.e. for a SELECT, or for an
    INSERT, UPDATE, DELETE that includes RETURNING. However it is in the state
    where the cursor is closed and no rows remain available.  The owning result
    object may or may not be "hard closed", which determines if the fetch
    methods send empty results or raise for closed result.
 
    rUNcCs|jrt d¡|‚n|SdS)NzThis result object is closed.)ÚclosedrÚResourceClosedErrorrürUrUrVrûsÿþz$NoCursorDQLFetchStrategy._non_result)N©rÕrÖr×rØrÙrûrUrUrUrVrþ÷s
rþc@seZdZdZdZddd„ZdS)ÚNoCursorDMLFetchStrategyz¼Cursor strategy for a DML result that has no open cursor.
 
    This is a result set that does not return rows, i.e. for an INSERT,
    UPDATE, DELETE that does not include RETURNING.
 
    rUNcCs|jjr t‚|j |¡dSrQ)Ú    _metadatarNrnÚ_we_dont_return_rowsrürUrUrVrûs z$NoCursorDMLFetchStrategy._non_result)NrrUrUrUrVrsrc@sžeZdZdZdZddddœdd„Zddddœd    d
„Zddd d d œdd„Zdddddœdd„Zd"dddddœdd„Z    d#dddddœdd„Z
ddddœd d!„Z dS)$ÚCursorFetchStrategyz›Call fetch methods from a DBAPI cursor.
 
    Alternate versions of this class may instead buffer the rows from
    cursors or not use cursors at all.
 
    rUr“rßràrácCs
t|_dSrQ©Ú_NO_CURSOR_DQLÚcursor_strategyrærUrUrVrç-szCursorFetchStrategy.soft_closecCs
t|_dSrQrrærUrUrVrè2szCursorFetchStrategy.hard_closerõr
röcCs|j |dd||j¡dSrQ)Ú
connectionZ_handle_dbapi_exceptionrŠr÷rUrUrVrø7sÿz$CursorFetchStrategy.handle_exceptionrÇrécCst|d|it ¡dd|_dS)NÚmax_row_bufferr)Úinitial_bufferÚ growth_factor)ÚBufferedRowCursorFetchStrategyÚ collectionsÚdequerrërUrUrVrìAs üzCursorFetchStrategy.yield_perFr+rMrríc
CsXz"| ¡}|dkr|j|d|WStk
rR}z| |||¡W5d}~XYnXdS©N©Úhard)rïÚ _soft_closerõrø)rTrârãrèÚrowrƒrUrUrVrïNs zCursorFetchStrategy.fetchoneNrÅrðc
Csdz.|dkr| ¡}n
| |¡}|s*| ¡|WStk
r^}z| |||¡W5d}~XYnXdSrQ)rórrõrø)rTrârãrñÚlrƒrUrUrVró\s
 
zCursorFetchStrategy.fetchmanyc
CsLz| ¡}| ¡|WStk
rF}z| |||¡W5d}~XYnXdSrQ)rôrrõrø)rTrârãÚrowsrƒrUrUrVrôns zCursorFetchStrategy.fetchall)F)N) rÕrÖr×rØrÙrçrèrørìrïrórôrUrUrUrVr#s
üürcsreZdZdZdZddd„Zedd„ƒZd    d
„Zd d „Z    ‡fd d„Z
‡fdd„Z ddd„Z ddd„Z dd„Z‡ZS)r a×A cursor fetch strategy with row buffering behavior.
 
    This strategy 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 the ``max_row_buffer`` size, which defaults
    to 1000::
 
        with psycopg2_engine.connect() as conn:
 
            result = conn.execution_options(
                stream_results=True, max_row_buffer=50
                ).execute(text("select * from table"))
 
    .. versionadded:: 1.4 ``max_row_buffer`` may now exceed 1000 rows.
 
    .. seealso::
 
        :ref:`psycopg2_execution_options`
    )Ú_max_row_bufferÚ
_rowbufferÚ_bufsizeÚ_growth_factorr>NcCsX| dd¡|_|dk    r||_nt | d¡¡|_||_|rLt|j|jƒ|_n|j|_dS)Nr
ièr)    ÚgetrrrrrórÚminr)rTrãÚexecution_optionsr r rUrUrVr¥œsz'BufferedRowCursorFetchStrategy.__init__cCst|j|jjƒSrQ)r ÚcursorrŠr)r¾rârUrUrVÚcreate°sþz%BufferedRowCursorFetchStrategy.createc
Cs”|j}z |dkr| ¡}n
| |¡}Wn0tk
rV}z| |||¡W5d}~XYnX|s`dSt |¡|_|jr||j    krt
|j    ||jƒ|_dS)z*this is currently used only by fetchone().rN) rrôrórõrørrrrrr)rTrârãrñZnew_rowsrƒrUrUrVÚ _buffer_rows·s
  ÿz+BufferedRowCursorFetchStrategy._buffer_rowscCsd|_||_|_dSrÆ)rrrrërUrUrVrìËsz(BufferedRowCursorFetchStrategy.yield_percs|j ¡tƒ ||¡dSrQ©rÚclearÚsuperrçræ©rgrUrVrçÏs
z)BufferedRowCursorFetchStrategy.soft_closecs|j ¡tƒ ||¡dSrQ©rr"r#rèrær$rUrVrèÓs
z)BufferedRowCursorFetchStrategy.hard_closeFc
Csh|js^| ||¡|js^z|j|dWn0tk
rX}z| |||¡W5d}~XYnXdS|j ¡Sr)rr rrõrøÚpopleft)rTrârãrèrƒrUrUrVrï×s  z'BufferedRowCursorFetchStrategy.fetchonec
Cs®|dkr| ||¡St|jƒ}t|ƒ}||krŠz| ||¡}Wn0tk
rp}z| |||¡W5d}~XYnX|s€| ¡n
| |¡|d|…}t     
||d…¡|_|SrÆ) rôr…rrorórõrørÚextendrr)rTrârãrñÚbufZlbr‹rƒrUrUrVróâs 
 
 
 z(BufferedRowCursorFetchStrategy.fetchmanyc
Csdz.t|jƒt| ¡ƒ}|j ¡| ¡|WStk
r^}z| |||¡W5d}~XYnXdSrQ)r…rrôr"rrõrø)rTrârãÚretrƒrUrUrVrô÷s
z'BufferedRowCursorFetchStrategy.fetchall)r>N)F)N)rÕrÖr×rØrÙr¥rÛrr rìrçrèrïrórôÚ __classcell__rUrUr$rVr ~sû
 
 
 
r cs^eZdZdZdZddd„Zdd„Z‡fdd    „Z‡fd
d „Zdd d„Z    ddd„Z
dd„Z ‡Z S)Ú FullyBufferedCursorFetchStrategyzêA cursor strategy 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.
 
    )rrÞNcCs0||_|dk    rt |¡|_nt | ¡¡|_dSrQ)rÞrrrrô)rTrãZalternate_descriptionr rUrUrVr¥ sz)FullyBufferedCursorFetchStrategy.__init__cCsdSrQrUrërUrUrVrìsz*FullyBufferedCursorFetchStrategy.yield_percs|j ¡tƒ ||¡dSrQr!rær$rUrVrçs
z+FullyBufferedCursorFetchStrategy.soft_closecs|j ¡tƒ ||¡dSrQr%rær$rUrVrès
z+FullyBufferedCursorFetchStrategy.hard_closeFcCs$|jr|j ¡S|j|ddSdSr)rr&rrîrUrUrVrï s
 z)FullyBufferedCursorFetchStrategy.fetchonecCsN|dkr| ||¡St|jƒ}|d|…}t ||d…¡|_|sJ| ¡|SrÆ)rôr…rrrr)rTrârãrñr(rrUrUrVró's 
 z*FullyBufferedCursorFetchStrategy.fetchmanycCs|j}t ¡|_| ¡|SrQ)rrrr)rTrârãr)rUrUrVrô2s
z)FullyBufferedCursorFetchStrategy.fetchall)NN)F)N) rÕrÖr×rØrÙr¥rìrçrèrïrórôr*rUrUr$rVr+sÿ
      
 
r+c@sfeZdZdZdZddd„Zdd„Zdd    „Zd
d „Ze    d d „ƒZ
e    dd„ƒZ e    dd„ƒZ e    dd„ƒZ dS)Ú_NoResultMetaDatarUFNcCst d¡|‚dS)NzJThis result object does not return rows. It has been closed automatically.)rr)rTrÁrUrUrVr>s
ÿýz&_NoResultMetaData._we_dont_return_rowscCs | ¡dSrQ©r)rTrarÂrUrUrVrÊDsz _NoResultMetaData._index_for_keycCs | ¡dSrQr-rSrUrUrVr†Gsz$_NoResultMetaData._metadata_for_keyscCs | ¡dSrQr-)rTrarUrUrVr‰Jsz_NoResultMetaData._reducecCs | ¡dSrQr-r[rUrUrVrCMsz_NoResultMetaData._keymapcCs | ¡dSrQr-r[rUrUrVrKQsz_NoResultMetaData._key_to_indexcCs | ¡dSrQr-r[rUrUrVrDUsz_NoResultMetaData._processorscCs | ¡dSrQr-r[rUrUrVraYsz_NoResultMetaData.keys)N)rÕrÖr×rÙrNrrÊr†r‰ÚpropertyrCrKrDrarUrUrUrVr,9s
 
 
 
r,zIteratorResult[Any]rXcCsttƒtgƒƒ}| ¡|SrQ)rr,Úiterr)ÚitrUrUrVÚnull_dml_resultasr1cs eZdZUdZdZded<eZdZded<dZ    ded<d    Z
d
ed <d ed <ded<ded<d
dddœdd„Z dd„Z dWdd„Z edd„ƒZedd„ƒZdd„Zd d!„Zed"d#„ƒZd$d%„Zd&d'„Zd(d)„Zed*d+„ƒZd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„Zejd6d7œd8d9„ƒZed:d;„ƒZ ed<d=„ƒZ!ed>d?„ƒZ"d@dA„Z#dXdBdC„Z$dDdE„Z%dYdGdH„Z&dIdJ„Z'dKdLdMœ‡fdNdO„ Z(dPd7œdQdR„Z)e*d6dSdTœdUdV„ƒZ+‡Z,S)ZÚ CursorResulta+A Result that is representing state from a DBAPI cursor.
 
    .. versionchanged:: 1.4  The :class:`.CursorResult``
       class replaces the previous :class:`.ResultProxy` interface.
       This classes are based on the :class:`.Result` calling API
       which provides an updated usage model and calling facade for
       SQLAlchemy Core and SQLAlchemy ORM.
 
    Returns database rows via the :class:`.Row` class, which provides
    additional API features and behaviors on top of the raw data returned by
    the DBAPI.   Through the use of filters such as the :meth:`.Result.scalars`
    method, other kinds of objects may also be returned.
 
    .. seealso::
 
        :ref:`tutorial_selecting_data` - introductory material for accessing
        :class:`_engine.CursorResult` and :class:`.Row` objects.
 
    )rŠr²rrÚ_echor    z.Union[CursorResultMetaData, _NoResultMetaData]rFrMÚ _soft_closedrÿTr)rŠr,r²rÜrr(r    rÝ)rŠrr•c    sô||_|j|_|j|_||_|j|_|jjo4|j ¡|_}|dk    rÚ|     ||¡}t
  t ||j |j¡‰|jrt t|j ƒ¡‰‡‡fdd„}|‰nˆ‰|rÈ|jjj‰‡fdd„‰ˆ|_‡‡fdd„}|}nˆ}| d|¡n|jdksèt‚|j|_dS)    Ncs ˆˆ|ƒƒSrQrU)Úraw_data)Ú    _make_rowÚsentinel_filterrUrVÚ _sliced_row²sz*CursorResult.__init__.<locals>._sliced_rowcsˆdt |¡ƒ|S)NzRow %r)Úsql_utilZ    _repr_row©r)ÚlogrUrVÚ_log_row¼sz'CursorResult.__init__.<locals>._log_rowcs ˆˆ|ƒƒSrQrUr:)r<Ú
sliced_rowrUrVÚ _make_row_2Âsz*CursorResult.__init__.<locals>._make_row_2Z _row_getterr)rŠr²rrZroot_connectionr    r3ZengineZ_should_log_debugÚ_init_metadataÚ    functoolsÚpartialrZ_effective_processorsrKZ_num_sentinel_colsÚoperatorÚ
itemgetterÚsliceÚ
_log_debugZ_row_logging_fnZ_set_memoized_attributernÚ_no_result_metadatar)    rTrŠrr•ZechoÚmetadatar8r>Zmake_rowrU)r<r6r;r7r=rVr¥s@ÿ ü
ÿ
 zCursorResult.__init__cCs¦|jrp|j}|jr|j}nt||ƒ}|jr0||_|j dd¡sh|jrh|j|jj    krh|j
|j k    rh|  |¡}||_ nt||ƒ|_ }|jr¢|j dtdd„|Dƒƒ¡|S)NZ _result_disable_adapt_to_contextFzCol %rcss|]}|dVqdS)rNrU)rZrÉrUrUrVr„úsz.CursorResult._init_metadata.<locals>.<genexpr>)rZ_cached_metadatarBrIrrrŽZ    cache_hitr²Z    CACHE_HITrrr’rr3r    rEÚtuple)rTrŠr•rrGrUrUrVr?Îs<
ÿÿü û
ú
ÿ
ÿzCursorResult._init_metadatacCsl|s
|js|r|jrdS|r4d|_|j ||j¡n|j ||j¡|jsh|j}d|_|j |¡d|_dS)a\Soft close this :class:`_engine.CursorResult`.
 
        This releases all DBAPI cursor resources, but leaves the
        CursorResult "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.
 
        .. seealso::
 
            :meth:`_engine.CursorResult.close`
 
 
        NT)r4rÿrrèrrçr    Z_safe_close_cursor)rTrrrUrUrVrþs zCursorResult._soft_closecCsB|jjst d¡‚n&|jjs(t d¡‚n|jjr:t d¡‚|jjS)aÌReturn the value of
        :attr:`_engine.CursorResult.inserted_primary_key`
        as a row contained within a list; some dialects may support a
        multiple row form as well.
 
        .. note:: As indicated below, in current SQLAlchemy versions this
           accessor is only useful beyond what's already supplied by
           :attr:`_engine.CursorResult.inserted_primary_key` when using the
           :ref:`postgresql_psycopg2` dialect.   Future versions hope to
           generalize this feature to more dialects.
 
        This accessor is added to support dialects that offer the feature
        that is currently implemented by the :ref:`psycopg2_executemany_mode`
        feature, currently **only the psycopg2 dialect**, which provides
        for many rows to be INSERTed at once while still retaining the
        behavior of being able to return server-generated primary key values.
 
        * **When using the psycopg2 dialect, or other dialects that may support
          "fast executemany" style inserts in upcoming releases** : When
          invoking an INSERT statement while passing a list of rows as the
          second argument to :meth:`_engine.Connection.execute`, this accessor
          will then provide a list of rows, where each row contains the primary
          key value for each row that was INSERTed.
 
        * **When using all other dialects / backends that don't yet support
          this feature**: This accessor is only useful for **single row INSERT
          statements**, and returns the same information as that of the
          :attr:`_engine.CursorResult.inserted_primary_key` within a
          single-element list. When an INSERT statement is executed in
          conjunction with a list of rows to be INSERTed, the list will contain
          one row per row inserted in the statement, however it will contain
          ``None`` for any server-generated values.
 
        Future releases of SQLAlchemy will further generalize the
        "fast execution helper" feature of psycopg2 to suit other dialects,
        thus allowing this accessor to be of more general use.
 
        .. versionadded:: 1.4
 
        .. seealso::
 
            :attr:`_engine.CursorResult.inserted_primary_key`
 
        ú1Statement is not a compiled expression construct.ú2Statement is not an insert() expression construct.z9Can't call inserted_primary_key when returning() is used.)rŠrrr¸ÚisinsertZ_is_explicit_returningÚinserted_primary_key_rowsr[rUrUrVrL#s.ÿÿÿz&CursorResult.inserted_primary_key_rowscCs,|jjrt d¡‚|j}|r$|dSdSdS)a²Return the primary key for the row just inserted.
 
        The return value is a :class:`_result.Row` object representing
        a named tuple of primary key values in the order in which the
        primary key columns are configured in the source
        :class:`_schema.Table`.
 
        .. versionchanged:: 1.4.8 - the
           :attr:`_engine.CursorResult.inserted_primary_key`
           value is now a named tuple via the :class:`_result.Row` class,
           rather than a plain tuple.
 
        This accessor only applies to single row :func:`_expression.insert`
        constructs which did not explicitly specify
        :meth:`_expression.Insert.returning`.    Support for multirow inserts,
        while not yet available for most backends, would be accessed using
        the :attr:`_engine.CursorResult.inserted_primary_key_rows` accessor.
 
        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.
 
        zuThis statement was an executemany call; if primary key returning is supported, please use .inserted_primary_key_rows.rN)rŠÚ executemanyrr¸rL)rTZikprUrUrVÚinserted_primary_keyas!ÿz!CursorResult.inserted_primary_keycCsH|jjst d¡‚n0|jjs(t d¡‚n|jjr8|jjS|jjdSdS)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.
 
        rIz2Statement is not an update() expression construct.rN)rŠrrr¸ÚisupdaterMÚcompiled_parametersr[rUrUrVÚlast_updated_paramss    ÿÿz CursorResult.last_updated_paramscCsH|jjst d¡‚n0|jjs(t d¡‚n|jjr8|jjS|jjdSdS)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.
 
        rIrJrN)rŠrrr¸rKrMrPr[rUrUrVÚlast_inserted_params¥s    ÿÿz!CursorResult.last_inserted_paramscCs|jjS)aReturn a list of rows each containing the values of default
        columns that were fetched using
        the :meth:`.ValuesBase.return_defaults` feature.
 
        The return value is a list of :class:`.Row` objects.
 
        .. versionadded:: 1.4
 
        )rŠÚreturned_default_rowsr[rUrUrVÚreturned_defaults_rows»s z#CursorResult.returned_defaults_rowscCsV| ¡}dd„tt| ¡ƒt| ¡ƒƒDƒ}|j |j¡|_td|d|_| ¡|S)aÌReturn a new :class:`.CursorResult` that "horizontally splices"
        together the rows of this :class:`.CursorResult` with that of another
        :class:`.CursorResult`.
 
        .. tip::  This method is for the benefit of the SQLAlchemy ORM and is
           not intended for general use.
 
        "horizontally splices" means that for each row in the first and second
        result sets, a new row that concatenates the two rows together is
        produced, which then becomes the new row.  The incoming
        :class:`.CursorResult` must have the identical number of rows.  It is
        typically expected that the two result sets come from the same sort
        order as well, as the result rows are spliced together based on their
        position in the result.
 
        The expected use case here is so that multiple INSERT..RETURNING
        statements (which definitely need to be sorted) against different
        tables can produce a single result that looks like a JOIN of those two
        tables.
 
        E.g.::
 
            r1 = connection.execute(
                users.insert().returning(
                    users.c.user_name,
                    users.c.user_id,
                    sort_by_parameter_order=True
                ),
                user_values
            )
 
            r2 = connection.execute(
                addresses.insert().returning(
                    addresses.c.address_id,
                    addresses.c.address,
                    addresses.c.user_id,
                    sort_by_parameter_order=True
                ),
                address_values
            )
 
            rows = r1.splice_horizontally(r2).all()
            assert (
                rows ==
                [
                    ("john", 1, 1, "foo@bar.com", 1),
                    ("jack", 2, 2, "bar@bat.com", 2),
                ]
            )
 
        .. versionadded:: 2.0
 
        .. seealso::
 
            :meth:`.CursorResult.splice_vertically`
 
 
        cSs g|]\}}t|ƒt|ƒ‘qSrU)rH)rZZr1Zr2rUrUrVr\sÿz4CursorResult.splice_horizontally.<locals>.<listcomp>N©r )    Ú    _generateÚzipr…Ú_raw_row_iteratorrr{r+rÚ_reset_memoizations©rTrrÚcloneZ
total_rowsrUrUrVÚsplice_horizontallyÈs<
 
þþþz CursorResult.splice_horizontallycCs:| ¡}t| ¡ƒt| ¡ƒ}td|d|_| ¡|S)aÍReturn a new :class:`.CursorResult` that "vertically splices",
        i.e. "extends", the rows of this :class:`.CursorResult` with that of
        another :class:`.CursorResult`.
 
        .. tip::  This method is for the benefit of the SQLAlchemy ORM and is
           not intended for general use.
 
        "vertically splices" means the rows of the given result are appended to
        the rows of this cursor result. The incoming :class:`.CursorResult`
        must have rows that represent the identical list of columns in the
        identical order as they are in this :class:`.CursorResult`.
 
        .. versionadded:: 2.0
 
        .. seealso::
 
            :meth:`.CursorResult.splice_horizontally`
 
        NrU)rVr…rXr+rrYrZrUrUrVÚsplice_verticallys ÿþzCursorResult.splice_verticallycCsF|jr|jj dt|ƒ¡tt|jƒ ¡|_t    d|d|_
|  ¡|S)arewind this result back to the given rowset.
 
        this is used internally for the case where an :class:`.Insert`
        construct combines the use of
        :meth:`.Insert.return_defaults` along with the
        "supplemental columns" feature.
 
        zCursorResult rewound %d row(s)NrU) r3rŠr    rErorrBrrqr+rrY©rTrrUrUrVÚ_rewind6s
ÿÿ
ûzCursorResult._rewindcCs.|jjrt d¡‚|jj}|r&|dSdSdS)axReturn the values of default columns that were fetched using
        the :meth:`.ValuesBase.return_defaults` feature.
 
        The value is an instance of :class:`.Row`, or ``None``
        if :meth:`.ValuesBase.return_defaults` was not used or if the
        backend does not support RETURNING.
 
        .. seealso::
 
            :meth:`.ValuesBase.return_defaults`
 
        zlThis statement was an executemany call; if return defaults is supported, please use .returned_defaults_rows.rN)rŠrMrr¸rSr^rUrUrVÚreturned_defaultsVsÿzCursorResult.returned_defaultscCs
|j ¡S)z˜Return ``lastrow_has_defaults()`` from the underlying
        :class:`.ExecutionContext`.
 
        See :class:`.ExecutionContext` for details.
 
        )rŠÚlastrow_has_defaultsr[rUrUrVraqsz!CursorResult.lastrow_has_defaultscCs6|jjst d¡‚n|jjs.|jjs.t d¡‚|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.
 
        rIú>Statement is not an insert() or update() expression construct.)rŠrrr¸rKrOÚpostfetch_colsr[rUrUrVrc{s ÿÿzCursorResult.postfetch_colscCs6|jjst d¡‚n|jjs.|jjs.t d¡‚|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.
 
        rIrb)rŠrrr¸rKrOÚ prefetch_colsr[rUrUrVrd’s ÿÿzCursorResult.prefetch_colscCs|jjS)z€Return ``supports_sane_rowcount`` from the dialect.
 
        See :attr:`_engine.CursorResult.rowcount` for background.
 
        )r²Úsupports_sane_rowcountr[rUrUrVre©sz#CursorResult.supports_sane_rowcountcCs|jjS)z†Return ``supports_sane_multi_rowcount`` from the dialect.
 
        See :attr:`_engine.CursorResult.rowcount` for background.
 
        )r²Úsupports_sane_multi_rowcountr[rUrUrVrf²sz)CursorResult.supports_sane_multi_rowcountrÇrXc
CsFz
|jjWStk
r@}z|j ||j|¡‚W5d}~XYnXdS)a~Return 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.CursorResult.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.CursorResult.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.CursorResult.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.CursorResult.supports_sane_rowcount` and
             :meth:`_engine.CursorResult.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.
 
        .. seealso::
 
            :ref:`tutorial_update_delete_rowcount` - in the :ref:`unified_tutorial`
 
        N)rŠÚrowcountrõrrør©rTrƒrUrUrVrg»s
/
zCursorResult.rowcountc
CsFz |j ¡WStk
r@}z|j ||j|¡W5d}~XYnXdS)a0Return 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:`~CursorResult.inserted_primary_key` attribute provides a
        tuple of primary key values for a newly inserted row,
        regardless of database backend.
 
        N)rŠZ get_lastrowidrõrrørrhrUrUrVÚ    lastrowidðs zCursorResult.lastrowidcCs|jjS)aqTrue if this :class:`_engine.CursorResult` returns zero or more
        rows.
 
        I.e. if it is legal to call the methods
        :meth:`_engine.CursorResult.fetchone`,
        :meth:`_engine.CursorResult.fetchmany`
        :meth:`_engine.CursorResult.fetchall`.
 
        Overall, the value of :attr:`_engine.CursorResult.returns_rows` should
        always be synonymous with whether or not the DBAPI cursor had a
        ``.description`` attribute, indicating the presence of result columns,
        noting that a cursor that returns zero rows still has a
        ``.description`` if a row-returning statement was emitted.
 
        This attribute should be True for all results that are against
        SELECT statements, as well as for DML statements INSERT/UPDATE/DELETE
        that use RETURNING.   For INSERT/UPDATE/DELETE statements that were
        not using RETURNING, the value will usually be False, however
        there are some dialect-specific exceptions to this, such as when
        using the MSSQL / pyodbc dialect a SELECT is emitted inline in
        order to retrieve an inserted primary key value.
 
 
        )rrNr[rUrUrVrNszCursorResult.returns_rowscCs|jjS)alTrue if this :class:`_engine.CursorResult` 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.
 
        )rŠrKr[rUrUrVÚ    is_insert!s zCursorResult.is_insertccs*|jj}|||jƒ}|dkrq&|VqdSrQ©rrïr)rTrïrrUrUrVÚ_fetchiter_impl/s
 zCursorResult._fetchiter_implcCs|j ||j|¡SrQrk)rTrèrUrUrVÚ_fetchone_impl8szCursorResult._fetchone_implcCs|j ||j¡SrQ)rrôrr[rUrUrVÚ_fetchall_impl;szCursorResult._fetchall_implNcCs|j ||j|¡SrQ)rrór)rTrñrUrUrVÚ_fetchmany_impl>szCursorResult._fetchmany_implcCs| ¡SrQ)rlr[rUrUrVrXAszCursorResult._raw_row_iteratorz Result[Any]zMergedResult[Any])ÚothersrPcs6tƒj|Ž}|jj}|r2tdd„|f|Dƒƒ|_|S)Ncss|]}td|ƒjVqdS)r“N)rrg)rZrârUrUrVr„Hsÿz%CursorResult.merge.<locals>.<genexpr>)r#ÚmergerŠZ _has_rowcountÚsumrg)rTrpZ merged_resultZsetup_rowcountsr$rUrVrqDs þ
zCursorResult.mergercCs|jdddS)aýClose this :class:`_engine.CursorResult`.
 
        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.CursorResult`
        exhausts all available rows.  :meth:`_engine.CursorResult.close` is
        generally an optional method except in the case when discarding a
        :class:`_engine.CursorResult` that still has additional rows pending
        for fetch.
 
        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.
 
        .. seealso::
 
            :ref:`connections_toplevel`
 
        TrN)rr[rUrUrVÚcloseNszCursorResult.closer')rêrPcCs||_|j ||j|¡|SrQ)Z
_yield_perrrìr)rTrêrUrUrVrìdszCursorResult.yield_per)F)F)N)-rÕrÖr×rØrÙrÚÚ_NO_RESULT_METADATArFr4rÿZ
_is_cursorr¥r?rr.rLrNrQrRrTr\r]r_r`rarcrdrerfrZmemoized_propertyrgrirNrjrlrmrnrorXrqrsrrìr*rUrUr$rVr2gsb
      >0
%
=
-
N  
 
        4
 
 
    
 
 
r2)arØÚ
__future__rrr@rBÚtypingrrrrrrr    r
r r r rrrrârrrrrrrrÚrrZsqlrrr9Zsql.baserZ sql.compilerrr r!r"r#Z sql.type_apir$r%Z util.typingr&r'Úbaser(rýr)Z
interfacesr*r+r,r-r.r/r0r1r2r3r4r5r7rÚr8r9r;r=r?rArÇrÏZ_CursorKeyMapRecTyperLrÎrBrÜrùrþrrZ_NO_CURSOR_DMLrZ_DEFAULT_FETCHr r+r,rtr1r2Z ResultProxyrUrUrUrVÚ<module>    sâ                                                          úÿ
úÿ >X8%