
    -h                         S r SSKrSSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJ	r	  SSKJ
r
  SSK	Jr  SSK	Jr  SSKJr  SSK
Jr  \
R"                  S 5       r\R&                   " S S\5      5       rg)a  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..
    N   )Connectable)
Connection)Engine   )exc)
inspection)sql)util)	operators)schema)
TypeEngine)topologicalc                 
   UR                  SS 5      nUc  U " X/UQ70 UD6$ U R                  [        S U 5       5      [        S UR                  5        5       5      4nUR                  U5      nUc  U " X/UQ70 UD6nXuU'   U$ )N
info_cachec              3   h   #    U  H(  n[        U[        R                  5      (       d  M$  Uv   M*     g 7fN)
isinstancer   string_types).0as     qC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\sqlalchemy/engine/reflection.py	<genexpr>cache.<locals>.<genexpr>2   s!     BAAt/@/@!Aaas   #2	2c              3   <   #    U  H  u  pUS :w  d  M  X4v   M     g7f)r   N )r   kvs      r   r   r   3   s     AqL/@fqfs   
)get__name__tupleitems)fnselfconargskwr   keyrets           r   cacher*   +   s    d+J$)d)b))
BBBAAAC
 ..
C
{(T(R(3J    c                      \ rS rSrSr\R                  " SS5      S 5       r\S 5       r	S r
S rS	 r\\R                  " SS
5      S 5       5       r\R                  " \5      S 5       r\R                  " \5      S 5       r\R                  " \5      S 5       r\R.                  S 5       r\R.                  S 5       r\S 5       rS rS6S jrS6S jrS6S jrS6S jr S r!S r"S6S jr#S6S jr$S6S jr%S6S jr&S6S jr'S6S jr(S6S  jr)S6S! jr*S6S" jr+S6S# jr,S6S$ jr-\R\                  " S%S&5      S' 5       r/   S7S( jr0S) r1S* r2S+ r3S, r4S-\5Rl                  4S.\5Rn                  4S/\5Rp                  4S0\5Rr                  4/r:S1 r;S2 r<S3 r=S4 r>S5r?g)8	Inspector<   a  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.

z1.4a  The __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`.c                 $    U R                  U5      $ )aS  Initialize a new :class:`_reflection.Inspector`.

:param bind: a :class:`~sqlalchemy.engine.Connectable`,
  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`

)_init_legacyr$   binds     r   __init__Inspector.__init__U   s    .   &&r+   c                     [        UR                  S5      (       a  UR                  R                  n U R                  U 5      nU" X25        U$ )N	inspector)hasattrdialectr6   __new__)clsinitr2   r$   s       r   
_constructInspector._constructn   s?     4<<--,,((C{{3Tr+   c                 l    [        US5      (       a  U R                  U5        g U R                  U5        g )Nexec_driver_sql)r7   _init_connection_init_enginer1   s     r   r0   Inspector._init_legacyx   s,    4*++!!$'d#r+   c                     U=U l         U l        UR                  5       R                  5         SU l        U R                  R
                  U l        0 U l        g )NT)r2   engineconnectclose_op_context_requires_connectr8   r   )r$   rD   s     r   rA   Inspector._init_engine~   sC    "((	DK ,0){{**r+   c                     Xl         UR                  U l        SU l        U R                  R                  U l        0 U l        g )NF)r2   rD   rG   r8   r   )r$   
connections     r   r@   Inspector._init_connection   s4    	 '',1){{**r+   a  The 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`.c                 :    U R                  U R                  U5      $ )aR  Construct a new dialect-specific Inspector object from the given
engine or connection.

:param bind: a :class:`~sqlalchemy.engine.Connectable`,
  which is typically an instance of
  :class:`~sqlalchemy.engine.Engine` or
  :class:`~sqlalchemy.engine.Connection`.

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`.

)r<   r0   )r:   r2   s     r   from_engineInspector.from_engine   s    > ~~c..55r+   c                 J    [         R                  [         R                  U 5      $ r   )r-   r<   r0   r2   s    r   _connectable_inspInspector._connectable_insp   s    
 ##I$:$:DAAr+   c                 J    [         R                  [         R                  U 5      $ r   )r-   r<   rA   rP   s    r   _engine_inspInspector._engine_insp   s    ##I$:$:DAAr+   c                 J    [         R                  [         R                  U 5      $ r   )r-   r<   r@   rP   s    r   _connection_inspInspector._connection_insp   s    ##I$>$>EEr+   c              #     #    U R                   (       a  U R                  R                  5       nOU R                  n Uv   U R                   (       a  UR                  5         gg! U R                   (       a  UR                  5         f f = f7f)zReturn 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)rG   r2   rE   rF   r$   conns     r   _operation_contextInspector._operation_context   sc      ,,99$$&D99D	J00

 1t00

 1s   9B
A#  #B
#$BB
c              #      #    U R                  5        nU R                  U R                  R                  U5      nU R                  Ul        Uv   SSS5        g! , (       d  f       g= f7f)zmReturn an :class:`_reflection.Inspector`
from this one that will run all
operations on a single connection.

N)r\   r<   	__class__r@   r   )r$   r[   sub_insps      r   _inspection_contextInspector._inspection_context   sK      $$&$t~~'F'FMH"&//HN '&&s   A)<A	A)
A&"A)c                 .    U R                   R                  $ )zReturn 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.

)r8   default_schema_name)r$   s    r   rd   Inspector.default_schema_name   s     ||///r+   c                     [        U R                  S5      (       a=  U R                  5        nU R                  R                  XR                  S9sSSS5        $ / $ ! , (       d  f       / $ = f)zReturn all schema names.get_schema_namesr   N)r7   r8   r\   rg   r   rZ   s     r   rg   Inspector.get_schema_names   sa     4<<!344((*d||44__ 5  +* 		 +* 	s   #A
A*Nc                     U R                  5        nU R                  R                  X!U R                  S9sSSS5        $ ! , (       d  f       g= f)a  Return all table names in referred to 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`
method.


: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`.

.. seealso::

    :meth:`_reflection.Inspector.get_sorted_table_and_fkc_names`

    :attr:`_schema.MetaData.sorted_tables`

rh   N)r\   r8   get_table_namesr   r$   r   r[   s      r   rk   Inspector.get_table_names   s>    . $$&$<<// 0  '&&	   $?
Ac                     U R                  5        nU R                  R                  X1U5      sSSS5        $ ! , (       d  f       g= f)a%  Return True if the backend has a 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.

.. versionadded:: 1.4 - the :meth:`.Inspector.has_table` method
   replaces the :meth:`_engine.Engine.has_table` method.

N)r\   r8   	has_table)r$   
table_namer   r[   s       r   rp   Inspector.has_table  s2     $$&$<<))$FC '&&	   7
Ac                     U R                  5        nU R                  R                  X1U5      sSSS5        $ ! , (       d  f       g= f)zReturn True if the backend has a table of the given name.

:param sequence_name: name of the table to check
:param schema: schema name to query, if not the default schema.

.. versionadded:: 1.4

N)r\   r8   has_sequence)r$   sequence_namer   r[   s       r   ru   Inspector.has_sequence  s2     $$&$<<,,T&I '&&rs   c                 Z  ^ U R                  5        nU R                  R                  X!U R                  S9nSSS5        [	        5       n[	        5       n0 nW H]  nU R                  Xq5      n[	        U V	s/ s H  oS   PM	     sn	5      Xg'   U H#  n
XzS   :w  d  M  UR                  U
S   U45        M%     M_      [        [        R                  " XC5      5      nU Vs/ s H  nXvU   R                  U5      4PM     snS[        U5      4/-   $ ! , (       d  f       N= fs  sn	f ! [        R                   an  nUR                   H5  mUR                  T5        UR                  U4S jUTS       5       5        M7     [        [        R                  " XC5      5      n SnANSnAff = fs  snf )a	  Return 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.

.. versionadded:: 1.0.-

.. seealso::

    :meth:`_reflection.Inspector.get_table_names`

    :func:`.sort_tables_and_constraints` - similar method which works
    with an already-given :class:`_schema.MetaData`.

rh   Nnamereferred_tablec              3   2   >#    U  H  nTS    U4v   M     g7f)r   Nr   )r   fkcedges     r   r   ;Inspector.get_sorted_table_and_fkc_names.<locals>.<genexpr>W  s      &.HsT!WcN.Hs   r   )r\   r8   rk   r   setget_foreign_keysaddlistr   sortr   CircularDependencyErroredgesremoveupdate
difference)r$   r   r[   tnamestuplesremaining_fkcsfknames_for_tabletnamefkeysfkfkeycandidate_sorterrr}   s                @r   get_sorted_table_and_fkc_names(Inspector.get_sorted_table_and_fkc_names*  s   2 $$&$\\11 2 F '
 E))%8E'*+G2vJ+G'H$!122JJ%5 6>?  		D!+"2"26"BCN (
' e,77GH'
 D()*+ 	+3 '& ,H ** 	D		d#%% &.?Q.H&  " "+"2"26"BCN	D
s0   %D4D
9D# F(
D#F%7A$F  F%c                     U R                  5        nU R                  R                  XR                  S9sSSS5        $ ! , (       d  f       g= f)zReturn a list of temporary table names for the current bind.

This method is unsupported by most dialects; currently
only SQLite implements it.

.. versionadded:: 1.0.0

rh   N)r\   r8   get_temp_table_namesr   rZ   s     r   r   Inspector.get_temp_table_namesa  s<     $$&$<<44 5  '&&	   #>
Ac                     U R                  5        nU R                  R                  XR                  S9sSSS5        $ ! , (       d  f       g= f)zReturn a list of temporary view names for the current bind.

This method is unsupported by most dialects; currently
only SQLite implements it.

.. versionadded:: 1.0.0

rh   N)r\   r8   get_temp_view_namesr   rZ   s     r   r   Inspector.get_temp_view_namesp  s<     $$&$<<33 4  '&&r   c                     [        U R                  S5      (       aD  U R                  5        nU R                  R                  " XAU4SU R                  0UD6sSSS5        $ 0 $ ! , (       d  f       0 $ = f)a  Return a dictionary of options specified when the table of the
given name was created.

This currently includes some options that apply to MySQL 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`.

get_table_optionsr   N)r7   r8   r\   r   r   r$   rq   r   r'   r[   s        r   r   Inspector.get_table_options~  sn     4<<!455((*d||55f9=LN +* 		 +* 	s   *A""
A1c                     U R                  5        nU R                  R                  X!U R                  S9sSSS5        $ ! , (       d  f       g= f)zReturn all view names in `schema`.

:param schema: Optional, retrieve names from a non-default schema.
 For special quoting, use :class:`.quoted_name`.

rh   N)r\   r8   get_view_namesr   rl   s      r   r   Inspector.get_view_names  s>     $$&$<<.. /  '&&rn   c                     U R                  5        nU R                  R                  X!U R                  S9sSSS5        $ ! , (       d  f       g= f)zReturn all sequence names in `schema`.

:param schema: Optional, retrieve names from a non-default schema.
 For special quoting, use :class:`.quoted_name`.

rh   N)r\   r8   get_sequence_namesr   rl   s      r   r   Inspector.get_sequence_names  s>     $$&$<<22 3  '&&rn   c                     U R                  5        nU R                  R                  X1X R                  S9sSSS5        $ ! , (       d  f       g= f)zReturn definition for `view_name`.

:param schema: Optional, retrieve names from a non-default schema.
 For special quoting, use :class:`.quoted_name`.

rh   N)r\   r8   get_view_definitionr   )r$   	view_namer   r[   s       r   r   Inspector.get_view_definition  s>     $$&$<<33OO 4  '&&rn   c                    U R                  5        nU R                  R                  " XAU4SU R                  0UD6nSSS5        W H)  nUS   n[	        U[
        5      (       a  M  U" 5       US'   M+     U$ ! , (       d  f       N?= f)a  Return information about columns in `table_name`.

Given a string `table_name` and an optional string `schema`, return
column information as a list of dicts with these keys:

* ``name`` - the column's name

* ``type`` - the type of this column; an instance of
  :class:`~sqlalchemy.types.TypeEngine`

* ``nullable`` - boolean flag if the column is NULL or NOT NULL

* ``default`` - the column's server default value - this is returned
  as a string SQL expression.

* ``autoincrement`` - indicates that the column is auto incremented -
  this is returned as a boolean or 'auto'

* ``comment`` - (optional) the comment on the column. Only some
  dialects return this key

* ``computed`` - (optional) when present it indicates that this column
  is computed by the database. Only some dialects return this key.
  Returned as a dict with the keys:

  * ``sqltext`` - the expression used to generate this column returned
    as a string SQL expression

  * ``persisted`` - (optional) boolean that indicates if the column is
    stored in the table

  .. versionadded:: 1.3.16 - added support for computed reflection.

* ``identity`` - (optional) when present it indicates that this column
  is a generated always column. Only some dialects return this key.
  For a list of keywords on this dict see :class:`_schema.Identity`.

  .. versionadded:: 1.4 - added support for identity column reflection.

* ``dialect_options`` - (optional) a dict with dialect specific options

: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`.

:return: list of dictionaries, each representing the definition of
 a database column.

r   Ntype)r\   r8   get_columnsr   r   r   )r$   rq   r   r'   r[   col_defscol_defcoltypes           r   r   Inspector.get_columns  s    l $$&$||//&59__HJH '  GfoGgz22"))	  
  '&s   +A55
Bc                     U R                  5        nU R                  R                  " XAU4SU R                  0UD6sSSS5        $ ! , (       d  f       g= f)aH  Return information about primary key constraint on `table_name`.

Given a string `table_name`, and an optional string `schema`, return
primary key information as a dictionary with these keys:

* ``constrained_columns`` -
  a list of column names that make up the primary key

* ``name`` -
  optional name of the primary key constraint.

: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`.

r   N)r\   r8   get_pk_constraintr   r   s        r   r   Inspector.get_pk_constraint  sI    ( $$&$<<11&59__HJ '&&   *A
Ac                     U R                  5        nU R                  R                  " XAU4SU R                  0UD6sSSS5        $ ! , (       d  f       g= f)a'  Return 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 dicts with these keys:

* ``constrained_columns`` -
  a list of column names that make up the foreign key

* ``referred_schema`` -
  the name of the referred schema

* ``referred_table`` -
  the name of the referred table

* ``referred_columns`` -
  a list of column names in the referred table that correspond to
  constrained_columns

* ``name`` -
  optional name of the foreign key constraint.

: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`.

r   N)r\   r8   r   r   r   s        r   r   Inspector.get_foreign_keys  sI    > $$&$<<00&59__HJ '&&r   c                     U R                  5        nU R                  R                  " XAU4SU R                  0UD6sSSS5        $ ! , (       d  f       g= f)aW  Return information about indexes in `table_name`.

Given a string `table_name` and an optional string `schema`, return
index information as a list of dicts with these keys:

* ``name`` -
  the index's name

* ``column_names`` -
  list of column names in order

* ``unique`` -
  boolean

* ``column_sorting`` -
  optional dict mapping column names to tuple of sort keywords,
  which may include ``asc``, ``desc``, ``nulls_first``, ``nulls_last``.

  .. versionadded:: 1.3.5

* ``dialect_options`` -
  dict of dialect-specific index options.  May not be present
  for all dialects.

  .. versionadded:: 1.0.0

: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`.

r   N)r\   r8   get_indexesr   r   s        r   r   Inspector.get_indexes8  sJ    H $$&$<<++&59__HJ '&&r   c                     U R                  5        nU R                  R                  " XAU4SU R                  0UD6sSSS5        $ ! , (       d  f       g= f)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 dicts with these keys:

* ``name`` -
  the unique constraint's name

* ``column_names`` -
  list of column names in order

: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`.

r   N)r\   r8   get_unique_constraintsr   r   s        r   r    Inspector.get_unique_constraintsa  sI    * $$&$<<66&59__HJ '&&r   c                     U R                  5        nU R                  R                  " XAU4SU R                  0UD6sSSS5        $ ! , (       d  f       g= f)aP  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 dictionary with these keys:

* ``text`` -
    text of the comment.

Raises ``NotImplementedError`` for a dialect that does not support
comments.

.. versionadded:: 1.2

r   N)r\   r8   get_table_commentr   r   s        r   r   Inspector.get_table_comment{  sI      $$&$<<11&59__HJ '&&r   c                     U R                  5        nU R                  R                  " XAU4SU R                  0UD6sSSS5        $ ! , (       d  f       g= f)a  Return 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 dicts with these keys:

* ``name`` -
  the check constraint's name

* ``sqltext`` -
  the check constraint's SQL expression

* ``dialect_options`` -
  may or may not be present; a dictionary with additional
  dialect-specific options for this CHECK constraint

  .. versionadded:: 1.3.8

: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`.

.. versionadded:: 1.1.0

r   N)r\   r8   get_check_constraintsr   r   s        r   r   Inspector.get_check_constraints  sI    : $$&$<<55&59__HJ '&&r   z*:meth:`_reflection.Inspector.reflecttable`zThe :meth:`_reflection.Inspector.reflecttable` method was renamed to :meth:`_reflection.Inspector.reflect_table`. This deprecated alias will be removed in a future release.c                 &    U R                   " U0 UD6$ )z1See reflect_table. This method name is deprecated)reflect_table)r$   r&   kwargss      r   reflecttableInspector.reflecttable  s     !!42622r+   c                 x  ^ Ub  TU;   a  gUR                  T5        U R                  R                  nU R                  5        nUR	                  T5      nSSS5        TR
                  n	[        U4S jUR                   5       5      n
U R                  " U	W40 TR                  D6nU(       a  TR                  U5        [        R                  (       a`  [        U[        5      (       a  UR                  UR                   5      n[        U	[        5      (       a  U	R                  UR                   5      n	Sn0 nU R"                  " X40 TR                  D6 H  nSnU R%                  TUUUU5        M     U(       d,  U R'                  X5      (       d  [(        R*                  " U	5      eU R-                  XTX5        U R/                  U	UTUUUUUU
5	        U R1                  U	UTUUUU
5        U R3                  U	UTUUUU
5        U R5                  U	UTUUUU
5        U R7                  XTU
5        g! , (       d  f       GN= f)a  Given 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.

Nc              3      >#    U  H4  nUTR                   ;   d  M  UTR                   R                  U5      4v   M6     g 7fr   )dialect_kwargsr   )r   r   tables     r   r   *Inspector.reflect_table.<locals>.<genexpr>  s>      "
/E((( -Q$$((+,/s   ?$?FT)r   r2   r8   r\   schema_for_objectry   dictreflection_optionsr   r   _validate_dialect_kwargsr   py2kr   strdecodeencodingr   _reflect_columnrp   r   NoSuchTableError_reflect_pk_reflect_fk_reflect_indexes_reflect_unique_constraints_reflect_check_constraints_reflect_table_comment)r$   r   include_columnsexclude_columnsresolve_fks
_extend_onr8   r[   r   rq   r   tbl_optsfound_tablecols_by_orig_namecol_ds    `             r   r   Inspector.reflect_table  sP   @ !
"u%))##$$&$++E2F ' ZZ
 " "
//"
 
 ))
"'"6"6
  **8499&#&&w'7'78*c**'..w/?/?@
%%
"'"6"6
E K  !
 4>>*#E#E&&z22'8	
 	
	
 		
 	((	
 	''	
 	##'9	
A '&s   H**
H9c                 .  ^ TS   nUR                   R                  R                  XT5        UR                  R                  XT5        TS   nU(       a  Xs;  d  U(       a  Xt;   a  g TS   n[        U4S jS 5       5      n	ST;   a  U	R	                  TS   5        / n
TR                  S5      b  TS   n[        U[        R                  R                  5      (       a  [        R                  " USS9nOK[        U[        R                  5      (       d,  [        R                  " [        R                  " TS   5      SS9nU
R                  U5        S	T;   a*  [        R                  " S0 TS	   D6nU
R                  U5        S
T;   a*  [        R                   " S0 TS
   D6nU
R                  U5        ST;   a  U R#                  TU
5        [        R$                  " Xx/U
Q70 U	D6=XV'   nUR&                  UR(                  ;   a  SUl        UR+                  USS9  g )Nry   r   c              3   B   >#    U  H  nUT;   d  M  UTU   4v   M     g 7fr   r   )r   r   r   s     r   r   ,Inspector._reflect_column.<locals>.<genexpr>\  s/      
 Ez QaMs   
)nullableautoincrementquoteinfor(   commentdialect_optionsdefaultT)
_reflectedcomputedidentitysequence)replace_existingr   )metadatadispatchcolumn_reflectr   r   r   r   r
   elements
TextClause	sa_schemaDefaultClauseFetchedValuetextappendComputedIdentity_reflect_col_sequenceColumnr(   primary_keyappend_column)r$   r   r   r   r   r   	orig_namery   r   col_kwcolargsr   r   cols     `           r   r   Inspector._reflect_columnI  s    &M	..tEB%%d59 V} ; 7- 

 
 %MM% 12399Y+I&G'3<<#:#:;;#11'dK)?)?@@#11HHU9-.4 NN7# ))>E*,=>HNN8$ ))>E*,=>HNN8$&&ug6-6-=-=.
#.
'-.
 	
$s 77e'''"COC$7r+   c                     SU;   aR  US   n[         R                  " US   SS5      nSU;   a
  US   Ul        SU;   a
  US   Ul        UR	                  U5        g g )Nr   ry   r   start	increment)r   Sequencer  r  r   )r$   r   r  seqr   s        r   r  Inspector._reflect_col_sequence  sd    
#C ))#f+q!<H#~!$Wc!%(%5"NN8$ r+   c                    U R                   " X40 UR                  D6nU(       aa  US    Vs/ s H  nXt;   d  M
  Xu;  d  M  XG   PM     nnUR                  S5      UR                  l        UR                  R                  U5        g g s  snf )Nconstrained_columnsry   )r   r   r   r  ry   _reload)	r$   rq   r   r   r   r   pk_conspkpk_colss	            r   r   Inspector._reflect_pk  s     ((
"'"6"6
  ""788B* &/1/H &!%8   &-[[%8E" %%g. s   	BB Bc
           	         U R                   " X40 UR                  D6n
U
 GH  nUS   nUS    Vs/ s H  nX;   a  XM   R                  OUPM     nnU(       a  [        U5      R	                  U5      (       d&  U(       a!  [        U5      R                  U5      (       a  M  US   nUS   nUS   n/ nUbd  U(       a0  [        R                  " UUR                  4UU R                  US.U	D6  U H&  nUR                  SR                  UUU/5      5        M(     OpU(       a>  [        R                  " UUR                  4U R                  [        R                  US.U	D6  U H%  nUR                  SR                  UU/5      5        M'     S	U;   a  US	   nO0 nUR                  [        R                  " UUU4S
S0UD65        GM     g s  snf )Nry   r  referred_schemarz   referred_columns)r   autoload_withr   .)r  r   r   optionslink_to_nameT)r   r   r(   r   intersectionr   r   Tabler   r2   r   joinBLANK_SCHEMAappend_constraintForeignKeyConstraint)r$   rq   r   r   r   r   r   r   r   r   r   fkey_dconnamecr  r  rz   r  refspeccolumnr  s                        r   r   Inspector._reflect_fk  s    %%
"'"6"6
 FVnG
   56#6A -.,B!$((I6   #  +,99/JJ#/0;;OLL $%67O#$45N%&89G*OO&  /&*ii#- - /FNN/>6!JK /
 OO& '+ii(55#- - /FNN388^V,D#EF /F" +##..' "&	
 m #s   Gascdescnulls_first
nulls_lastc                 n   U R                  X5      nU GHj  n	U	S   n
U	S   nU	R                  S0 5      nU	S   nU	R                  SS5      nU	R                  S0 5      nU	R                  S5      nU(       aO  [        U5      R                  U5      (       d0  [        R
                  " S	U< S
SR                  U5      < S35        M  U(       a  M  / nU Hg  n UU;   a  UU   OUR                  U   nUR                  US5      nU R                   H  u  nnUU;   d  M  U" U5      nM     UR                  U5        Mi     [        R                  " U
/UQ7SU0[        [        UR                  5       5      SU4/-   5      D6  GMm     g ! [         a&    [        R
                  " U< SU< SU< S35         M  f = f)Nry   column_namescolumn_sortinguniquer   indexr   duplicates_constraintz	Omitting z
 key for (, z), key covers omitted columns.z key '(' was not located in columns for table ''r   _table)r   r   r   issubsetr   warnr   r&  KeyError_index_sort_exprsr   r   Indexr   r   r"   )r$   rq   r   r   r   r   r   r   indexesindex_dry   columnsr0  r1  flavorr   
duplicatesidx_colsr&  idx_col	c_sortingr   ops                          r   r   Inspector._reflect_indexes   s    "":6G6?Dn-G$[[)92>NX&F[[1F%kk*;R@O %<=Js7|'<'<_'M'M		tyy13  H  11 *!,"WWQZ  +..q"5	!33EArI~"$W+ 4 (# & OO  tO113468J7KKL	O 6   II4:AzK s   F,F43F4c           
      V    U R                  X5      nU H  n	U	S   n
U	S   nU	R                  S5      nU(       aI  [        U5      R	                  U5      (       d*  [
        R                  " SSR                  U5      -  5        Mn  U(       a  Mw  / nU H-  n X;   a  XN   OUR                  U   nUR                  U5        M/     UR                  [        R                  " USU
065        M     g ! [         a     g f = f! [         a#    [
        R                  " SU< SU< S35         M  f = f)	Nry   r/  duplicates_indexzDOmitting unique constraint key for (%s), key covers omitted columns.r4  zunique constraint key 'r5  r6  )r   NotImplementedErrorr   r   r8  r   r9  r   r&  r   r:  r"  r   UniqueConstraint)r$   rq   r   r   r   r   r   r   constraintsconst_dr%  r?  rA  constrained_colsr&  constrained_cols                   r   r   %Inspector._reflect_unique_constraints:  s0   	55jIK
 #GfoGn-G %78Js7|'<'<_'M'M		248IIg4FG   "= 1 *,"WWQZ $ %++O<  ##**,<K7K; #	 # 		4   II45zCs#   C+ C;+
C87C8;)D('D(c                      U R                  X5      nU H(  n	UR                  [        R                  " S0 U	D65        M*     g ! [         a     g f = f)Nr   )r   rI  r"  r   CheckConstraint)
r$   rq   r   r   r   r   r   r   rK  rL  s
             r   r   $Inspector._reflect_check_constraintsm  sS    	44ZHK
 #G##I$=$=$H$HI #	 # 		s   A 
AAc                 v     U R                  X5      nUR                  SS 5      Ul        g ! [         a     g f = f)Nr   )r   r   r   rI  )r$   rq   r   r   r   comment_dicts         r   r    Inspector._reflect_table_comment  sA    	;11*EL ),,VT:EM # 		s   + 
88)rG   r2   r8   rD   r   r   )r   TN)@r    
__module____qualname____firstlineno____doc__r   
deprecatedr3   classmethodr<   r0   rA   r@   rM   r	   	_inspectsr   rQ   r   rT   r   rW   
contextlibcontextmanagerr\   ra   propertyrd   rg   rk   rp   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   r   deprecated_20r   r   r   r  r   r   r   asc_opdesc_opnulls_first_opnulls_last_opr;  r   r   r   r   __static_attributes__r   r+   r   r-   r-   <   s2   . 
__	5
'
'  $ 	__	5
6
 6* +&B 'B &!B "B *%F &F  & 
 
 0 08DJ5+n*?B2"H'R4* D 
4	/33 J
X@8D	%/(M` 
	  !	""#		001	y../	8t1fJ&;r+   r-   )rY  r]  baser   r   r    r   r	   r
   r   r   r   r   sql.type_apir   r   	decoratorr*   _self_inspectsobjectr-   r   r+   r   <module>rl     sl   (          % %     K; K; K;r+   