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
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
U
¸ý°d¤-ã@s¬dZddlmZddlZddlmZddlmZddlmZddlm    Z    ddl
m Z dd    l
m Z dd
l
m Z dd l
mZdd l
mZdd l
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"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.er
dd&l/m0Z0dd'l/m1Z1dd(l/m2Z2dd)l/m3Z3dd*l/m4Z4dd+l/m5Z5dd,l/m6Z6dd-l/m7Z7dd.l/m8Z8ed/ƒZ9e j:d0d1d2d3d3d/d4œd5d6„ƒZ;d7d8d9œd:d;„Z<e    Gd<d=„d=eƒƒZ=e    Gd>d?„d?eƒƒZ>ej?Gd@dA„dAej@dAƒƒZAe.GdBdC„dCƒƒZBeGdDdE„dEƒƒZCdS)FaãProvides an abstraction for obtaining database schema information.
 
Usage Notes:
 
Here are some general conventions when accessing the low level inspector
methods such as get_table_names, get_columns, etc.
 
1. Inspector methods return lists of dicts in most cases for the following
   reasons:
 
   * They're both standard types that can be serialized.
   * Using a dict instead of a tuple allows easy expansion of attributes.
   * Using a list for the outer structure maintains order and is easy to work
     with (e.g. list comprehension [d['name'] for d in cols]).
 
2. Records that contain a name, such as the column name in a column record
   use the key 'name'. So for most return values, each record will have a
   'name' attribute..
é)Ú annotationsN)Ú    dataclass)Úauto)ÚFlag)Úunique)ÚAny)ÚCallable)Ú
Collection)ÚDict)Ú    Generator)ÚIterable)ÚList)ÚOptional)ÚSequence)ÚSet)ÚTuple)Ú TYPE_CHECKING)ÚTypeVar)ÚUnioné)Ú
Connection)ÚEngineé)Úexc)Ú
inspection)Úsql)Úutil)Ú    operators)Úschema)Ú_ad_hoc_cache_key_from_args)Ú
TextClause)Ú
TypeEngine)ÚInternalTraversal)Ú topological)Úfinal)ÚDialect)ÚReflectedCheckConstraint)ÚReflectedColumn)ÚReflectedForeignKeyConstraint)ÚReflectedIndex)ÚReflectedPrimaryKeyConstraint)ÚReflectedTableComment)ÚReflectedUniqueConstraint)ÚTableKeyÚ_RúCallable[..., _R]r%rr©ÚfnÚselfÚconÚargsÚkwÚreturncsŽ| dd¡}|dkr&|||f|ž|ŽSddh‰|jtdd„|Dƒƒt‡fdd„| ¡Dƒƒf}| |¡}|dkrŠ|||f|ž|Ž}|||<|S)NÚ
info_cacheÚ unreflectablecss|]}t|tƒr|VqdS©N)Ú
isinstanceÚstr)Ú.0Úa©r>úSd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/engine/reflection.pyÚ    <genexpr>\s
zcache.<locals>.<genexpr>c3s"|]\}}|ˆkr||fVqdSr9r>)r<ÚkÚv©Úexcluder>r?r@]s)ÚgetÚ__name__ÚtupleÚitems©r1r2r3r4r5r7ÚkeyÚretr>rCr?ÚcacheNs ý
rLzTuple[str, InternalTraversal]z0Callable[[Callable[..., _R]], Callable[..., _R]])Ú traverse_argsr6cs&tjdddddddœ‡fdd„ ƒ}|S)    Nr/r%rrr.r0csf| dd¡}|dkr&|||f|ž|ŽSt|jfˆ|ƒ}| |¡}|dkrb|||f|ž|Ž}|||<|S)Nr7)rErrFrI©rMr>r?Úgois 
zflexi_cache.<locals>.go)rÚ    decorator)rMrOr>rNr?Ú flexi_cachefsrQc@s6eZdZdZeƒZeƒZeƒZeeBZeeBeBZ    dS)Ú
ObjectKindaÞEnumerator that indicates which kind of object to return when calling
    the ``get_multi`` methods.
 
    This is a Flag enum, so custom combinations can be passed. For example,
    to reflect tables and plain views ``ObjectKind.TABLE | ObjectKind.VIEW``
    may be used.
 
    .. note::
      Not all dialect may support all kind of object. If a dialect does
      not support a particular object an empty dict is returned.
      In case a dialect supports an object, but the requested method
      is not applicable for the specified kind the default value
      will be returned for each reflected object. For example reflecting
      check constraints of view return a dict with all the views with
      empty lists as values.
    N)
rFÚ
__module__Ú __qualname__Ú__doc__rÚTABLEZVIEWZMATERIALIZED_VIEWZANY_VIEWÚANYr>r>r>r?rR~s rRc@s$eZdZdZeƒZeƒZeeBZdS)Ú ObjectScopez]Enumerator that indicates which scope to use when calling
    the ``get_multi`` methods.
    N)rFrSrTrUrÚDEFAULTÚ    TEMPORARYrWr>r>r>r?rXžs
rXc @s@eZdZUdZded<ded<ded<ded    <d
ed <e d d ¡ddœdd„ƒZeddddœdd„ƒZ    dddœdd„Z
dddœdd„Z dddœdd„Z dd œd!d"„Z ee d d#¡dddœd$d%„ƒƒZe e¡dddœd&d'„ƒZe e¡dddœd(d)„ƒZejd*d œd+d,„ƒZejd-d œd.d/„ƒZed0d œd1d2„ƒZd3d4d5œd6d7„Zd¼d0d3d4d9œd:d;„Zd½d<d0d3dd=œd>d?„Zd¾d<d0d3dd@œdAdB„Zd¿d<d<d0d3ddCœdDdE„Zd<d3ddFœdGdH„Z dÀd0d3dId9œdJdK„Z!dÁdMd3dNdOœdPdQ„Z"d3d4d5œdRdS„Z#d3d4d5œdTdU„Z$dÂd<d0d3dVd=œdWdX„Z%d8d8e&j'e(j)fd0dYdZd[d3d\d]œd^d_„Z*dÃd0d3d4d9œd`da„Z+dÄd0d3d4d9œdbdc„Z,dÅd0d3d4d9œddde„Z-dÆd<d0d3d<dfœdgdh„Z.dÇd<d0d3did=œdjdk„Z/dlddmœdndo„Z0d8d8e&j'e(j)fd0dYdZd[d3dpd]œdqdr„Z1dÈd<d0d3dsd=œdtdu„Z2d8d8e&j'e(j)fd0dYdZd[d3dvd]œdwdx„Z3dÉd<d0d3dyd=œdzd{„Z4d8d8e&j'e(j)fd0dYdZd[d3d|d]œd}d~„Z5dÊd<d0d3dd=œd€d„Z6d8d8e&j'e(j)fd0dYdZd[d3d‚d]œdƒd„„Z7dËd<d0d3d…d=œd†d‡„Z8d8d8e&j'e(j)fd0dYdZd[d3dˆd]œd‰dŠ„Z9dÌd<d0d3d‹d=œdŒd„Z:d8d8e&j'e(j)fd0dYdZd[d3dŽd]œdd„Z;dÍd<d0d3d‘d=œd’d“„Z<d8d8e&j'e(j)fd0dYdZd[d3d”d]œd•d–„Z=dÎd™dšd›ddœdddžœdŸd „Z>d™d¡dšd›d¢dd£œd¤d¥„Z?d¦d§d™d¢d›dd¨œd©dª„Z@d¦d§d™d¢dšd›ddœdVdd«œ
d¬d­„ZAeBjCeBjDeBjEeBjFd®œZGd¦d§d™d¢dšd›dVdd¯œd°d±„ZHd¦d§d™d¢dšd›dVdd¯œd²d³„ZId¦d§d™d¢dšd›dVdd¯œd´dµ„ZJd¦d§d™dVdd¶œd·d¸„ZKdÏd0dšdšdd3d¦d¹œdºd»„ZLd8S)ÐÚ    Inspectora<Performs database schema inspection.
 
    The Inspector acts as a proxy to the reflection methods of the
    :class:`~sqlalchemy.engine.interfaces.Dialect`, providing a
    consistent interface as well as caching support for previously
    fetched metadata.
 
    A :class:`_reflection.Inspector` object is usually created via the
    :func:`_sa.inspect` function, which may be passed an
    :class:`_engine.Engine`
    or a :class:`_engine.Connection`::
 
        from sqlalchemy import inspect, create_engine
        engine = create_engine('...')
        insp = inspect(engine)
 
    Where above, the :class:`~sqlalchemy.engine.interfaces.Dialect` associated
    with the engine may opt to return an :class:`_reflection.Inspector`
    subclass that
    provides additional methods specific to the dialect's target database.
 
    zUnion[Engine, Connection]ÚbindrÚengineÚboolÚ_op_context_requires_connectr%ÚdialectzDict[Any, Any]r7z1.4aThe __init__() method on :class:`_reflection.Inspector` is deprecated and will be removed in a future release.  Please use the :func:`.sqlalchemy.inspect` function on an :class:`_engine.Engine` or :class:`_engine.Connection` in order to acquire an :class:`_reflection.Inspector`.©r\cCs| |¡dS)aŠInitialize a new :class:`_reflection.Inspector`.
 
        :param bind: a :class:`~sqlalchemy.engine.Connection`,
          which is typically an instance of
          :class:`~sqlalchemy.engine.Engine` or
          :class:`~sqlalchemy.engine.Connection`.
 
        For a dialect-specific instance of :class:`_reflection.Inspector`, see
        :meth:`_reflection.Inspector.from_engine`
 
        N)Ú _init_legacy©r2r\r>r>r?Ú__init__ËszInspector.__init__zCallable[..., Any])Úinitr\r6cCs,t|jdƒr|jj}| |¡}|||ƒ|S)NÚ    inspector)Úhasattrr`rfÚ__new__)Úclsrer\r2r>r>r?Ú
_constructäs
 
 
zInspector._constructÚNone)r\r6cCs$t|dƒr| |¡n
| |¡dS)NZexec_driver_sql)rgÚ_init_connectionÚ _init_enginercr>r>r?rbðs
 zInspector._init_legacy)r]r6cCs2||_|_| ¡ ¡d|_|jj|_i|_dS)NT)r\r]ÚconnectÚcloser_r`r7)r2r]r>r>r?rmös
 
zInspector._init_enginer)Ú
connectionr6cCs(||_|j|_d|_|jj|_i|_dS)NF)r\r]r_r`r7)r2rpr>r>r?rlýs
 
zInspector._init_connection©r6cCs|j ¡dS)zÈreset the cache for this :class:`.Inspector`.
 
        Inspection methods that have data cached will emit SQL queries
        when next called to get new data.
 
        .. versionadded:: 2.0
 
        N)r7Úclear©r2r>r>r?Ú clear_caches    zInspector.clear_cacheaThe from_engine() method on :class:`_reflection.Inspector` is deprecated and will be removed in a future release.  Please use the :func:`.sqlalchemy.inspect` function on an :class:`_engine.Engine` or :class:`_engine.Connection` in order to acquire an :class:`_reflection.Inspector`.cCs| |j|¡S)aZConstruct a new dialect-specific Inspector object from the given
        engine or connection.
 
        :param bind: a :class:`~sqlalchemy.engine.Connection`
         or :class:`~sqlalchemy.engine.Engine`.
 
        This method differs from direct a direct constructor call of
        :class:`_reflection.Inspector` in that the
        :class:`~sqlalchemy.engine.interfaces.Dialect` is given a chance to
        provide a dialect-specific :class:`_reflection.Inspector` instance,
        which may
        provide additional methods.
 
        See the example at :class:`_reflection.Inspector`.
 
        )rjrb)rir\r>r>r?Ú from_engineszInspector.from_enginecCst tj|¡Sr9)r[rjrmrar>r>r?Ú _engine_insp.szInspector._engine_inspcCst tj|¡Sr9)r[rjrlrar>r>r?Ú_connection_insp2szInspector._connection_inspz!Generator[Connection, None, None]ccs8|jr|j ¡}n|j}z
|VW5|jr2| ¡XdS)aReturn a context that optimizes for multiple operations on a single
        transaction.
 
        This essentially allows connect()/close() to be called if we detected
        that we're against an :class:`_engine.Engine` and not a
        :class:`_engine.Connection`.
 
        N)r_r\rnro)r2Úconnr>r>r?Ú_operation_context6s  
zInspector._operation_contextz Generator[Inspector, None, None]c    cs6| ¡$}| |jj|¡}|j|_|VW5QRXdS)z…Return an :class:`_reflection.Inspector`
        from this one that will run all
        operations on a single connection.
 
        N)ryrjÚ    __class__rlr7)r2rxZsub_inspr>r>r?Ú_inspection_contextKs
zInspector._inspection_contextz Optional[str]cCs|jjS)zÏReturn the default schema name presented by the dialect
        for the current engine's database user.
 
        E.g. this is typically ``public`` for PostgreSQL and ``dbo``
        for SQL Server.
 
        )r`Údefault_schema_namersr>r>r?r|Xs    zInspector.default_schema_namerz    List[str])r5r6c
Ks:| ¡(}|jj|fd|ji|—ŽW5QR£SQRXdS)zØReturn all schema names.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
        r7N)ryr`Úget_schema_namesr7©r2r5rxr>r>r?r}cs
ÿÿÿzInspector.get_schema_namesN)rr5r6c
Ks<| ¡*}|jj||fd|ji|—ŽW5QR£SQRXdS)aÜReturn all table names within a particular schema.
 
        The names are expected to be real tables only, not views.
        Views are instead returned using the
        :meth:`_reflection.Inspector.get_view_names` and/or
        :meth:`_reflection.Inspector.get_materialized_view_names`
        methods.
 
        :param schema: Schema name. If ``schema`` is left at ``None``, the
         database's default schema is
         used, else the named schema is searched.  If the database does not
         support named schemas, behavior is undefined if ``schema`` is not
         passed as ``None``.  For special quoting, use :class:`.quoted_name`.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        .. seealso::
 
            :meth:`_reflection.Inspector.get_sorted_table_and_fkc_names`
 
            :attr:`_schema.MetaData.sorted_tables`
 
        r7N)ryr`Úget_table_namesr7©r2rr5rxr>r>r?rps
ÿÿÿzInspector.get_table_namesr;)Ú
table_namerr5r6c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)aReturn True if the backend has a table, view, or temporary
        table of the given name.
 
        :param table_name: name of the table to check
        :param schema: schema name to query, if not the default schema.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        .. versionadded:: 1.4 - the :meth:`.Inspector.has_table` method
           replaces the :meth:`_engine.Engine.has_table` method.
 
        .. versionchanged:: 2.0:: :meth:`.Inspector.has_table` now formally
           supports checking for additional table-like objects:
 
           * any type of views (plain or materialized)
           * temporary tables of any kind
 
           Previously, these two checks were not formally specified and
           different dialects would vary in their behavior.   The dialect
           testing suite now includes tests for all of these object types
           and should be supported by all SQLAlchemy-included dialects.
           Support among third party dialects may be lagging, however.
 
        r7N)ryr`Ú    has_tabler7©r2rrr5rxr>r>r?r‚‘s
ÿÿÿzInspector.has_table)Ú sequence_namerr5r6c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)a¢Return True if the backend has a sequence with the given name.
 
        :param sequence_name: name of the sequence to check
        :param schema: schema name to query, if not the default schema.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        .. versionadded:: 1.4
 
        r7N)ryr`Ú has_sequencer7)r2r„rr5rxr>r>r?r…²s
ÿÿÿzInspector.has_sequence)rÚ
index_namerr5r6c
Ks@| ¡.}|jj||||fd|ji|—ŽW5QR£SQRXdS)açCheck the existence of a particular index name in the database.
 
        :param table_name: the name of the table the index belongs to
        :param index_name: the name of the index to check
        :param schema: schema name to query, if not the default schema.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        .. versionadded:: 2.0
 
        r7N)ryr`Ú    has_indexr7)r2rr†rr5rxr>r>r?r‡Ås
üûúzInspector.has_index)Ú schema_namer5r6c
Ks<| ¡*}|jj||fd|ji|—ŽW5QR£SQRXdS)aTReturn True if the backend has a schema with the given name.
 
        :param schema_name: name of the schema to check
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        .. versionadded:: 2.0
 
        r7N)ryr`Ú
has_schemar7)r2rˆr5rxr>r>r?r‰âs
ÿÿÿzInspector.has_schemaz;List[Tuple[Optional[str], List[Tuple[str, Optional[str]]]]]cKsdd„|j|fdDƒS)agReturn dependency-sorted table and foreign key constraint names in
        referred to within a particular schema.
 
        This will yield 2-tuples of
        ``(tablename, [(tname, fkname), (tname, fkname), ...])``
        consisting of table names in CREATE order grouped with the foreign key
        constraint names that are not detected as belonging to a cycle.
        The final element
        will be ``(None, [(tname, fkname), (tname, fkname), ..])``
        which will consist of remaining
        foreign key constraint names that would require a separate CREATE
        step after-the-fact, based on dependencies between tables.
 
        :param schema: schema name to query, if not the default schema.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        .. seealso::
 
            :meth:`_reflection.Inspector.get_table_names`
 
            :func:`.sort_tables_and_constraints` - similar method which works
            with an already-given :class:`_schema.MetaData`.
 
        cSs.g|]&\}}|r|dnddd„|Dƒf‘qS)rNcSsg|]\\}}}||f‘qSr>r>)r<Ú_ÚtnameZfksr>r>r?Ú
<listcomp>s
zGInspector.get_sorted_table_and_fkc_names.<locals>.<listcomp>.<listcomp>r>)r<Ú    table_keyZ fk_collectionr>r>r?rŒs û þz<Inspector.get_sorted_table_and_fkc_names.<locals>.<listcomp>)Úconsider_schemas)Ú%sort_tables_on_foreign_key_dependency)r2rr5r>r>r?Úget_sorted_table_and_fkc_namesòs
 ÿøz(Inspector.get_sorted_table_and_fkc_namesr9zCollection[Optional[str]]zgList[Tuple[Optional[Tuple[Optional[str], str]], List[Tuple[Tuple[Optional[str], str], Optional[str]]]]])rŽr5r6c
sZttttf}tƒ}tƒ‰i‰g}|D]ˆ}|j|f|Ž}| |¡| ¡D]b\\}}    }
dd„|
Dƒˆ||    f<|
D]:} |    | dksŽ|| dkrr| | d| df||    ff¡qrqLq(ztt     
||¡ƒ} Wnlt j k
r2} zJ| j D].‰| ˆ¡ˆ ‡fdd„ˆˆdDƒ¡qâtt     
||¡ƒ} W5d} ~ XYnX‡‡fd    d
„| Dƒ}|dtˆƒfgS) aÄReturn dependency-sorted table and foreign key constraint names
        referred to within multiple schemas.
 
        This method may be compared to
        :meth:`.Inspector.get_sorted_table_and_fkc_names`, which
        works on one schema at a time; here, the method is a generalization
        that will consider multiple schemas at once including that it will
        resolve for cross-schema foreign keys.
 
        .. versionadded:: 2.0
 
        cSsh|] }|d’qS)Únamer>©r<Zfkr>r>r?Ú    <setcomp>@szBInspector.sort_tables_on_foreign_key_dependency.<locals>.<setcomp>Úreferred_tableÚreferred_schemac3s|]}ˆd|fVqdS)rNr>)r<Zfkc)Úedger>r?r@WszBInspector.sort_tables_on_foreign_key_dependency.<locals>.<genexpr>rNcsDg|]<\‰‰ˆˆf‡‡fdd„ˆˆˆf dd„ˆDƒ¡Dƒf‘qS)csg|]}ˆˆf|f‘qSr>r>r’©Úschnamer‹r>r?rŒbsÿzNInspector.sort_tables_on_foreign_key_dependency.<locals>.<listcomp>.<listcomp>css|]\}}|VqdSr9r>)r<rŠr‘r>r>r?r@dszMInspector.sort_tables_on_foreign_key_dependency.<locals>.<listcomp>.<genexpr>)Ú
difference)r<)Úfknames_for_tableÚremaining_fkcsr—r?rŒ_s
ø ÿþþzCInspector.sort_tables_on_foreign_key_dependency.<locals>.<listcomp>)rrr;ÚsetÚget_multi_foreign_keysÚextendrHÚaddÚlistr#ÚsortrZCircularDependencyErrorÚedgesÚremoveÚupdate)r2rŽr5Z    SchemaTabZtuplesZtnamesr˜Z schema_fkeysrŠr‹ÚfkeysZfkeyZcandidate_sortÚerrrKr>)r–ršr›r?rsJ
ÿ
ÿ
þþûÿ
    
 
 
ÿ
"
ö z/Inspector.sort_tables_on_foreign_key_dependencyc
Ks:| ¡(}|jj|fd|ji|—ŽW5QR£SQRXdS)awReturn a list of temporary table names for the current bind.
 
        This method is unsupported by most dialects; currently
        only Oracle, PostgreSQL and SQLite implements it.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        r7N)ryr`Úget_temp_table_namesr7r~r>r>r?r§ms
ÿÿÿzInspector.get_temp_table_namesc
Ks:| ¡(}|jj|fd|ji|—ŽW5QR£SQRXdS)anReturn a list of temporary view names for the current bind.
 
        This method is unsupported by most dialects; currently
        only PostgreSQL and SQLite implements it.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        r7N)ryr`Úget_temp_view_namesr7r~r>r>r?r¨~s
ÿÿÿzInspector.get_temp_view_namesúDict[str, Any]c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)aqReturn a dictionary of options specified when the table of the
        given name was created.
 
        This currently includes some options that apply to MySQL and Oracle
        tables.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dict with the table options. The returned keys depend on the
         dialect in use. Each one is prefixed with the dialect name.
 
        .. seealso:: :meth:`Inspector.get_multi_table_options`
 
        r7N)ryr`Úget_table_optionsr7rƒr>r>r?rªŽs
ÿÿÿzInspector.get_table_optionszOptional[Sequence[str]]rRrXúDict[TableKey, Dict[str, Any]])rÚ filter_namesÚkindÚscoper5r6c
KsJ| ¡8}|jj|f|||||jdœ|—Ž}t|ƒW5QR£SQRXdS)aÏReturn a dictionary of options specified when the tables in the
        given schema were created.
 
        The tables can be filtered by passing the names to use to
        ``filter_names``.
 
        This currently includes some options that apply to MySQL and Oracle
        tables.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if options of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are dictionaries with the table options.
         The returned keys in each dict depend on the
         dialect in use. Each one is prefixed with the dialect name.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_table_options`
        ©rr¬r­r®r7N)ryr`Úget_multi_table_optionsr7Údict)r2rr¬r­r®r5rxÚresr>r>r?r°­s-
ÿúù    z!Inspector.get_multi_table_optionsc
Ks<| ¡*}|jj||fd|ji|—ŽW5QR£SQRXdS)aReturn all non-materialized view names in `schema`.
 
        :param schema: Optional, retrieve names from a non-default schema.
         For special quoting, use :class:`.quoted_name`.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
 
        .. versionchanged:: 2.0  For those dialects that previously included
           the names of materialized views in this list (currently PostgreSQL),
           this method no longer returns the names of materialized views.
           the :meth:`.Inspector.get_materialized_view_names` method should
           be used instead.
 
        .. seealso::
 
            :meth:`.Inspector.get_materialized_view_names`
 
        r7N)ryr`Úget_view_namesr7r€r>r>r?r³æs
ÿÿÿzInspector.get_view_namesc
Ks<| ¡*}|jj||fd|ji|—ŽW5QR£SQRXdS)aØReturn all materialized view names in `schema`.
 
        :param schema: Optional, retrieve names from a non-default schema.
         For special quoting, use :class:`.quoted_name`.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        .. versionadded:: 2.0
 
        .. seealso::
 
            :meth:`.Inspector.get_view_names`
 
        r7N)ryr`Úget_materialized_view_namesr7r€r>r>r?r´s
ÿÿÿz%Inspector.get_materialized_view_namesc
Ks<| ¡*}|jj||fd|ji|—ŽW5QR£SQRXdS)akReturn all sequence names in `schema`.
 
        :param schema: Optional, retrieve names from a non-default schema.
         For special quoting, use :class:`.quoted_name`.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        r7N)ryr`Úget_sequence_namesr7r€r>r>r?rµs
ÿÿÿzInspector.get_sequence_names)Ú    view_namerr5r6c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)aÃReturn definition for the plain or materialized view called
        ``view_name``.
 
        :param view_name: Name of the view.
        :param schema: Optional, retrieve names from a non-default schema.
         For special quoting, use :class:`.quoted_name`.
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        r7N)ryr`Úget_view_definitionr7)r2r¶rr5rxr>r>r?r·-s
ÿÿÿzInspector.get_view_definitionúList[ReflectedColumn]c    KsF| ¡$}|jj|||fd|ji|—Ž}W5QRX|rB| |g¡|S)aJReturn information about columns in ``table_name``.
 
        Given a string ``table_name`` and an optional string ``schema``,
        return column information as a list of :class:`.ReflectedColumn`.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: list of dictionaries, each representing the definition of
         a database column.
 
        .. seealso:: :meth:`Inspector.get_multi_columns`.
 
        r7)ryr`Ú get_columnsr7Ú_instantiate_types)r2rrr5rxÚcol_defsr>r>r?r¹As
ÿÿÿ zInspector.get_columnszIterable[List[ReflectedColumn]])Údatar6cCs4|D]*}|D] }|d}t|tƒs |ƒ|d<q qdS)NÚtype)r:r!)r2r¼r»Zcol_defÚcoltyper>r>r?rºcs
 
zInspector._instantiate_typesú%Dict[TableKey, List[ReflectedColumn]]c
KsL| ¡,}t|jj|f|||||jdœ|—Žƒ}W5QRX| | ¡¡|S)aWReturn information about columns in all objects in the given
        schema.
 
        The objects can be filtered by passing the names to use to
        ``filter_names``.
 
        For each table the value is a list of :class:`.ReflectedColumn`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if columns of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are list of dictionaries, each representing the
         definition of a database column.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_columns`
        r¯)ryr±r`Úget_multi_columnsr7rºÚvalues)r2rr¬r­r®r5rxZtable_col_defsr>r>r?rÀms ,
ÿúùÿ zInspector.get_multi_columnsr*c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)a`Return information about primary key constraint in ``table_name``.
 
        Given a string ``table_name``, and an optional string `schema`, return
        primary key information as a :class:`.ReflectedPrimaryKeyConstraint`.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary representing the definition of
         a primary key constraint.
 
        .. seealso:: :meth:`Inspector.get_multi_pk_constraint`
        r7N)ryr`Úget_pk_constraintr7rƒr>r>r?r¨s
ÿÿÿzInspector.get_pk_constraintz-Dict[TableKey, ReflectedPrimaryKeyConstraint]c
KsF| ¡4}t|jj|f|||||jdœ|—ŽƒW5QR£SQRXdS)auReturn information about primary key constraints in
        all tables in the given schema.
 
        The tables can be filtered by passing the names to use to
        ``filter_names``.
 
        For each table the value is a :class:`.ReflectedPrimaryKeyConstraint`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if primary keys of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are dictionaries, each representing the
         definition of a primary key constraint.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_pk_constraint`
        r¯N)ryr±r`Úget_multi_pk_constraintr7©r2rr¬r­r®r5rxr>r>r?rÃÅs+
ÿúùÿz!Inspector.get_multi_pk_constraintú#List[ReflectedForeignKeyConstraint]c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)agReturn information about foreign_keys in ``table_name``.
 
        Given a string ``table_name``, and an optional string `schema`, return
        foreign key information as a list of
        :class:`.ReflectedForeignKeyConstraint`.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a list of dictionaries, each representing the
         a foreign key definition.
 
        .. seealso:: :meth:`Inspector.get_multi_foreign_keys`
        r7N)ryr`Úget_foreign_keysr7rƒr>r>r?rÆýs
ÿÿÿzInspector.get_foreign_keysú3Dict[TableKey, List[ReflectedForeignKeyConstraint]]c
KsF| ¡4}t|jj|f|||||jdœ|—ŽƒW5QR£SQRXdS)aoReturn information about foreign_keys in all tables
        in the given schema.
 
        The tables can be filtered by passing the names to use to
        ``filter_names``.
 
        For each table the value is a list of
        :class:`.ReflectedForeignKeyConstraint`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if foreign keys of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are list of dictionaries, each representing
         a foreign key definition.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_foreign_keys`
        r¯N)ryr±r`rr7rÄr>r>r?rs-
ÿúùÿz Inspector.get_multi_foreign_keysúList[ReflectedIndex]c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)a=Return information about indexes in ``table_name``.
 
        Given a string ``table_name`` and an optional string `schema`, return
        index information as a list of :class:`.ReflectedIndex`.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a list of dictionaries, each representing the
         definition of an index.
 
        .. seealso:: :meth:`Inspector.get_multi_indexes`
        r7N)ryr`Ú get_indexesr7rƒr>r>r?rÉVs
ÿÿÿzInspector.get_indexesú$Dict[TableKey, List[ReflectedIndex]]c
KsF| ¡4}t|jj|f|||||jdœ|—ŽƒW5QR£SQRXdS)aPReturn information about indexes in in all objects
        in the given schema.
 
        The objects can be filtered by passing the names to use to
        ``filter_names``.
 
        For each table the value is a list of :class:`.ReflectedIndex`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if indexes of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are list of dictionaries, each representing the
         definition of an index.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_indexes`
        r¯N)ryr±r`Úget_multi_indexesr7rÄr>r>r?rËts,
ÿúùÿzInspector.get_multi_indexesúList[ReflectedUniqueConstraint]c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)a~Return information about unique constraints in ``table_name``.
 
        Given a string ``table_name`` and an optional string `schema`, return
        unique constraint information as a list of
        :class:`.ReflectedUniqueConstraint`.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a list of dictionaries, each representing the
         definition of an unique constraint.
 
        .. seealso:: :meth:`Inspector.get_multi_unique_constraints`
        r7N)ryr`Úget_unique_constraintsr7rƒr>r>r?rÍ­s
ÿÿÿz Inspector.get_unique_constraintsú/Dict[TableKey, List[ReflectedUniqueConstraint]]c
KsF| ¡4}t|jj|f|||||jdœ|—ŽƒW5QR£SQRXdS)a„Return information about unique constraints in all tables
        in the given schema.
 
        The tables can be filtered by passing the names to use to
        ``filter_names``.
 
        For each table the value is a list of
        :class:`.ReflectedUniqueConstraint`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if constraints of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are list of dictionaries, each representing the
         definition of an unique constraint.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_unique_constraints`
        r¯N)ryr±r`Úget_multi_unique_constraintsr7rÄr>r>r?rÏÌs-
ÿúùÿz&Inspector.get_multi_unique_constraintsr+c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)a«Return information about the table comment for ``table_name``.
 
        Given a string ``table_name`` and an optional string ``schema``,
        return table comment information as a :class:`.ReflectedTableComment`.
 
        Raises ``NotImplementedError`` for a dialect that does not support
        comments.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary, with the table comment.
 
        .. versionadded:: 1.2
 
        .. seealso:: :meth:`Inspector.get_multi_table_comment`
        r7N)ryr`Úget_table_commentr7rƒr>r>r?rÐs
ÿÿÿzInspector.get_table_commentz%Dict[TableKey, ReflectedTableComment]c
KsF| ¡4}t|jj|f|||||jdœ|—ŽƒW5QR£SQRXdS)a¦Return information about the table comment in all objects
        in the given schema.
 
        The objects can be filtered by passing the names to use to
        ``filter_names``.
 
        For each table the value is a :class:`.ReflectedTableComment`.
 
        Raises ``NotImplementedError`` for a dialect that does not support
        comments.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if comments of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are dictionaries, representing the
         table comments.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_table_comment`
        r¯N)ryr±r`Úget_multi_table_commentr7rÄr>r>r?rÑ(s/
ÿúùÿz!Inspector.get_multi_table_commentúList[ReflectedCheckConstraint]c
Ks>| ¡,}|jj|||fd|ji|—ŽW5QR£SQRXdS)ayReturn information about check constraints in ``table_name``.
 
        Given a string ``table_name`` and an optional string `schema`, return
        check constraint information as a list of
        :class:`.ReflectedCheckConstraint`.
 
        :param table_name: string name of the table.  For special quoting,
         use :class:`.quoted_name`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a list of dictionaries, each representing the
         definition of a check constraints.
 
        .. seealso:: :meth:`Inspector.get_multi_check_constraints`
        r7N)ryr`Úget_check_constraintsr7rƒr>r>r?rÓds
ÿÿÿzInspector.get_check_constraintsú.Dict[TableKey, List[ReflectedCheckConstraint]]c
KsF| ¡4}t|jj|f|||||jdœ|—ŽƒW5QR£SQRXdS)a€Return information about check constraints in all tables
        in the given schema.
 
        The tables can be filtered by passing the names to use to
        ``filter_names``.
 
        For each table the value is a list of
        :class:`.ReflectedCheckConstraint`.
 
        :param schema: string schema name; if omitted, uses the default schema
         of the database connection.  For special quoting,
         use :class:`.quoted_name`.
 
        :param filter_names: optionally return information only for the
         objects listed here.
 
        :param kind: a :class:`.ObjectKind` that specifies the type of objects
         to reflect. Defaults to ``ObjectKind.TABLE``.
 
        :param scope: a :class:`.ObjectScope` that specifies if constraints of
         default, temporary or any tables should be reflected.
         Defaults to ``ObjectScope.DEFAULT``.
 
        :param \**kw: Additional keyword argument to pass to the dialect
         specific implementation. See the documentation of the dialect
         in use for more information.
 
        :return: a dictionary where the keys are two-tuple schema,table-name
         and the values are list of dictionaries, each representing the
         definition of a check constraints.
         The schema is ``None`` if no schema is provided.
 
        .. versionadded:: 2.0
 
        .. seealso:: :meth:`Inspector.get_check_constraints`
        r¯N)ryr±r`Úget_multi_check_constraintsr7rÄr>r>r?rՃs-
ÿúùÿz%Inspector.get_multi_check_constraintsr>Tzsa_schema.TablezOptional[Collection[str]]zCollection[str]zOptional[Set[sa_schema.Table]]zOptional[_ReflectionInfo])ÚtableÚinclude_columnsÚexclude_columnsÚ resolve_fksÚ
_extend_onÚ _reflect_infor6c s²|dk    rˆ|krdS| ˆ¡|jj}| ¡}| ˆ¡}    W5QRXˆj}
‡fdd„|jDƒ} |    |
f} |dksx| |jkrœ|j|    f|
gt    j
t j
|dœˆj —Ž}| |j kr°|j | ‚| |jkrÄt |
¡‚|jrä|j | ¡} | r䈠| ¡d}i}|j| D]}d}| ˆ||||¡qö|s0| |
|    ¡s0t |
¡‚| || ˆ||¡| || ˆ|||||| ¡    | || ˆ|||| ¡| || ˆ|||| ¡| || ˆ|||| ¡| || ˆ| ¡dS)aZGiven a :class:`_schema.Table` object, load its internal
        constructs based on introspection.
 
        This is the underlying method used by most dialects to produce
        table reflection.  Direct usage is like::
 
            from sqlalchemy import create_engine, MetaData, Table
            from sqlalchemy import inspect
 
            engine = create_engine('...')
            meta = MetaData()
            user_table = Table('user', meta)
            insp = inspect(engine)
            insp.reflect_table(user_table, None)
 
        .. versionchanged:: 1.4 Renamed from ``reflecttable`` to
           ``reflect_table``
 
        :param table: a :class:`~sqlalchemy.schema.Table` instance.
        :param include_columns: a list of string column names to include
          in the reflection process.  If ``None``, all columns are reflected.
 
        Ncs$i|]}|ˆjkr|ˆj |¡“qSr>)Údialect_kwargsrE©r<rA©rÖr>r?Ú
<dictcomp>ïs
þz+Inspector.reflect_table.<locals>.<dictcomp>)r¬r­r®rÛFT)rŸr\r`ryZschema_for_objectr‘Úreflection_optionsÚcolumnsÚ_get_reflection_inforRrWrXrÜr8rZNoSuchTableErrorÚ table_optionsrEZ_validate_dialect_kwargsÚ_reflect_columnr‚Ú _reflect_pkÚ _reflect_fkÚ_reflect_indexesÚ_reflect_unique_constraintsÚ_reflect_check_constraintsÚ_reflect_table_comment)r2rÖr×rØrÙrÚrÛr`rxrrràrZtbl_optsZ found_tableÚcols_by_orig_nameÚcol_dr>rÞr?Ú reflect_table½s¾!
 
 
þÿûú
 
 
 
 
û    
ÿ÷ ù
ù
ù
üzInspector.reflect_tabler'z Dict[str, sa_schema.Column[Any]])rÖrìr×rØrër6csxˆd}|jj ||ˆ¡|j ||ˆ¡ˆd}|r>||ksJ|rN||krNdSˆd}‡fdd„dDƒ}    dˆkr~|     ˆd¡g}
ˆ d¡dk    rîˆd} | dk    s¤t‚t| tƒr¾tj    | dd    } n&t| tj
ƒsàtj    t   | ¡dd    } n| } |
  | ¡d
ˆkrtjfˆd
Ž} |
  | ¡d ˆkr6tjfˆd Ž}|
  |¡tj||f|
ž|    Ž||<}|j|jkrfd|_|j|dd dS) Nr‘r½csi|]}|ˆkr|ˆ|“qSr>r>rÝ©rìr>r?rßns÷z-Inspector._reflect_column.<locals>.<dictcomp>)ZnullableZ autoincrementÚquoteÚinforJÚcommentÚdialect_optionsÚdefaultT)Z
_reflectedÚcomputedÚidentity)Zreplace_existing)ÚmetadataÚdispatchZcolumn_reflectr¤rEÚAssertionErrorr:r Ú    sa_schemaZ DefaultClauseZ FetchedValuerÚtextÚappendZComputedZIdentityZColumnrJÚ primary_keyZ append_column)r2rÖrìr×rØrëÚ    orig_namer‘r¾Zcol_kwZcolargsZ default_textrórôrõÚcolr>rîr?räTsj    ÿ ÿÿ
þ  
ÿ ÿ
 
 
 
 
ÿÿÿ zInspector._reflect_columnÚ_ReflectionInfor-)rÛrrÖrërØr6csV|j |¡}|rR‡‡fdd„|dDƒ}| d¡|j_| dd¡|j_|j |¡dS)Ncs$g|]}|ˆkr|ˆkrˆ|‘qSr>r>)r<Úpk©rërØr>r?rŒ©sþz)Inspector._reflect_pk.<locals>.<listcomp>Úconstrained_columnsr‘rñ)Ú pk_constraintrErür‘rñZ_reload)r2rÛrrÖrërØZpk_consZpk_colsr>rr?råŸs  þzInspector._reflect_pk)
rÛrrÖrër×rØrÙrÚràr6c
s˜|j |g¡}
|
D]~} | d} ‡fdd„| dDƒ} |rHt| ƒ |¡s|r\t| ƒ |¡r\q| d}| d}| d}g}|dk    rÈ|r¦tj||jf||j||dœ|    —Ž|D]}|     d     
|||g¡¡qªnF|rðtj||jf|jtj ||d
œ|    —Ž|D]}|     d     
||g¡¡qôd | kr"| d }ni}z,|  tj | || fd |  d ¡dœ|—Ž¡Wqtjk
rt d|j›d| ›dd 
| ¡›d¡YqXqdS)Nr‘cs"g|]}|ˆkrˆ|jn|‘qSr>)rJ)r<Úc©rër>r?rŒÈsÿz)Inspector._reflect_fk.<locals>.<listcomp>rr•r”Úreferred_columns)rÚ autoload_withrÚrÛÚ.)rrrÚrÛÚoptionsTrñ)Z link_to_namerñzOn reflected table z0, skipping reflection of foreign key constraint z-; one or more subject columns within name(s) z, z are not present in the table)Ú foreign_keysrErœÚ intersectionr™rùZTablerör\rûÚjoinZ BLANK_SCHEMAÚappend_constraintZForeignKeyConstraintrZConstraintColumnNotFoundErrorrÚwarnr‘)r2rÛrrÖrër×rØrÙrÚràr¥Zfkey_dÚconnamerr•r”rZrefspecÚcolumnr    r>rr?ræ·sŒ 
 
þÿ þü ûþúù    ÿþúù    
 
ýûúÿ
ÿzInspector._reflect_fk)ZascÚdescZ nulls_firstZ
nulls_last)rÛrrÖrër×rØràr6c Cs|j |g¡}|D]v}    |    d}
|    d} |     d¡} |     di¡} |    d}|     dd¡}|     di¡}|     d    ¡}|r|t| ƒ |¡s|q|r‚qg}t| ƒD]Þ\}}|dkrØ| sÈt d
|›d |
›d |d ›d¡qt | |¡}nŠz ||krì||}n
|j    |}Wn6t
k
r.t |›d|›d|j ›¡YqŽYnX|  |d¡D]$}||j kr<|j |}||ƒ}q<|  |¡qŽtj|
f|ž||dœ|—ŽqdS)Nr‘Ú column_namesÚ expressionsÚcolumn_sortingrr½ÚindexròZduplicates_constraintz    Skipping ú z  because key rz5 reflected as None but no 'expressions' were returnedz key z& was not located in columns for table r>)Z_tabler)ÚindexesrErœÚissubsetÚ    enumeraterrrrúrÚKeyErrorr‘Ú_index_sort_exprsrûrùZIndex)r2rÛrrÖrër×rØràrZindex_dr‘rárrrZflavorròÚ
duplicatesZ idx_elementsrrZ idx_elementÚoptionÚopr>r>r?rçs^ 
 
 
ÿ
ÿ
 
  ÿþüûzInspector._reflect_indexesc
CsÒ|j |g¡}|D]º}    |    d}
|    d} |     d¡} |     d¡} |rNt| ƒ |¡sNq| rTqg}| D]V}z||krr||n|j|}Wn(tk
r¦t d||jf¡Yq\X|     |¡q\| 
t j ||
| dœŽ¡qdS)Nr‘rrñZduplicates_indexzDunique constraint key '%s' was not located in columns for table '%s')r‘rñ) Úunique_constraintsrErœrrrrrr‘rûr rùZUniqueConstraint)r2rÛrrÖrër×rØràÚ constraintsÚconst_drrárñrZconstrained_colsrZconstrained_colr>r>r?rèYs>
 
 
ÿ
ýÿÿ
 ÿÿz%Inspector._reflect_unique_constraintsc
Cs.|j |g¡}|D]}    | tjf|    Ž¡qdSr9)Úcheck_constraintsrEr rùZCheckConstraint)
r2rÛrrÖrër×rØràr r!r>r>r?ré…s
z$Inspector._reflect_check_constraints)rÛrrÖràr6cCs|j |¡}|r|d|_dS©Nrú)Ú table_commentrErñ)r2rÛrrÖràZ comment_dictr>r>r?rê“s z Inspector._reflect_table_comment)rr¬Ú    availablerÛr5r6c     sâ|ˆd<ˆr.|r.tˆƒdkr.tˆƒt|ƒ‰nd‰iˆd<}d‰dddœddddd    œ‡‡‡‡‡fd
d „}t|ˆjdd |ˆjƒ|ˆjƒ|ˆjƒ|ˆjdd |ˆjdd |ˆjdd |ˆj    dd |d    }|rÚ| 
|¡|S|SdS)Nrédr8TF)ÚoptionalÚcheck_filter_names_from_methrr^)Úmethr'r(r6csxˆdksˆdksˆj |j¡s$ˆ}nd}z,ˆrN|fd|iˆ—Ž}|rR|sRd‰ni}Wntk
rr|sj‚i}YnX|S)Ngà?r¬F)r`Z_overrides_defaultrFÚNotImplementedError)r)r'r(Ú_fnr²©r¬ÚfractionZ
has_resultr5r2r>r?Úrun²s& ÿþ ý
z+Inspector._get_reflection_info.<locals>.run)r()r')    rárr
rrr$r"rãr8) ÚlenrÿrÀrÃrrËrÏrÑrÕr°r¤)    r2rr¬r%rÛr5r8r.rðr>r,r?râžsB ü$#ÿÿ ÿ ñ
zInspector._get_reflection_info)N)N)N)N)N)r9)N)N)N)N)N)N)N)N)N)N)N)N)r>TNN)NNNN)MrFrSrTrUÚ__annotations__rÚ
deprecatedrdÚ classmethodrjrbrmrlrtrurZ    _inspectsrrvrrwÚ
contextlibÚcontextmanagerryr{Úpropertyr|r}rr‚r…r‡r‰rrr§r¨rªrRrVrXrYr°r³r´rµr·r¹rºrÀrÂrÃrÆrrÉrËrÍrÏrÐrÑrÓrÕrírärårærZasc_opZdesc_opZnulls_first_opZ nulls_last_oprrçrèrérêrâr>r>r>r?r[¬s
þ   þ  
ÿ"ÿ"ÿüþ/þNÿ!û:ÿÿÿÿÿ" û<ÿû9ÿ!û;ÿ û:ÿ!û;ÿ$û=ÿ!û>ùK ZüB, ûr[c@s eZdZdZeddœdd„ƒZeddœdd„ƒZed    dœd
d „ƒZed dœd d„ƒZeddœdd„ƒZ    eddœdd„ƒZ
eddœdd„ƒZ eddœdd„ƒZ dS)ÚReflectionDefaultsz5provides blank default values for reflection methods.r¸rqcCsgSr9r>©rir>r>r?ráñszReflectionDefaults.columnsr*cCs
dgdœS)N)r‘rr>r7r>r>r?rõsþz ReflectionDefaults.pk_constraintrÅcCsgSr9r>r7r>r>r?r
üszReflectionDefaults.foreign_keysrÈcCsgSr9r>r7r>r>r?rszReflectionDefaults.indexesrÌcCsgSr9r>r7r>r>r?rsz%ReflectionDefaults.unique_constraintsrÒcCsgSr9r>r7r>r>r?r"sz$ReflectionDefaults.check_constraintsr©cCsiSr9r>r7r>r>r?rã sz ReflectionDefaults.table_optionsr+cCsddiSr#r>r7r>r>r?r$sz ReflectionDefaults.table_commentN) rFrSrTrUr2rárr
rrr"rãr$r>r>r>r?r6ís"r6c@sfeZdZUded<ded<ded<ded<d    ed
<d ed <d ed<ded<ded<dddœdd„ZdS)rÿr¿ráz7Dict[TableKey, Optional[ReflectedPrimaryKeyConstraint]]rrÇr
rÊrrÎrz/Dict[TableKey, Optional[ReflectedTableComment]]r$rÔr"r«rãz+Dict[TableKey, exc.UnreflectableTableError]r8rk)Úotherr6cCsJ|j ¡D]:\}}t||ƒ}|dk    r
|dkr:t|||ƒq
| |¡q
dSr9)Ú__dict__rHÚgetattrÚsetattrr¤)r2r8rArBÚovr>r>r?r¤"s 
z_ReflectionInfo.updateN)rFrSrTr0r¤r>r>r>r?rÿs
rÿ)DrUÚ
__future__rr3Z dataclassesrÚenumrrrÚtypingrrr    r
r r r rrrrrrrÚbaserrÚrrrrrrrùZ sql.cache_keyrZ sql.elementsr Z sql.type_apir!Z sql.visitorsr"r#Z util.typingr$Z
interfacesr%r&r'r(r)r*r+r,r-r.rPrLrQrRrXZ_self_inspectsZ Inspectabler[r6rÿr>r>r>r?Ú<module>s                                           N'