
    h                     L    S SK Jr  \" SSS/5      r\" SS5      r " S S5      rg	)
    )
namedtuple	TableInfonametype	FieldInfozSname type_code display_size internal_size precision scale null_ok default collationc                       \ rS rSrSr0 rS rS rS rSS jr	S r
S	 rS
 rSS jrS rS rSS jrS rS rS rS rSrg)BaseDatabaseIntrospection   z5Encapsulate backend-specific introspection utilities.c                     Xl         g N
connection)selfr   s     W/var/www/html/env/lib/python3.13/site-packages/django/db/backends/base/introspection.py__init__"BaseDatabaseIntrospection.__init__   s    $    c                      U R                   U   $ )z
Hook for a database backend to use the cursor description to
match a Django field type to a database column.

For Oracle, the column data_type on its own is insufficient to
distinguish between a FloatField and IntegerField, for example.
)data_types_reverse)r   	data_typedescriptions      r   get_field_type(BaseDatabaseIntrospection.get_field_type   s     &&y11r   c                     U$ )z
Apply a conversion to the identifier for the purposes of comparison.

The default identifier converter is for case sensitive comparison.
 )r   r   s     r   identifier_converter.BaseDatabaseIntrospection.identifier_converter    s	     r   Nc                    ^ ^ UU 4S jnUc,  T R                   R                  5        nU" U5      sSSS5        $ U" U5      $ ! , (       d  f       N= f)z
Return a list of names of all tables that exist in the database.
Sort the returned table list by Python's default sorting. Do NOT use
the database's ORDER BY here to avoid subtle differences in sorting
order between databases.
c                 L   > [        U4S jTR                  U 5       5       5      $ )Nc              3   n   >#    U  H*  nT(       d  UR                   S :X  d  M  UR                  v   M,     g7f)tN)r   r   ).0tiinclude_viewss     r   	<genexpr>KBaseDatabaseIntrospection.table_names.<locals>.get_names.<locals>.<genexpr>1   s+      5B BGGsN 5s   55)sortedget_table_list)cursorr$   r   s    r   	get_names8BaseDatabaseIntrospection.table_names.<locals>.get_names0   s(     --f5  r   N)r   r)   )r   r)   r$   r*   s   ` ` r   table_names%BaseDatabaseIntrospection.table_names(   sE    	 >'')V ( *)   *)s   A
Ac                     [        S5      e)zg
Return an unsorted list of TableInfo named tuples of all tables and
views that exist in the database.
zMsubclasses of BaseDatabaseIntrospection may require a get_table_list() methodNotImplementedError)r   r)   s     r   r(   (BaseDatabaseIntrospection.get_table_list<   s    
 "
 	
r   c                     [        S5      e)zQ
Return a description of the table with the DB-API cursor.description
interface.
zUsubclasses of BaseDatabaseIntrospection may require a get_table_description() method.r/   r   r)   
table_names      r   get_table_description/BaseDatabaseIntrospection.get_table_descriptionF   s    
 ".
 	
r   c                 T   ^ ^ SSK Jn  SSKJm  UU 4S jUR	                  5        5       $ )Nr   )apps)routerc              3      >#    U  Ha  nTR                  UTR                  R                  5        H3  nUR                  R	                  TR                  5      (       d  M/  Uv   M5     Mc     g 7fr   )get_migratable_modelsr   alias_metacan_migrate)r"   
app_configmodelr9   r   s      r   r%   BBaseDatabaseIntrospection.get_migratable_models.<locals>.<genexpr>T   sT      
4
55j$//BWBWX{{&&t7 EX 4s   AA,A,)django.appsr8   	django.dbr9   get_app_configs)r   r8   r9   s   ` @r   r;   /BaseDatabaseIntrospection.get_migratable_modelsP   s$    $$
"224
 	
r   c                    [        5       nU R                  5        Hq  nUR                  R                  (       d  M   UR	                  UR                  R
                  5        UR                  S UR                  R                   5       5        Ms     [        U5      nU(       a@  [        U R                  US95      nU Vs/ s H  o`R                  U5      U;   d  M  UPM     nnU$ s  snf )z
Return a list of all table names that have associated Django models and
are in INSTALLED_APPS.

If only_existing is True, include only the tables in the database.
c              3      #    U  HF  nUR                   R                  R                  R                  (       d  M4  UR	                  5       v   MH     g 7fr   )remote_fieldthroughr=   managedm2m_db_table)r"   fs     r   r%   ?BaseDatabaseIntrospection.django_table_names.<locals>.<genexpr>g   s<      7A>>))//77 !  7s
   3AA)r$   )setr;   r=   rJ   adddb_tableupdatelocal_many_to_manylistr,   r   )r   only_existingr$   tablesr@   existing_tablesr!   s          r   django_table_names,BaseDatabaseIntrospection.django_table_names[   s     //1E;;&&JJu{{++,MM 77 	 2 f!$"2"2"2"OPO!!a%>%>q%A_%T6   s   >C$C$c                     [        [        U R                  U5      5      nU R                  5        Vs1 s H0  nU R                  UR                  R
                  5      U;   d  M.  UiM2     sn$ s  snf )zM
Return a set of all models represented by the provided list of table
names.
)rN   mapr   r;   r=   rP   )r   rU   ms      r   installed_models*BaseDatabaseIntrospection.installed_modelst   sh    
 S22F;< //1
1(()9)9:fD 1
 	
 
s   -A,#A,c           	         / nU R                   R                  5        nU R                  5        GH   nUR                  R                  (       d  M!  UR                  R
                  (       a  M>  UR                  U R                  X#R                  R                  UR                  R                  5      5        UR                  R                   H  nUR                  R                  R                  R                  (       d  M4  U R                  X$R                  5       5      nUR                  U=(       d    UR                  5       SS./5        M     GM#     SSS5        U$ ! , (       d  f       U$ = f)zQ
Return a list of information about all DB sequences for all models in
all apps.
N)tablecolumn)r   r)   r;   r=   rJ   swappedextendget_sequencesrP   local_fieldsrR   rH   rI   auto_createdrK   )r   sequence_listr)   r@   rL   sequences         r   rf   'BaseDatabaseIntrospection.sequence_list   s   
 __##%335{{**;;&&$$&& 4 4ekk6N6N
 77A ~~--33@@@#'#5#5fnn>N#O%,,$U1>>3Ct)T(U 8 6 && ' &%& s   CE?AE
E,c                     [        S5      e)z
Return a list of introspected sequences for table_name. Each sequence
is a dict: {'table': <table_name>, 'column': <column_name>}. An optional
'name' key can be added if the backend supports named sequences.
zLsubclasses of BaseDatabaseIntrospection may require a get_sequences() methodr/   )r   r)   r4   table_fieldss       r   rc   'BaseDatabaseIntrospection.get_sequences   s     "
 	
r   c                     [        S5      e)z~
Return a dictionary of {field_name: (field_name_other_table, other_table)}
representing all foreign keys in the given table.
zMsubclasses of BaseDatabaseIntrospection may require a get_relations() method.r/   r3   s      r   get_relations'BaseDatabaseIntrospection.get_relations   s    
 "&
 	
r   c                 @    U R                  X5      nU(       a  US   $ S$ )z@
Return the name of the primary key column for the given table.
r   N)get_primary_key_columns)r   r)   r4   columnss       r   get_primary_key_column0BaseDatabaseIntrospection.get_primary_key_column   s%     ..vB$wqz.$.r   c                 r    U R                  X5      R                  5        H  nUS   (       d  M  US   s  $    g)z9Return a list of primary key columns for the given table.primary_keyrq   N)get_constraintsvalues)r   r)   r4   
constraints       r   rp   1BaseDatabaseIntrospection.get_primary_key_columns   s<    ..vBIIKJ-((!),, L r   c                     [        S5      e)a  
Retrieve any constraints or keys (unique, pk, fk, check, index)
across one or more columns.

Return a dict mapping constraint names to their attributes,
where attributes is a dict with keys:
 * columns: List of columns this covers
 * primary_key: True if primary key, False otherwise
 * unique: True if this is a unique constraint, False otherwise
 * foreign_key: (table, column) of target, or None
 * check: True if check constraint, False otherwise
 * index: True if index, False otherwise.
 * orders: The order (ASC/DESC) defined for the columns of indexes
 * type: The type of the index (btree, hash, etc.)

Some backends may return special constraint names that don't exist
if they don't name constraints of a certain type (e.g. SQLite)
zNsubclasses of BaseDatabaseIntrospection may require a get_constraints() methodr/   r3   s      r   rv   )BaseDatabaseIntrospection.get_constraints   s    & "
 	
r   r   )NF)FT)r   )__name__
__module____qualname____firstlineno____doc__r   r   r   r   r,   r(   r5   r;   rW   r\   rf   rc   rm   rr   rp   rv   __static_attributes__r   r   r   r	   r	      sV    ?%2!(

	
2

6	

/
r   r	   N)collectionsr   r   r   r	   r   r   r   <module>r      s;    " {VV$45	 	F
 F
r   