
    ؄_                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lm	Z
 dd
lmZ ddlmZ ddlmZ ej        d             Z G d de          ZdS )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..
   )Connectable   )exc)
inspection)sql)util)	operators)schema)
TypeEngine)
deprecated)topologicalc                 6   |                     dd           }| | ||g|R i |S | j        t          d |D                       t          d |                                D                       f}|                     |          }| | ||g|R i |}|||<   |S )N
info_cachec              3   N   K   | ] }t          |t          j                  |V  !d S N)
isinstancer   string_types).0as     a/var/www/book.euthymeo.com/html/venv/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py	<genexpr>zcache.<locals>.<genexpr>/   s4      BBAAt/@!A!ABaBBBBBB    c              3   0   K   | ]\  }}|d k    ||fV  dS )r   N )r   kvs      r   r   zcache.<locals>.<genexpr>0   s4      AAAqL/@/@q!f/@/@/@/@AAr   )get__name__tupleitems)fnselfconargskwr   keyrets           r   cacher(   (   s    d++Jr$)d)))b)))
BBBBBBBAAAAAAAC
 ..

C
{bs(T(((R((
3Jr   c                      e Zd ZdZd Zed             Z ej        e	          d             Z
ed             Zd Z ej        d          d*d
            Zd+dZd Zd Zd+dZd+dZd+dZd+dZ edd          d+d            Zd+dZd+dZd+dZd+dZd+dZd+dZ	 	 	 d,dZ d Z!d Z"d  Z#d! Z$d"e%j&        fd#e%j'        fd$e%j(        fd%e%j)        fgZ*d& Z+d' Z,d( Z-d) Z.d	S )-	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::

        from sqlalchemy import inspect, create_engine
        engine = create_engine('...')
        insp = inspect(engine)

    The inspection method above is equivalent to using the
    :meth:`_reflection.Inspector.from_engine` method, i.e.::

        engine = create_engine('...')
        insp = Inspector.from_engine(engine)

    Where above, the :class:`~sqlalchemy.engine.interfaces.Dialect` may opt
    to return an :class:`_reflection.Inspector`
    subclass that provides additional
    methods specific to the dialect's target database.

    c                     || _         t          |d          r|j        | _        n|| _        | j        |u r&|                                                                 | j        j        | _        i | _        dS )a  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`

        engineN)bindhasattrr,   connectclosedialectr   )r"   r-   s     r   __init__zInspector.__init__U   so     	 4"" 	+DKKDK;$LLNN  """{*r   c                 ~    t          |j        d          r|j                            |          S t          |          S )a  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`.

        	inspector)r.   r1   r4   r*   )clsr-   s     r   from_enginezInspector.from_engineq   s:    ( 4<-- 	0<))$///r   c                 6    t                               |           S r   )r*   r6   )r-   s    r   _inspzInspector._insp   s    $$T***r   c                     | j         j        S )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.

        )r1   default_schema_namer"   s    r   r:   zInspector.default_schema_name   s     |//r   c                 |    t          | j        d          r&| j                            | j        | j                  S g S )zReturn all schema names.get_schema_namesr   )r.   r1   r=   r-   r   r;   s    r   r=   zInspector.get_schema_names   sH     4<!344 	<00	do 1    	r   )z1.0a	  The :paramref:`get_table_names.order_by` parameter is deprecated and will be removed in a future release.  Please refer to :meth:`_reflection.Inspector.get_sorted_table_and_fkc_names` for a more comprehensive solution to resolving foreign key cycles between tables.)order_byNc                    t          | j        d          r(| j                            | j        || j                  }n| j                            |          }|dk    rkg }|D ]D}|                     ||          D ]+}||d         k    r|                    |d         |f           ,Et          t          j        ||                    }|S )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`.

        :param order_by: Optional, may be the string "foreign_key" to sort
         the result on foreign key dependencies.  Does not automatically
         resolve cycles, and will raise :class:`.CircularDependencyError`
         if cycles exist.

        .. seealso::

            :meth:`_reflection.Inspector.get_sorted_table_and_fkc_names`

            :attr:`_schema.MetaData.sorted_tables`

        get_table_namesr>   foreign_keyreferred_table)r.   r1   rA   r-   r   r,   table_namesget_foreign_keysappendlistr   sort)r"   r
   r?   tnamestuplestnamefkeys          r   rA   zInspector.get_table_names   s    N 4<!233 	5\11	6do 2  FF [,,V44F}$$F G G 11%@@ G GD%5 666t,<'=u&EFFFG +*66::;;Fr   c                 \  	
 t          | j        d          r(| j                            | j        || j                  }n| j                            |          }t                      }t                      i 
|D ]b}|                     ||          }t          d |D                       
|<   |D ]+}||d         k    r|	                    |d         |f           ,c	 t          t          j        ||                    }n# t          j        $ rx}|j        D ]D	|                    	                               	fd
	d                  D                        Et          t          j        ||                    }Y d}~nd}~ww xY w
fd|D             dt                    fgz   S )	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`.

        rA   r>   c                     g | ]
}|d          S )namer   )r   fks     r   
<listcomp>z<Inspector.get_sorted_table_and_fkc_names.<locals>.<listcomp>   s    +G+G+G2BvJ+G+G+Gr   rC   c              3   ,   K   | ]}d          |fV  dS )r   Nr   )r   fkcedges     r   r   z;Inspector.get_sorted_table_and_fkc_names.<locals>.<genexpr>  s<       & &'*T!WcN& & & & & &r   r   Nc                 J    g | ]}||                                        f S r   )
difference)r   rK   fknames_for_tableremaining_fkcss     r   rQ   z<Inspector.get_sorted_table_and_fkc_names.<locals>.<listcomp>
  sB     
 
 
 %e,77GGH
 
 
r   )r.   r1   rA   r-   r   r,   rD   setrE   addrG   r   rH   r   CircularDependencyErroredgesremoveupdate)r"   r
   rI   rJ   rK   fkeysrL   candidate_sorterrrT   rW   rX   s            @@@r   get_sorted_table_and_fkc_namesz(Inspector.get_sorted_table_and_fkc_names   s)   0 4<!233 	5\11	6do 2  FF [,,V44F 	@ 	@E))%88E'*+G+G+G+G+G'H'He$ @ @D!1222JJ%5 6>???@		D!+"266"B"BCCNN* 	D 	D 	D	  d###%% & & & &.?Q.H& & &     "+"266"B"BCCNNNNNN	D
 
 
 
 
'
 
 
 D(()*+ 	+s   "D F	A.FF	c                 N    | j                             | j        | j                  S )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

        r>   )r1   get_temp_table_namesr-   r   r;   s    r   rd   zInspector.get_temp_table_names  s,     |00I$/ 1 
 
 	
r   c                 N    | j                             | j        | j                  S )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

        r>   )r1   get_temp_view_namesr-   r   r;   s    r   rf   zInspector.get_temp_view_names  s,     |//I$/ 0 
 
 	
r   c                 r    t          | j        d          r! | j        j        | j        ||fd| j        i|S i S )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   )r.   r1   rh   r-   r   r"   
table_namer
   r%   s       r   rh   zInspector.get_table_options)  sY     4<!455 	14<1	:v :>/MO   	r   c                 P    | j                             | j        || j                  S )zReturn all view names in `schema`.

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

        r>   )r1   get_view_namesr-   r   )r"   r
   s     r   rl   zInspector.get_view_names=  s.     |**Iv$/ + 
 
 	
r   c                 R    | j                             | j        ||| j                  S )zReturn definition for `view_name`.

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

        r>   )r1   get_view_definitionr-   r   )r"   	view_namer
   s      r   rn   zInspector.get_view_definitionI  s0     |//Iy&T_ 0 
 
 	
r   c                      | j         j        | j        ||fd| j        i|}|D ],}|d         }t	          |t
                    s |            |d<   -|S )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.

        * ``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   type)r1   get_columnsr-   r   r   r   )r"   rj   r
   r%   col_defscol_defcoltypes          r   rr   zInspector.get_columnsU  s|    b ,4<+Iz6
 
6:o
IK
 
   	, 	,GfoGgz22 ,")'))r   z0.7zThe :meth:`_reflection.Inspector.get_primary_keys` method is deprecated and will be removed in a future release.  Please refer to the :meth:`_reflection.Inspector.get_pk_constraint` method.c                 P     | j         j        | j        ||fd| j        i|d         S )zReturn information about primary keys in `table_name`.

        Given a string `table_name`, and an optional string `schema`, return
        primary key information as a list of column names.
        r   constrained_columnsr1   get_pk_constraintr-   r   ri   s       r   get_primary_keyszInspector.get_primary_keys  sE     .t|-Iz6
 
6:o
IK
 

! 	!r   c                 D     | j         j        | j        ||fd| j        i|S )a  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   rx   ri   s       r   ry   zInspector.get_pk_constraint  s=    ( .t|-Iz6
 
6:o
IK
 
 	
r   c                 D     | j         j        | j        ||fd| j        i|S )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   )r1   rE   r-   r   ri   s       r   rE   zInspector.get_foreign_keys  s=    > -t|,Iz6
 
6:o
IK
 
 	
r   c                 D     | j         j        | j        ||fd| j        i|S )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 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``, ``nullsfirst``, ``nullslast``.

          .. 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   )r1   get_indexesr-   r   ri   s       r   r~   zInspector.get_indexes  s>    H (t|'Iz6
 
6:o
IK
 
 	
r   c                 D     | j         j        | j        ||fd| j        i|S )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   )r1   get_unique_constraintsr-   r   ri   s       r   r   z Inspector.get_unique_constraints  s=    * 3t|2Iz6
 
6:o
IK
 
 	
r   c                 D     | j         j        | j        ||fd| j        i|S )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 dictionary with these keys:

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

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

        .. versionadded:: 1.2

        r   )r1   get_table_commentr-   r   ri   s       r   r   zInspector.get_table_comment  s=      .t|-Iz6
 
6:o
IK
 
 	
r   c                 D     | j         j        | j        ||fd| j        i|S )ac  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   )r1   get_check_constraintsr-   r   ri   s       r   r   zInspector.get_check_constraints2  s=    : 2t|1Iz6
 
6:o
IK
 
 	
r   r   Tc           
         ||v rdS |                                | j        j        }| j                                      }j        }t          fd|j        D                       }	 | j        ||fi j        }
|
r	                    |
           t          j        r^t          |t                    r|                    |j                  }t          |t                    r|                    |j                  }d}i } | j        ||fi j        D ]}d}|                     ||||           |st%          j        j                  |                     ||||           |                     |||||||	           |                     ||||||	           |                     ||||||	           |                     ||||||	           |                     |||	           dS )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.engine.reflection import Inspector

            engine = create_engine('...')
            meta = MetaData()
            user_table = Table('user', meta)
            insp = Inspector.from_engine(engine)
            insp.reflecttable(user_table, None)

        :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   b   K   | ])}|j         v |j                             |          fV  *d S r   )dialect_kwargsr   )r   r   tables     r   r   z)Inspector.reflecttable.<locals>.<genexpr>  sS       "
 "
E((( $((++,(((("
 "
r   FT)rZ   r-   r1   schema_for_objectrO   dictreflection_optionsrh   r   _validate_dialect_kwargsr   py2kr   strdecodeencodingrr   _reflect_columnr   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_onr1   r
   rj   r   tbl_optsfound_tablecols_by_orig_namecol_ds    `            r   reflecttablezInspector.reflecttableS  s   : !
""u%%%)#,,U33Z
 " "
 "
 "
 "
/"
 "
 "
 
 
 *4)
 
"'"6
 
  	5 **84449 	A&#&& 9w'788*c** A'..w/?@@
%T%
 
"'"6
 
 	 	E K  !     	3&uz222'8/	
 	
 	
 			
 		
 		
 		
 	
 	
 	((	
 	
 	
 	''	
 	
 	
 	##'9	
 	
 	
 	
 	
r   c                    d         }|j                             | |           d         }|r||vs|r||v rd S d         }t          fddD                       }	dv r|	                    d                    g }
                    d          d         }t          |t          j        j                  rt          j
        |d          }nHt          |t          j                  s.t          j
        t          j        d                   d          }|
                    |           d	v r,t          j        di d	         }|
                    |           d
v r|                     |
           t          j        ||g|
R i |	x||<   }|j        |j        v rd|_        |                    |           d S )NrO   rq   c              3   4   K   | ]}|v ||         fV  d S r   r   )r   r   r   s     r   r   z,Inspector._reflect_column.<locals>.<genexpr>  sA       
 
 Ezz aM zzz
 
r   )nullableautoincrementquoteinfor&   commentdialect_optionsdefaultT)
_reflectedcomputedsequencer   )dispatchcolumn_reflectr   r^   r   r   r   elements
TextClause	sa_schemaDefaultClauseFetchedValuetextrF   Computed_reflect_col_sequenceColumnr&   primary_keyappend_column)r"   r   r   r   r   r   	orig_namerO   ru   col_kwcolargsr   r   cols     `           r   r   zInspector._reflect_column  s/    &M	%%dE5999 V} 	O ; ; !< $ 7 7F- 
 
 
 

 
 
 
 
 %%MM% 1233399Y+I&G'3<#:;; #1'dKKK)?@@ #1HU9-..4   NN7### )>>E*,=>>HNN8$$$&&ug666-6-='.
#.
 .
 .
'-.
 .
 	
)$s 7e'''"COC     r   c                     d|v r]|d         }t          j        |d         dd          }d|v r|d         |_        d|v r|d         |_        |                    |           d S d S )Nr   rO   r   start	increment)r   Sequencer   r   rF   )r"   r   r   seqr   s        r   r   zInspector._reflect_col_sequence  s{    
#C )#f+q!<<H#~~!$Wc!!%(%5"NN8$$$$$ r   c                      | j         ||fi |j        }|rPfd|d         D             }|                    d          |j        _        |j                            |           d S d S )Nc                 0    g | ]}|v |v
|         S r   r   )r   pkr   r   s     r   rQ   z)Inspector._reflect_pk.<locals>.<listcomp>(  s>       ***r/H/H ""%/H/H/Hr   rw   rO   )ry   r   r   r   rO   _reload)r"   rj   r
   r   r   r   pk_conspk_colss       ``  r   r   zInspector._reflect_pk!  s     )$(
 
"'"6
 
  	/    !"78  G &-[[%8%8E" %%g.....	/ 	/r   c	           	          | j         ||fi |j        }	|	D ]J}
|
d         }fd|
d         D             }|r#t          |                              |          rD|
d         }|
d         }|
d         }g }|U|r"t	          j        ||j        fd|| j        |d| |D ]-}|                    d		                    |||g                     .n]|r,t	          j        ||j        fd| j        t          j
        |d
| |D ],}|                    d		                    ||g                     -d|
v r	|
d         }ni }|                    t	          j        |||fddi|           Ld S )NrO   c                 6    g | ]}|v r|         j         n|S r   )r&   )r   cr   s     r   rQ   z)Inspector._reflect_fk.<locals>.<listcomp>G  sB     # # # -.1B,B,B!!$((# # #r   rw   referred_schemarC   referred_columnsT)autoloadr
   autoload_withr   .)r   r   r
   r   optionslink_to_name)rE   r   rY   intersectionr   Tablemetadatar-   rF   joinBLANK_SCHEMAappend_constraintForeignKeyConstraint)r"   rj   r
   r   r   r   r   r   r   r_   fkey_dconnamerw   r   rC   r   refspeccolumnr   s       `              r   r   zInspector._reflect_fk5  sa    &%
 
"'"6
 
  8	 8	FVnG# # # # 56# # #  3':#;#;#H#H$ $  $%67O#$45N%&89G* 	O& "&.&*i#-  -   /  FNN/>6!JKK   
  	O& "&&*i(5#-  -   / G GFNN388^V,D#E#EFFFFF"" +##.'  "&	
     a8	 8	r   ascdesc
nullsfirst	nullslastc                    |                      ||          }|D ]}	|	d         }
|	d         }|	                    di           }|	d         }|	                    dd          }|	                    di           }|	                    d          }|rQt          |                              |          s/t	          j        d	|d
d                    |          d           |rg }|D ]}	 ||v r||         n|j        |         }n-# t          $ r  t	          j        |d|d|d           Y Fw xY w|                    |d          }| j	        D ]\  }}||v r ||          }|
                    |           t          j        |
g|R d|it          t          |                                          d|fgz              d S )NrO   column_namescolumn_sortinguniquerq   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   rY   issubsetr   warnr   r   KeyError_index_sort_exprsrF   r   Indexr   rG   r    )r"   rj   r
   r   r   r   r   r   indexesindex_drO   columnsr   r   flavorr   
duplicatesidx_colsr   idx_col	c_sortingr   ops                          r   r   zInspector._reflect_indexes  sa    "":v66 ,	 ,	G6?Dn-G$[[)92>>NX&F[[11F%kk*;R@@O %<==J s7||'<'<_'M'M 		vvtyy11113     H ) )  111 *!,,"WQZ G
     I4:FFAAAzzzK   H +..q"55	!3 . .EArI~~"$"W++((((O    tO11334468J7KKLL	   O,	 ,	s   (D'D,+D,c           
      Z   	 |                      ||          }n# t          $ r Y d S w xY w|D ]}	|	d         }
|	d         }|	                    d          }|rMt          |                              |          s+t          j        dd                    |          z             v|ryg }|D ]\}	 ||v r||         n|j        |         }|	                    |           2# t          $ r t          j        d|d|d           Y Yw xY w|                    t          j        |d|
i           d S )	NrO   r   duplicates_indexzDOmitting unique constraint key for (%s), key covers omitted columns.r   zunique constraint key 'r   r   )r   NotImplementedErrorr   rY   r   r   r   r   r   rF   r   r   r   UniqueConstraint)r"   rj   r
   r   r   r   r   r   constraintsconst_dr   r   r   constrained_colsr   constrained_cols                   r   r   z%Inspector._reflect_unique_constraints  s   	55j&IIKK" 	 	 	FF	 # 	 	GfoGn-G %788J s7||'<'<_'M'M 	248IIg4F4FG      " = ==  111 *!,,"WQZ $ %++O<<<<     II45AAzzzC     ##*,<K7KK   ;	 	s    
'',C%DDc                     	 |                      ||          }n# t          $ r Y d S w xY w|D ]&}	|                    t          j        di |	           'd S )Nr   )r   r   r   r   CheckConstraint)
r"   rj   r
   r   r   r   r   r   r   r   s
             r   r   z$Inspector._reflect_check_constraints  s    	44ZHHKK" 	 	 	FF	 # 	J 	JG##I$=$H$H$H$HIIII	J 	Js    
''c                     	 |                      ||          }|                    dd           |_        d S # t          $ r Y d S w xY w)Nr   )r   r   r   r   )r"   rj   r
   r   r   comment_dicts         r   r   z Inspector._reflect_table_comment  s]    	;11*fEEL ),,VT::EMMM # 	 	 	FF	s   5 
AA)NNr   )r   TN)/r   
__module____qualname____doc__r2   classmethodr6   r   	_inspectsr   r8   propertyr:   r=   r   deprecated_paramsrA   rb   rd   rf   rh   rl   rn   rr   r   rz   ry   rE   r~   r   r   r   r   r   r   r   r   r	   asc_opdesc_opnullsfirst_opnullslast_opr   r   r   r   r   r   r   r   r*   r*   9   s        6  8   [. Z+&&+ + '&+ 0 0 X0   T

 
 
) ) )
 
)V6+ 6+ 6+ 6+p
 
 

 
 
   (

 

 

 



 

 

 

9 9 9 9v Z	B 	! 	! 	! 	!
 
 
 
0!
 !
 !
 !
F&
 &
 &
 &
P
 
 
 
2
 
 
 
(
 
 
 
J D
 D
 D
 D
L;! ;! ;!z	% 	% 	%/ / /(F F FR 
	 !	"#	y./	i,-	8 8 8t1 1 1fJ J J&; ; ; ; ;r   r*   N)r	  baser    r   r   r   r   r	   r
   r   sql.type_apir   r   r   	decoratorr(   objectr*   r   r   r   <module>r     s    (                                     % % % % % % % % % % % %                S; S; S; S; S; S; S; S; S; S;r   