
    5hP                       S SK r S SKrS SK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  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  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-  SS%KJ.r.  SS&KJ/r/  SS'KJ0r0  S(u  r1r2 " S) S*\Rf                  5      r4 " S+ S,\45      r5 " S- S.\Rf                  5      r6 " S/ S0\Rn                  5      r8 " S1 S2\Rf                  5      r9S3 r: " S4 S5\-\45      r; " S6 S7\Rn                  5      r< " S8 S9\,\Rn                  5      r= " S: S;\Rf                  5      r> " S< S=\R~                  5      r@ " S> S?\Rf                  5      rA " S@ SA\Rf                  5      rBSBrCg)C    N   )config)engines)eq_)expect_raises)expect_raises_message)expect_warnings)fixtures)is_)get_temp_table_name)temp_table_keyword_args)Column)Table   )event)
ForeignKey)func)Identity)inspect)Integer)MetaData)String)testing)types)	Inspector)
ObjectKind)ObjectScope)NoSuchTableError)UnreflectableTableError)DDL)Index)quoted_name)BLANK_SCHEMA)ComparesIndexes)ComparesTables)is_false)is_true)mockNNc                   $    \ rS rSr\S 5       rSrg)OneConnectionTablesTest7   c                     [         R                  R                  R                  (       a,  SSKJn  [        R                  " [        UR                  SS9S9$ [         R                  $ )Nr   )poolclass)	poolclassscope)options)r   requirementsindependent_connectionsenabled
sqlalchemyr.   r   testing_enginedict
StaticPooldb)clsr.   s     s/var/www/html/cementerio_25MayoBackend/env/lib/python3.13/site-packages/sqlalchemy/testing/suite/test_reflection.py
setup_bind"OneConnectionTablesTest.setup_bind8   sI    
 66>>'))tgF  99     N)__name__
__module____qualname____firstlineno__classmethodr=   __static_attributes__r@   r?   r<   r+   r+   7   s     r?   r+   c                   J   \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	S r
S r\R                  R                  S	 5       r\R                  R                  S
 5       r\R                  R"                  S 5       r\R                  R&                  S 5       r\R                  R&                  \R                  R*                  \R                  R,                  S 5       5       5       r\R                  R"                  \R                  R                  S 5       5       rSrg)HasTableTestG   Tc                    [        SU[        S[        SS9[        S[        S5      5      5        [        R
                  R                  R                  (       a;  [        SU[        S[        SS9[        S[        S5      5      [        R                  S9  [        R
                  R                  (       a  U R                  U5        [        R
                  R                  R                  (       a  U R                  U5        g g )	N
test_tableidTprimary_keydata2   test_table_sschema)r   r   r   r   r   requiresschemasr5   r   test_schemaview_reflectiondefine_viewshas_temp_tabledefine_temp_tablesr;   metadatas     r<   define_tablesHasTableTest.define_tablesJ   s    4d366":&		
 ##++tW$7vvbz*)) ++X&**22""8, 3r?   c                    Sn[         R                  " US[        U5      5        [         R                  " US[        S5      5        [        R                  R
                  R                  (       a{  S[        R                  < S[        R                  < S3n[         R                  " US[        U5      5        [         R                  " US[        S[        R                  -  5      5        g g )	Nz1CREATE VIEW vv AS SELECT id, data FROM test_tableafter_createbefore_dropzDROP VIEW vvCREATE VIEW z.vv AS SELECT id, data FROM z.test_table_szDROP VIEW %s.vv)	r   listenr    r   rT   rU   r5   r   rV   )r;   r\   querys      r<   rX   HasTableTest.define_views`   s    CX~s5z:X}c..AB##+++ &&&&  LL>3u:>LL%););<= ,r?   c                 b    [        [        [        R                  S[        R                   35      $ N	user_tmp_r   r   r:   identr;   s    r<   temp_table_nameHasTableTest.temp_table_namev   %    "FII6<<.9
 	
r?   c                 6   [        [        [        R                  5      nU R                  5       n[	        UU[        S[        R                  SS9[        S[        R                  " S5      5      40 UD6n[        R                  R                  R                  (       a~  [        R                  R                  R                  (       aT  [        R                  " US[!        S[        R"                  -  5      5        [        R                  " US[!        S	5      5        g g g )
NrL   TrM   namerP   r`   =create temporary view user_tmp_v as select * from user_tmp_%sra   drop view user_tmp_v)r   r   r:   rl   r   r   saINTVARCHARr   rT   rW   r5   temporary_viewsr   rc   r    rj   r;   r\   kw
table_nameuser_tmps        r<   rZ   HasTableTest.define_temp_tables|   s    $VVYY7((*
4T262::b>*	

 
 ,,44  0088LL028,,? LL=#6L2MN 9 5r?   c                    [         R                  R                  5        n[        [         R                  R                  R                  US5      5        [        [         R                  R                  R                  US5      5        [        [         R                  R                  R                  US5      5        S S S 5        g ! , (       d  f       g = f)NrK   rQ   nonexistent_table)r   r:   beginr'   dialect	has_tabler&   selfconns     r<   test_has_tableHasTableTest.test_has_table   s|    YY__$FII%%//lCDVYY&&00~FGVYY&&007JKL s   BC
Cc                 "   [        [        R                  5      n[        UR	                  S5      5        [        SU[        S[        5      5      n[        UR	                  S5      5        UR                  [        R                  5         [        UR	                  S5      5        UR                  5         [        UR	                  S5      5        UR                  [        R                  5        g ! UR                  [        R                  5        f = f)NrK   	new_tablecol)r   r   r:   r'   r   r   r   r   r&   createclear_cachedrop)r   r\   inspnts       r<   test_has_table_cache!HasTableTest.test_has_table_cache   s    vyy!|,-;&*@A,-
		&))	T^^K01DNN;/0GGFIIBGGFIIs   	AC- -!Dc           	         [         R                  R                  5        n[        [         R                  R                  R                  US[         R                  S95        [        [         R                  R                  R                  US[         R                  S95        [        [         R                  R                  R                  US[         R                  S95        S S S 5        g ! , (       d  f       g = f)NrK   rR   rQ   r}   )r   r:   r~   r&   r   r   rV   r'   r   s     r<   test_has_table_schema"HasTableTest.test_has_table_schema   s    YY__$		!!++,v/A/A , 
 		!!++.1C1C , 
 		!!++-f6H6H ,  s   CC))
C7c           	          [         R                  R                  5        n[        [         R                  R                  R                  USSS95        S S S 5        g ! , (       d  f       g = f)NrK   nonexistent_schemarR   )r   r:   r~   r&   r   r   r   s     r<   !test_has_table_nonexistent_schema.HasTableTest.test_has_table_nonexistent_schema   sK    YY__$		!!++,/C ,  s   3A
A)c                 N    [        U5      n[        UR                  S5      5        g Nvvr   r'   r   r   
connectionr   s      r<   test_has_table_view HasTableTest.test_has_table_view   s    z"t$%r?   c                 n    [        U5      nU R                  5       n[        UR                  U5      5        g N)r   rl   r'   r   )r   r   r   rl   s       r<   test_has_table_temp_table&HasTableTest.test_has_table_temp_table   s+    z"..0/0r?   c                 N    [        U5      n[        UR                  S5      5        g N
user_tmp_vr   r   s      r<   test_has_table_temp_view%HasTableTest.test_has_table_temp_view   s     z"|,-r?   c                 l    [        U5      n[        UR                  S[        R                  5      5        g r   )r   r'   r   r   rV   r   s      r<   test_has_table_view_schema'HasTableTest.test_has_table_view_schema   s'     z"tV%7%789r?   r@   N)rA   rB   rC   rD   __backend__rE   r]   rX   rl   rZ   r   r   r   rT   rU   r   r   viewsr   rY   r   rW   rv   r   r   rF   r@   r?   r<   rH   rH   G   s^   K- -*  * 
 

 O O0M  $   & & $$1 %1
 $$%%%%. & & %. :  :r?   rH   c                       \ rS rSrSr\S 5       r\R                  " SSSS9r	S r
\	S	 5       r\R                  R                  \	S
 5       5       rSrg)HasIndexTest   Tc                    [        SU[        S[        SS9[        S[        S5      5      [        S[        S5      5      5      n[	        SUR
                  R                  5        [        R                  R                  R                  (       a\  [        SU[        S[        SS9[        S[        S5      5      [        R                  S	9n[	        S
UR
                  R                  5        g g )NrK   rL   TrM   rO   rP   data2my_idxrR   my_idx_s)r   r   r   r   r!   crO   r   rT   rU   r5   r   rV   )r;   r\   tts      r<   r]   HasIndexTest.define_tables   s    4d366":&7F2J'
 	h		"##++tW$7vvbz*))B *bddii( ,r?   r   	inspectorkindargnamesc                 F   ^ US:X  a  U4S j$ [        T5      R                  $ )Nr   c                  `   > [         R                  R                  R                  " T/U Q70 UD6$ r   )r   r:   r   	has_index)akr   s     r<   <lambda>)HasIndexTest._has_index.<locals>.<lambda>   s$    699#4#4#>#>t#Ma#M1#Mr?   )r   r   )r   r   r   s     `r<   
_has_indexHasIndexTest._has_index   s!    9MM4=***r?   c           	      ,   U R                  X5      nU" SS5      (       d   eU" SS5      (       a   eU" SS5      (       a   eU" SS5      (       a   eU" SS5      (       a   eU" SS5      (       a   e[        SU R                  R                  R                  R
                  5      n[        SU[        S	[        5      [        SS	5      5      nUR                  U5        UR                  U5         US
:X  a:  U" SS5      (       a   eU" SS5      (       a   eUR                  R                  5         U" SS5      SL d   eU" SS5      SL d   e UR                  U5        UR                  U5        g ! UR                  U5        UR                  U5        f = f)NrK   r   r   r}   nonexistent_idxmy_idx_2test_table_2my_idx_3foor   T)r   r!   tablesrK   r   r   r   r   r   r   __self__r   r   )r   r   r   r\   methidxtbls          r<   test_has_indexHasIndexTest.test_has_index   s   t0L(++++j1111+X6666&78888j1111
3333J 6 6 8 8 > >?5'"*e$	
 	

:

:		!{"j9999
;;;;))+j1T999
3t;;;HHZ HHZ  HHZ HHZ s   /AE/ /$Fc                    U R                  X5      nU" SS[        R                  S9(       d   eU" SS[        R                  S9(       a   eU" SS[        R                  S9(       a   eU" SS[        R                  S9(       a   eg )NrK   r   rR   r   r}   nonexistent_idx_s)r   r   rV   )r   r   r   r   s       r<   test_has_index_schema"HasIndexTest.test_has_index_schema  s     t0L*V5G5GHHHhv7I7IJJJF4F4F
 	
 
 -f6H6H
 	
 
 
r?   r@   N)rA   rB   rC   rD   r   rE   r]   r   combinationsr   r   r   rT   rU   r   rF   r@   r?   r<   r   r      sp    K) )( 	;HD+ 
! 
!: 		
 
 	
r?   r   c            
           \ rS rSrSrSr\R                  " SSSSSS	9\R                  " S
SS/5      \R                  " SSSSSS	9S 5       5       5       r	Sr
g) BizarroCharacterFKResolutionTesti)  ztests for #10275T)rL   )z(3))zcol%p)z[brack]
columnnamer   use_compositeF)plain)z(2))z
per % cent)z
[brackets]	tablenamec                 b   [        UU[        U[        SSS9SS9nU(       a  UR                  [        S[        SS95        U(       az  [        SU[        S[        SS9[        S[        5      [        S	[        5      [        R
                  " SS	/UR                  R                  UR                  R                  /5      SS9  OA[        SU[        S[        SS9[        S[        UR                  R                  5      5      SS9  UR                  U5        [        5       n[        SXqS
9nUR                  U   n	UR                  R                  R                  U	R                  S   5      (       d   eU(       a:  UR                  R                  R                  U	R                  S   5      (       d   eg g )NrL   T)keyrN   test_needs_fkid2rM   otherrefref2autoload_withr      )r   r   r   append_columnrs   ForeignKeyConstraintr   rL   r   r   
create_allr   r   r   
referencesr   )
r   r   r\   r   r   r   r   m2o2t1s
             r<   test_fk_ref,BizarroCharacterFKResolutionTest.test_fk_ref.  s[    :wDdC	
 VE7EFtW$7ug&vw'''"$$''244889LM" tW$7uj12" 	J'Z7B9YYy!ttxx""2447++++4499''Q0000 r?   r@   N)rA   rB   rC   rD   __doc__r   r   r   	variationr   rF   r@   r?   r<   r   r   )  so    K:|l u6(1 7(1r?   r   c                      \ rS rSrSrSr\S 5       rS r\S 5       r	\\
R                  R                  S 5       5       r\S 5       r\S	 5       r\S
 5       r\S 5       r\\
R                  R$                  S 5       5       r\\
R                  R(                  S 5       5       r\\
R                  R,                  S 5       5       rSrg)QuotedNameArgumentTestid  onceTc                 ,   [        SU[        S[        5      [        S[        S5      5      [        S[        S5      5      [        S[        5      [        R
                  " SSS9[        R                  " S	S5      [        R                  " SS
S9[        R                  " S/S/SS9[        R                  " SSS9SSS9  [        R                  R                  R                  (       a  [        SU[        S[        5      [        S[        S5      5      [        S[        S5      5      [        S[        5      [        R
                  " SSS9[        R                  " SS5      [        R                  " SSS9[        R                  " S/S/SS9[        R                  " SSS9SSS9  [        SU[        S[        SS9[        S[        5      SS9  [        R                  R                  R                  (       Ga#  [        R                  R                  R                  (       a  SS/nOS/nU H  nS[        R                   R"                  R$                  R'                  SU-  5      < S[        R                   R"                  R$                  R'                  U5      < 3n[(        R*                  " US[-        U5      5        [(        R*                  " US [-        S![        R                   R"                  R$                  R'                  SU-  5      -  5      5        M     g g )"Nquote ' onerL   rp   rP   rO   
related_idzpk quote ' onerp   zix quote ' onezuq quote' onez
related.idzfk quote ' onezname != 'foo'zck quote ' onezquote ' one commentT)commentr   quote " twozpk quote " twozix quote " twozuq quote" twozfk quote " twozck quote " two zquote " two commentrelatedrM   r   rb   view %s AS SELECT * FROM r`   ra   zDROP VIEW %s)r   r   r   r   rs   PrimaryKeyConstraintr!   UniqueConstraintr   CheckConstraintr   rT   symbol_names_w_double_quoter5   view_column_reflectionr   r:   r   identifier_preparerquoter   rc   r    )r;   r\   namesrp   rd   s        r<   r]   $QuotedNameArgumentTest.define_tablesh  s   4!66":&66":&<)##D/?@HH%v.$ ##-= 5EF.%	
* 77??tW%vvbz*vvbz*|W-''3CD)62##( ''F\N1A ""?9JK2"%* 	4d39g&	
 22:::;;CC!! " II%%99??!D( II%%99??E	 X~s5zB!& ))++??EE%,	  ;r?   c                 p    [         R                  " SS[         R                  R                  45      " U 5      $ )N)r   r   )r   r   rT   r  )fns    r<   quote_fixtures%QuotedNameArgumentTest.quote_fixtures  s6    ##G,,HHI
  	r?   c                 R   [        [        R                  5      n[        R                  R
                  R                  (       a+  UR                  U5      n[        [        U[        5      5        g [        [        5         UR                  U5      nS S S 5        g ! , (       d  f       g = fr   )r   r   r:   r   rT   reflect_table_optionsr5   get_table_optionsr'   
isinstancer8   r   NotImplementedError)r   rp   r   ress       r<   test_get_table_options-QuotedNameArgumentTest.test_get_table_options  si    vyy!1199((.CJsD)*23,,T2 433s   =B
B&c                 l    [        [        R                  5      nUR                  SU-  5      (       d   eg )Nr   )r   r   r:   get_view_definitionr   rp   r   s      r<   test_get_view_definition/QuotedNameArgumentTest.test_get_view_definition  s.     vyy!''	D(89999r?   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r:   get_columnsr  s      r<   test_get_columns'QuotedNameArgumentTest.test_get_columns  '    vyy!%%%%r?   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r:   get_pk_constraintr  s      r<   test_get_pk_constraint-QuotedNameArgumentTest.test_get_pk_constraint  s'    vyy!%%d++++r?   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r:   get_foreign_keysr  s      r<   test_get_foreign_keys,QuotedNameArgumentTest.test_get_foreign_keys  s'    vyy!$$T****r?   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r:   get_indexesr  s      r<   test_get_indexes'QuotedNameArgumentTest.test_get_indexes  r  r?   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r:   get_unique_constraintsr  s      r<   test_get_unique_constraints2QuotedNameArgumentTest.test_get_unique_constraints  s)     vyy!**40000r?   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r:   get_table_commentr  s      r<   test_get_table_comment-QuotedNameArgumentTest.test_get_table_comment  s)     vyy!%%d++++r?   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r:   get_check_constraintsr  s      r<   test_get_check_constraints1QuotedNameArgumentTest.test_get_check_constraints  s)     vyy!))$////r?   r@   N)rA   rB   rC   rD   run_create_tablesr   rE   r]   r	  r  r   rT   r  r  r  r  r#  r'  unique_constraint_reflectionr+  comment_reflectionr/  check_constraint_reflectionr3  rF   r@   r?   r<   r   r   d  s+   KP Pd 3 3 ,,: - : & & , , + + & & 221 3 1 ((, ) , 110 2 0r?   r   c                    [         R                  " S S [         R                  R                  4SS9n[         R                  " [        R
                  [        R                  [        R                  SS9n[         R                  " [        R                  [        R                  [        R                  [        R                  [        R                  [        R                  [        R                  -  [        R                  [        R                  -  SS9n[         R                  " SSSS9nU" U" U" U" U 5      5      5      5      $ )	Nc                  "    [         R                  $ r   )r   rV   r@   r?   r<   r   $_multi_combination.<locals>.<lambda>  s
    F&&r?   rS   r   r1   r   TF
use_filter)r   r   rT   rU   r   DEFAULT	TEMPORARYANYr   TABLEVIEWMATERIALIZED_VIEWANY_VIEW)r  rS   r1   r   filter_namess        r<   _multi_combinationrE    s    !!&$$	
 F   	E $$:??*:777	D ''elKL%\"-./00r?   c                      \ rS rSrS=rrSr\S 5       r\S 5       r	\S 5       r
\S 5       r\S 5       rS	 rS
 rS rS\R"                  \R"                  S4S jrS\R"                  \R"                  S4S jrS\R"                  \R"                  S4S jr\S 5       rS\R"                  \R"                  S4S jr\S 5       rS\R"                  \R"                  S4S jr\S 5       rS\R"                  \R"                  S4S jr\S 5       rS\R"                  \R"                  SS4S jr\S 5       rS\R"                  \R"                  S4S jr \S 5       r!\"RF                  RH                  S 5       r%\"RF                  RH                  S 5       r&\"RF                  RH                  S 5       r'\"RF                  RH                  S 5       r(\"RF                  RH                  \"RF                  RR                  S 5       5       r*\"RF                  RH                  S  5       r+\"RF                  RH                  S! 5       r,\"RZ                  " SS"\"RF                  R\                  4S#S$9\"RZ                  " S\"RF                  R^                  4SS%S$9S& 5       5       r0\"RZ                  " S\"RF                  R^                  4SS%S$9S' 5       r1\"RF                  Rd                  S( 5       r3\"RF                  Rh                  \"RF                  Rj                  S) 5       5       r6\"RF                  Rn                  S* 5       r8\"RF                  Rn                  \"RF                  R^                  S+ 5       5       r9SaS, jr:\"RZ                  " S-SS\"RF                  R^                  4SS\"RF                  Rh                  4SS\"RF                  R^                  \"RF                  Rh                  -   4S.S$9S/ 5       r;\"RF                  Rx                  S0 5       r=\"RF                  Rx                  S1 5       r>\"RF                  Rx                  \"RF                  R~                  \"RF                  Rj                  S2 5       5       5       r@\"RZ                  " S3S\"RF                  R^                  4S%S$9\"RF                  R                  S4 5       5       rB\"RZ                  " S3S\"RF                  R^                  4S%S$9\"RF                  R\                  S5 5       5       rC\"RF                  R                  \"RF                  R^                  S6 5       5       rE\"RZ                  " S3S\"RF                  R^                  4S%S$9\"RF                  R                  S7 5       5       rG\"RZ                  " S8S9S:S$9\"RF                  R                  \"RF                  R                  \"RF                  R                  S; 5       5       5       5       rJ\"RF                  Rx                  \"RF                  R                  S< 5       5       rL\"RF                  R                  S= 5       rN\"RZ                  " S\"RF                  R^                  4S3S%S$9\"RF                  R                  S> 5       5       rO\"RF                  Rh                  \"RZ                  " S3S\"RF                  R^                  4S%S$9S? 5       5       rP\"RF                  Rh                  S@ 5       rQ\"RF                  R                  SA 5       rS\"RZ                  " S\"RF                  R^                  4S3S%S$9SB 5       rT\"RZ                  " S\"RF                  R^                  4S5      SC 5       rU\"R                  SD 5       rW\"RF                  R                  \YSE 5       5       rZ\"RF                  Rn                  \YSF 5       5       r[SG r\SbSH jr]ScSI jr^\YSJ 5       r_\"RF                  R                  \YSK 5       5       r`SL ra\"RF                  R\                  \YSM 5       5       rb\"RF                  R                  \YSN 5       5       rc\"RF                  R                  \YSO 5       5       rd\"RF                  R                  \YSP 5       5       rf\"RZ                  " SQ\"RF                  R                  4SRSS\"RF                  R                  4ST\"RF                  R\                  4SU\"RF                  R                  4SV\"RF                  R                  4SW\"RF                  R                  4SX\"RF                  Rn                  4SYS$9	SZ 5       rgS[ rh\"RZ                  " SSS%S$9\"RZ                  " S\"RF                  R                  4SS\S$9S] 5       5       rj\"RF                  Rn                  S^ 5       rk\"RF                  R                  S_ 5       rmS`rng)dComponentReflectionTesti  NTc                     U R                  US 5        [        R                  R                  R                  (       a+  U R                  U[        R
                  R                  5        g g r   )define_reflected_tablesr   rT   rU   r5   r   rV   r[   s     r<   r]   %ComponentReflectionTest.define_tables  sF    ##Hd3##++'''..2L2LM ,r?   c                 N   U(       a  US-   nOSn[         R                  R                  R                  (       a  [	        SU-  SS94nOSn[        SU[        S[        R                  S	S
9[        S[        R                  " S5      SS9[        S[        R                  " 5       SS9[        S[        R                  /UQ76 [        R                  " SSSS9[        R                  " S5      US	S9
n[        SU[        S[        R                  S	S
9[        S[        R                  [	        SU-  SSS95      [        S[        R                  [	        SU-  5      5      [        S[        R                  " S5      S	S 9[        R                  " S!S"S9[        R                  " SSS#S$S9US	S9
  [        S%U[        S[        R                  5      [        S&[        R                  [	        UR                  R                   5      5      [        S'[        R                  " S(5      S	S)9[        R"                  " SS*S+S9US	S9  [        S,U[        S-[        R                  S	S.S/9[        S[        R                  " S(5      S0S19[        S2[        R                  " S(5      S3S19[        S4[        R                  " S55      S6S19US7S89  [        S9U[        S[        R                  " S(5      5      US:S89  [         R                  R$                  R                  (       GaW  Uc  [        S;U[        S-[        R                  S	S
9[        S[        R                  " S(5      5      [        S<[	        S=[         R&                  R(                  -  5      5      S	[&        R*                  R,                  R.                  S>9  O[        S?U[        S-[        R                  S	S
9[        S@[	        SA[&        R*                  R,                  R.                  -  5      5      [        S[        R                  " S(5      5      US	S9  [        SBU[        S-[        R                  S	S
9[        S[        R                  " S(5      5      US	S9  [         R                  R0                  R                  (       Ga  [3        SCUR                  R4                  UR                  R6                  S	S 9  [3        SDUR                  R                   UR                  R6                  UR                  R4                  5        U(       Gd  [        SEU[        SF[        R                  " S5      5      S	SG9n[        SHU[        S-[        R                  S	S
9[        SF[        R                  " S5      5      S	SG9n[         R                  R8                  R                  (       a  [         R                  R:                  R                  (       a\  [3        SIUR                  R<                  R?                  5       5        [3        SJUR                  R<                  R?                  5       5        [         R                  R@                  R                  (       a  U RC                  X5        U(       d<  [         R                  RD                  R                  (       a  U RG                  U5        g g g )KN. z%susers.user_id
user_id_fkr   r@   usersuser_idTrM   test1   Fnullabletest2parent_user_id	test2 > 0zz_test2_gt_zerousers check constraintrp   r   test2 <= 1000rS   r   
dingalingsdingaling_id
address_idz%semail_addresses.address_idzz_email_add_id_fgdi fk commentid_userrO      )uniquez$address_id > 0 AND address_id < 1000address_id_gt_zerozz_dingalings_multipledi unique commentemail_addressesremote_user_idemail_address   )indexemail_ad_pkea pk commentcomment_testrL   
id comment)rN   r   data % commentr   d2)Comment types type speedily ' " \ '' Fun!d3*   Comment
withescapesthe test % ' " \ table comment)rS   r   no_constraints"no
constraintshasescapedcommentlocal_table	remote_idz%s.remote_table_2.id)r   rS   remote_tablelocal_idz%s.local_table.idremote_table_2users_t_idxusers_all_idxnoncol_idx_test_nopkqr   noncol_idx_test_pknoncol_idx_nopknoncol_idx_pk)$r   rT   self_referential_foreign_keysr5   r   r   r   rs   rt   CHARFloatr   r   r   r   r   rP  r   cross_schema_fk_reflectionr   rV   r:   r   default_schema_nameindex_reflectionr!   rQ  rU  indexes_with_ascdescreflect_indexes_with_ascdescr  descr  rX   temp_table_reflectionrZ   )r;   r\   rS   schema_prefixparent_id_argsrO  r  r  s           r<   rI  /ComponentReflectionTest.define_reflected_tables"  s8   "SLMM99AA%5LN  N9bff$77BGGAJ77BHHJ7#RZZA.A'0
 /
" 	>2::4@

2]B-+ 

,}<=
 6299R=66) -+	 =	
@ 	<,#RZZEGGOO1LM?BIIbM>##=/ 	
 	4|L6299R=2BC		"H
 420HI9	
 	6299R=)<	
 66>>>~!4>6299R=1#"2W^^5O5OO #'!99,,@@ "4>""/$ii//CCD 6299R=1!"& $4>6299R=1!"& ,,444-dK%''-- ',*3		!-"&	($ &+(4>3		!-"&&" $$99AA((EEMM+-A-C-C-E-E-J-J-LM/+=+?+?+A+A+F+F+HI22::X.'**@@HH""8, Ivr?   c                 b    [        [        [        R                  S[        R                   35      $ rg   ri   rk   s    r<   rl   'ComponentReflectionTest.temp_table_name  rn   r?   c                    [        [        [        R                  5      nU R                  5       n[	        UU[        S[        R                  SS9[        S[        R                  " S5      5      [        S[        R                  5      [        R                  " SS[        R                   3S9[        R                  " S	S5      40 UD6n[        R                  R                  R                  (       a~  [        R                  R                   R                  (       aT  ["        R$                  " US
['        S[        R                  -  5      5        ["        R$                  " US['        S5      5        g g g )NrL   TrM   rp   rP   r   user_tmp_uq_r   user_tmp_ixr`   rq   ra   rr   )r   r   r:   rl   r   r   rs   rt   ru   r   rj   r!   r   rT   rW   r5   rv   r   rc   r    rw   s        r<   rZ   *ComponentReflectionTest.define_temp_tables  s   $VVYY7((*
4T262::b>*5"&&! |FLL>-JKHH]E*
 
" ,,44  0088LL028,,? LL=#6L2MN 9 5r?   c                    [         R                  R                  R                  (       a  S1nO
[	        5       nS H  nUnU(       a  U SU 3nUS-   nXC;   a  SOSnSU SU S	U 3n[
        R                  " US
[        U5      5        XC;   aU  Sn	U(       a"  [         R                  " S5      (       a  U SU	 3n	SU	 SU S3n
[
        R                  " US
[        U
5      5        [
        R                  " US[        SU SU 35      5        M     g )Nr]  rO  rh  r]  rL  _vzMATERIALIZED rM  zCREATE zVIEW r   r`   	mat_indexoraclezCREATE INDEX z ON z(data)ra   zDROP )	r   rT   materialized_viewsr5   setr   rc   r    against)r;   r\   rS   materializedry   fullname	view_nameprefixrd   
index_namer   s              r<   rX   $ComponentReflectionTest.define_views  s   ..66(>L5LDJ!H$XQzl3 4I(2(B_F&yk1CH:N  LL>3u:>)(
gooh77$*81ZL!9J%j\i[GX~s3x@LL-uVHE)-M)N# Er?   c                     0 n[         R                  U;   a  UR                  U5        [         R                  U;   a  UR                  U5        [         R                  U;   a  UR                  U5        U$ r   )r   r@  updaterA  rB  )r   r   r   r   r  r  s         r<   _resolve_kind%ComponentReflectionTest._resolve_kind  sX    t#JJv??d"JJu''4/JJ|$
r?   c                 .   [         R                  R                  R                  (       d!  UR	                  5         UR	                  5         g [         R                  R
                  R                  (       d"  UR                  U5        UR	                  5         g g r   )r   rT   r  r5   clearr  r  )r   r   r  s      r<   _resolve_views&ComponentReflectionTest._resolve_views  s^    66>> KKM!!44<<LL&  =r?   c           	      4   S nU[         R                  L a  S nU[         R                  L a  S nS SS1[        R                  R
                  SSSS	U R                  5       10n[        R                  R                  R                  (       dB  US    R                  S5        U[        R                  R
                     R                  SS/5        [        R                  R                  R                  (       d  US    R                  SS/5        [        R                  R                  R                  (       a)  [        R                  R                  R                  (       d$  US    R                  S	U R                  5       /5        [        R                  R                  R                  (       d  US    R                  S	/5        UR!                  5        VVs0 sH5  u  pxU" U5      (       d  M  US
   Xa   ;  d  M!  U(       a  US
   U;   d  M3  Xx_M7     n	nnU	$ s  snnf )Nc                     g)NTr@   )_s    r<   r   8ComponentReflectionTest._resolve_names.<locals>.<lambda>&  s    r?   c                     SU S   ;  $ Ntmpr   r@   r   s    r<   r   r  (  s    U!A$%6r?   c                     SU S   ;   $ r  r@   r  s    r<   r   r  *  s    Uad]r?   r}  r  r{  r  r  r   r   )r   r=  r>  r   r   rV   rl   rT   r  r5   addr  r  r  temp_table_namesrv   items)
r   rS   r1   rD  valuesscope_filterremovedr   vr  s
             r<   _resolve_names&ComponentReflectionTest._resolve_names%  s   %K'''6LK)))2L >#34NN&&&$$$&)	
 ::BBDMm,GNN../66!12 0088DM  ')=>   66>>##44<<DM  ,0D0D0F!GH//77DM  ,0 
&A  !GO+  "QqT\%9	 AD& 	 
 

s   H*	H7H	Hc                    US4[         R                  0nUS4[         R                  US4[         R                  US4[         R                  0nU R                  Xe5        US4[         R                  US4[         R                  US4[         R                  US4[         R                  US	4[         R                  US
4[         R                  US4[         R                  US4[         R                  US4[         R                  US4[         R                  XR                  5       4[         R                  0nU R	                  X7Xe5      nU R                  XXH5      nU$ )Ndingalings_vemail_addresses_vusers_vr   rO  r]  rh  ro  ry  r{  r}  r  r  r  r(   r?  r  rl   r  r  )	r   rS   r1   r   rD  r  r   r   r  s	            r<   exp_options#ComponentReflectionTest.exp_optionsP  s1     0$((;()488Y\"DHH

 	E0Wtxx\"DHH&'^$dhh%&]#TXX^$dhh%&+,dhh)*DHH))+,dhh
   uC!!&C
r?   c                    SS 0nUS4U0nUS4UUS4UUS4U0nU R                  Xv5        US4UUS4UUS4UUS	4SS
0US4SS0US4UUS4UUS4UUS4UUS4UXR                  5       4U0nU R                  X8Xv5      n	U R                  XXI5      n	U	$ )Ntextr  r  r  r   rO  r]  rh  ro  rx  ry  rz  r{  r}  r  r  r  )r  rl   r  r  )
r   rS   r1   r   rD  emptyr  r   r   r  s
             r<   exp_comments$ComponentReflectionTest.exp_commentso  s    0%8()5Y\"E

 	E0Wu\"E&'^$=' %&@) ]#U^$e%&+,e)*E))+,e
"   uC!!&C
r?   c                 J  ^
 S[         R                  S S4S jm
U
4S jnUS4T
" SS[         R                  S9T
" S	5      T
" S
5      T
" S5      /0nUS4T
" S	S[         R                  S9T
" S5      T
" S5      /US4T
" SS[         R                  S9T
" S[         R                  S9T
" S[         R                  S9T
" S5      /US4T
" SS[         R                  S9T
" S5      T
" S5      /0nU R                  Xv5        US4U" S5      T
" SSS9T
" SSS9T
" S5      /US4U" S5      T
" S	5      T
" S
5      T
" S5      /US4U" S	5      T
" S5      T
" S5      /US4U" SSS9T
" SSS9T
" S S!S9T
" S"S#S9/US$4T
" S5      /US%4U" S5      T
" S5      T
" S&5      /US'4U" S5      T
" S(5      T
" S5      /US)4U" S5      T
" S5      /US*4T
" S+5      /US,4U" S5      T
" S+5      /XR                  5       4U" S5      T
" S5      T
" S5      /0nU R	                  X8Xv5      n	U R                  XXI5      n	U	$ )-NFTc                 b    U U[         R                  UUUS.nUS:X  a  UR                  S5        U$ )N)rp   autoincrementtypedefaultr   rT  omitr  )r(   r?  pop)rp   autor  r   rT  r  s         r<   r   0ComponentReflectionTest.exp_columns.<locals>.col  s;     !%""$C v~(Jr?   c                 B   > S[         R                  SS.UEnT" U 40 UD6$ )NTF)r  r  rT  r(   r?  )rp   rx   r   s     r<   pk/ComponentReflectionTest.exp_columns.<locals>.pk  s&    488M"MBt?r?"r?   r  r^  r  )r  rT  r_  rb  rO   r  ri  rj  r  rP  rQ  rS  rU  rV  r   rL   rp   r   rO  r]  rh  ro  rp  rr  rq  rs  rt  ru  rw  ry  r{  r|  r}  r~  r  r  r  r  r  )r   rS   r1   r   rD  r  r  r   r   r  r   s             @r<   exp_columns#ComponentReflectionTest.exp_columns  s    dhht		#
 ^$N$((CL!IF	'
 ()LvA$%O$,
 YIFTXX>Gdhh/Gdhh/$%	" \"Dv9FE
%
$ 	E0W9Ge,Ge,$%	  \">"L!IF	% &'< $%O$*
 ^$4.F$45L D":;' %&V]#bhFS=M%N^$r$xZ#f+&N%&D3v;(?+,s3xj)*RXs3x,@))+,4FE
/C&
N   uC!!&C
r?   c                 
    1 Sk$ )N>   rp   r  r  rT  r@   r   s    r<   _required_column_keys-ComponentReflectionTest._required_column_keys  s    66r?   c                    [         R                  S S.S jnU" S S9n[        R                  R                  R
                  (       a  US4U" S5      0nOUS4U0nUS4UUS4UUS4U0nU R                  X5        US	4U" S
5      US4U" S5      US4U" SSSS9US4U" S5      US4UUS4U" S5      US4U" S5      US4U" S5      US4UUS4U" S5      XR                  5       4U" S5      0n	[        R                  R                  R
                  (       d2  U	R                  5        H  n
U
S   c  M  [         R                  U
S'   M      U R                  X9X5      nU R                  XXK5      nU$ )NrZ  c                      [        U5      U US.$ )N)constrained_columnsrp   r   )list)rp   r   colss      r<   r  +ComponentReflectionTest.exp_pks.<locals>.pk  s    '+Dz" r?   r   r  r^  r  r  r   rO  rP  r]  rh  r_  rm  rn  ro  rL   ry  r{  r}  r  r  r  rp   )r(   r?  r   rT   materialized_views_reflect_pkr5   r  rl   reflects_pk_namesr  r  r  )r   rS   r1   r   rD  r  r  r  r   r   valr  s               r<   exp_pksComponentReflectionTest.exp_pks  s     88T 	 99AA#^4b6HIL#^4e<L()5Y\"E

 	E0Wr)}\"B~$6&'=/* ^$bh%&]#RX^$bh%&4+,e)*BtH))+,bh
 1199}}v;*"&((CK '   uC!!&C
r?   c                 
    SS1$ )Nrp   r  r@   r  s    r<   _required_pk_keys)ComponentReflectionTest._required_pk_keys'  s    -..r?   c                 R  ^  " S S5      mU[         R                  S 4U4S jjnUS4/ 0nUS4/ US4/ US4/ 0nU R                  Xv5        US4U" S	/S
/SSS9/US4U" S/S
/S5      U" S/S/SSSS9/US4U" S/S
/S5      /US4/ US4/ US4U" S/S/S[        R                  S9/US4U" S/S/SS S9/US4/ US4/ US4/ XR                  5       4/ 0n[        R                  R                  R                  (       d  XS4   R                  5         [        R                  R                  R                  (       dK  UR                  5        H7  n	U	 H.  n
U
S    [         R                  Ld  M  [         R                  U
S '   M0     M9     U R                  X8Xv5      nU R                  XXK5      nU$ )!Nc                       \ rS rSrS rSrg)+ComponentReflectionTest.exp_fks.<locals>.tti2  c                 f    US L =(       d'    [         R                  R                  R                  U:H  $ r   )r   r:   r   r  )r   r   s     r<   __eq__2ComponentReflectionTest.exp_fks.<locals>.tt.__eq__3  s,    TM Fyy((<<Er?   r@   NrA   rB   rC   rD   r  rF   r@   r?   r<   r   r  2  s    r?   r   c                 H   > U UU[         R                  Ub  UOT" 5       UUS.$ )N)r  referred_columnsrp   r2   referred_schemareferred_tabler   r  )r  ref_col	ref_table
ref_schemarp   r   r   s         r<   fk+ComponentReflectionTest.exp_fks.<locals>.fk9  s1     (,$+88","8Jbd"+"
 
r?   r  r  r  r   rO  rV  rP  rN  r   r]  rb  r_  rh  r`  ra  rZ  ri  ro  ry  r{  r|  rL   r  )r  r}  r~  r  r  rp   )r(   r?  r  r   rV   rl   r   rT   r  r5   r  named_constraintsr  r  r  )r   rS   r1   r   rD  r  r  r   r   valsr  r  r   s               @r<   exp_fksComponentReflectionTest.exp_fks+  s'   	 	 	(  0"5()2Y\"B

 	E0W$%	{G,O  \"I;W5!N!N%-+	% &'$%	{G<* ^$b%&]# MF$%11	& ^$J<$4H' %&+,b)*B))+,bC"
F ==EEG$%++-1199C6{$((2&*hhF   (
   uC!!&C
r?   c                 
    1 Sk$ )N>   rp   r  r  r  r  r@   r  s    r<   _required_fk_keys)ComponentReflectionTest._required_fk_keys  s    
 	
r?   c                    SS SSS.S jnUS4/ 0nUS4/ US4/ US4/ 0nU R                  Xv5        U(       a  XaS4   R                  U" SS	S
95        US4/ U" SSSS9QU" SSSSS
9QU" SSSSS9QUS4/ U" S[        R                  SSS9QU" S[        R                  SS9QU" SSSSSS9QUS4/ U" S[        R                  S
9QU" S[        R                  SS9QUS4/ US 4/ US!4/ U" S"[        R                  SS9QUS#4/ U" S$[        R                  SS9QUS%4/ US&4/ U" S'S(S'S)0S*9QUS+4/ U" S'S,S'S)0S*9QXR	                  5       4/ U" S-S.S
9QU" S/S0[
        R                   3SSS19Q0n[        R                  R                  R                  (       a)  [        R                  R                  R                  (       d(  XS&4   R                  5         XS+4   R                  5         U R                  X8Xv5      n	U R                  XXI5      n	U	$ )2NF)rd  column_sorting
duplicatesr  c                    [         R                  R                  n[         R                  R                  n[         R                  R                  nU(       a  UR
                  (       a  U(       a  UR
                  (       d  gU[        U5      U [        R                  / S.n	U(       a;  X)S'   UR
                  (       a&  U	S   =U	S'   n
U
 Vs/ sH  oU;   a  S OUPM     snU	S'   U(       a  X	S'   U	/$ s  snf )Nr@   )rd  column_namesrp   dialect_optionsinclude_columnsr  r
  expressionsduplicates_constraint)	r   rT   foreign_keys_reflect_as_index#unique_constraints_reflect_as_index*reflect_indexes_with_ascdesc_as_expressionr5   r  r(   r?  )rp   rd  r  r  r  r  fk_reqdup_reqsorting_expressionr  origr   s               r<   r   0ComponentReflectionTest.exp_indexes.<locals>.idx  s     %%CCF&&JJG  KK  6>>7??  $T
#'88#%C (6$%%--03N0CCC&DH+DHq^ 3:D+C' /3+,5L+s   	C/r  r  r  r   rO   r  r   rO  rV  rN  T)rp   r  rP  rU  rQ  r  r  )rp   rd  r]  )rp   rd  r  rb  r_  r^  rf  rh  rj  ri  ro  ry  r{  r|  r}  r~  r  r  r  r  )r  )rp   r  r  r  r   r  rp   r  )rp   r  rd  )r  extendr(   r?  rl   r   rj   r   rT   r  r5   r  r  r  r  )
r   rS   r1   r   rD  r   r  r   r   r  s
             r<   exp_indexes#ComponentReflectionTest.exp_indexes  s    #	J  0"5()2Y\"B

 	E0.1299F- W  %LTB YG  WgM$G 
 \" 
%V$((4DI
%YTXX$7
%  "1#
% &' *_4884*%DHH>* ^$b%&]# &[txxD9& ^$ 'Zdhh48' %&+, /*$'#3/ )* -osI>N-
 ))+, /U//'~6#	/U3
j   55==##@@HH234::<01288:  uC!!&C
r?   c                 
    1 Sk$ )N>   rp   rd  r
  r@   r  s    r<   _required_index_keys,ComponentReflectionTest._required_index_keys  s    11r?   Fc                    S SS S.S jnUS4/ 0nUS4/ US4/ US4/ 0nU R                  X5        US4/ U" S	S
SSSS9QUS4/ U" S[        R                  [        R                  S9QU" SSSSSS9QUS4/ US4/ US4/ US4/ US4/ US4/ US4/ US4/ XR                  5       4/ U" SS[        R
                   3S 9Q0n	U(       a  0 UEUEU	E$ U R                  X9X5      n
U R                  XXJ5      n
U
$ )!NF)duplicates_indexis_indexr   c                     [         R                  R                  nU(       a  UR                  (       d  g[	        U5      U US.nU(       a  XS'   U/$ )Nr@   )r
  rp   r   r  )r   rT   *unique_index_reflect_as_unique_constraintsr5   r  )rp   r  r  r   r  reqr  s          r<   uc+ComponentReflectionTest.exp_ucs.<locals>.uc  sJ     ""MMC $T
"C
  *:&'5Lr?   r  r  r  r   rO  rQ  rU  r  T)rp   r  r  r]  rO   )rp   r  r_  r^  rf  rg  )rp   r  r   rh  ro  ry  r{  r}  r  r  r  rp   r  r   )r  r(   r?  rl   r   rj   r  r  )r   rS   r1   r   rD  all_r#  r  r   r   r  s              r<   exp_ucsComponentReflectionTest.exp_ucs  s    +/	  0"5()2Y\"B

 	E0W  &%2!  \" 	%FDHHE	% "1%=/	% &'^$b%&]#R^$b%&+,b)*B))+, /F<~!>?/9
@ 6l6e6v66$$T5GC%%f\GCJr?   c                 
    SS1$ )Nrp   r
  r@   r  s    r<   _required_unique_cst_keys1ComponentReflectionTest._required_unique_cst_keysK  s    ''r?   c                   ^
  " S S[         5      m
SU
4S jjnUS4/ 0nUS4/ US4/ US4/ 0nU R                  Xv5        US4U" S	[        R                  5      U" S
SSS9/US4U" SSS9/US4/ US4/ US4/ US4/ US4/ US4/ US4/ US4/ XR	                  5       4/ 0nU R                  X8Xv5      n	U R                  XXI5      n	U	$ )Nc                       \ rS rSrS rSrg)+ComponentReflectionTest.exp_ccs.<locals>.ttiV  c                     UR                  5       R                  SS5      R                  SS5      R                  SS5      nX;   $ )N(rM  )`)lowerreplace)r   r   r  s      r<   r  2ComponentReflectionTest.exp_ccs.<locals>.tt.__eq__W  s>    KKMWS"%WS"%WS"%	  {"r?   r@   Nr  r@   r?   r<   r   r-  V  s    #r?   r   c                    > T" U 5      XS.$ )N)sqltextrp   r   r@   )r  rp   r   r   s      r<   cc+ComponentReflectionTest.exp_ccs.<locals>.cc`  s    !$xJJr?   r  r  r  r   rO  r[  rW  rX  rY  rr  r]  z$address_id > 0 and address_id < 1000re  r   rh  ro  ry  r{  r}  r  r  r  r   )strr  r(   r?  rl   r  r  )r   rS   r1   r   rD  r7  r  r   r   r  r   s             @r<   exp_ccsComponentReflectionTest.exp_ccsO  s?   	# 	#	K
  0"5()2Y\"B

 	E0W?DHH-&4  \":-% &'^$b%&]#R^$b%&+,b)*B))+,b/
2   uC!!&C
r?   c                 
    SS1$ )Nrp   r6  r@   r  s    r<   _required_cc_keys)ComponentReflectionTest._required_cc_keys  s    	""r?   c                     [        U5      n[        [        R                  R                  UR                  5       ;   5        g r   )r   r'   r   r   rV   get_schema_namesr   s      r<   test_get_schema_names-ComponentReflectionTest.test_get_schema_names  s,    z"**d.C.C.EEFr?   c                     [        U5      n[        UR                  [        R                  R
                  5      5        [        UR                  S5      5        g )Nsa_fake_schema_foo)r   r'   
has_schemar   r   rV   r&   r   s      r<   test_has_schema'ComponentReflectionTest.test_has_schema  s9    z" : :;<!567r?   c                     UR                  SS[        [        R                  R                  0S9n[        U5      n[        [        R                  R                  UR                  5       ;   5        g)z
test #7300r   barschema_translate_mapN)execution_optionsr#   r   r   rV   r   r'   r@  r   s      r<   %test_get_schema_names_w_translate_map=ComponentReflectionTest.test_get_schema_names_w_translate_map  s^      11ugnn88" 2 

 z"**d.C.C.EEFr?   c                    UR                  SS[        [        R                  R                  0S9n[        U5      n[        UR                  [        R                  R                  5      5        [        UR                  S5      5        g )Nr   rI  rJ  rD  )	rL  r#   r   r   rV   r   r'   rE  r&   r   s      r<   test_has_schema_w_translate_map7ComponentReflectionTest.test_has_schema_w_translate_map  si    11ugnn88" 2 

 z" : :;<!567r?   c                 &   [        U5      n[        SUR                  5       ;   5        [        UR                  S5      5        UR	                  [        S5      5         [        SUR                  5       ;   5        [        UR                  S5      5        UR                  5         [        SUR                  5       ;   5        [        UR                  S5      5        UR	                  [        S5      5        g ! UR	                  [        S5      5        f = f)Nfoo_barzCREATE SCHEMA foo_barzDROP SCHEMA foo_bar)r   r&   r@  rE  executer    r   r'   r   s      r<   test_schema_cache)ComponentReflectionTest.test_schema_cache  s     z"d33556+,3678	;Y$"7"7"99:T__Y/0I!6!6!889DOOI./s#89:Js#89:s   A<C4 4Dc                 ~    [         R                  " 5       n[        U5        [        UR                  S5      (       d   eg )Nr  )r   r7   r   hasattrr   )r   engines     r<   test_dialect_initialize/ComponentReflectionTest.test_dialect_initialize  s/    '')v~~'<====r?   c                 n    [        U5      n[        UR                  UR                  R                  5        g r   )r   r   r  r   r   s      r<   test_get_default_schema_name4ComponentReflectionTest.test_get_default_schema_name  s(    z"D$$j&8&8&L&LMr?   foreign_keyorder_byr   
use_schemac                    U(       a  [         R                  nOS n1 Skn[        U5      nU(       a0  UR                  U5       Vs/ sH  nUS   (       d  M  US   PM     nnOUR	                  U5      nU V	s/ sH  oU;  d  M
  U	PM     n
n	US:X  a  / SQn[        X5        g / SQn[        [        U
5      U5        g s  snf s  sn	f )N>   r{  ro  r}  ry  r  r  r  r   r_  r  )r]  rh  rO  )r   rV   r   get_sorted_table_and_fkc_namesget_table_namesr   sorted)r   r   r`  ra  rS   _ignore_tablesr   recr   ttable_namesanswers               r<   test_get_table_names,ComponentReflectionTest.test_get_table_names  s     ''FF
 z"  >>vFFCq6 AF  F ))&1F"(D&Q^,Cq&D}$?F$?F{#V, Es   B:	B:6B?B?c                 \   [        U5      nU(       a  [        R                  nOS nUR                  U5      n[        R
                  R                  R                  (       a4  [        [        U5      SS/5        [        UR                  U5      S/5        g / SQn[        [        U5      U5        g )Nr  r  r  )r  r  r  )r   r   rV   get_view_namesr   rT   r  r5   r   re  get_materialized_view_names)r   r   ra  r   rS   ri  rj  s          r<   test_get_view_names+ComponentReflectionTest.test_get_view_names  s     z"''FF))&1..66{#&99%EF008>:JKEF{#V,r?   c                     [        U5      nUR                  5       n[        [        U5      S[        R
                   3/5        g rg   )r   get_temp_table_namesr   re  r   rj   r   r   r   r  s       r<   test_get_temp_table_names1ComponentReflectionTest.test_get_temp_table_names  s9    z"446F#$6<<.'A&BCr?   c                 f    [        U5      nUR                  5       n[        [        U5      S/5        g r   )r   get_temp_view_namesr   re  rt  s       r<   test_get_temp_view_names0ComponentReflectionTest.test_get_temp_view_names  s/     z"335F#$|n5r?   c                 &    U R                  U5        g r   )_test_get_commentsr   r   s     r<   test_get_comments)ComponentReflectionTest.test_get_comments  s    
+r?   c                 X    U R                  U[        R                  R                  5        g r   )r|  r   r   rV   r}  s     r<   test_get_comments_with_schema5ComponentReflectionTest.test_get_comments_with_schema  s     	
GNN,F,FGr?   c                 f   [        U5      nU R                  US9n[        UR                  SUS9XBS4   5        [        UR                  SUS9XBS4   5        [        UR                  SUS9XBS4   5        U R                  R
                  R                  n[        UR                  XRS9XBU4   5        g )NrR   ro  rO  )r   r  r   r.  r   ry  rp   )r   r   rS   r   expno_csts         r<   r|  *ComponentReflectionTest._test_get_comments#  s    z"v."">&"A()	

 	""76":!"	

 	"">&"A()	

 ++00""6"9 !	
r?   )FFzuse_views,use_schemac                    U(       a  [         R                  nOS nU R                  R                  U R                  R                  peU(       a  / SQnOSS/n[        U5      n[        XuU45       GH  u  pUnUR                  XS9n[        [        U5      S:  [        U5      5        [        U
R                  5       GH  u  p[        UR                  X   S   5        X   S   R                  nUR                  n[!        U["        R$                  R&                  5      (       a  UR                  n[(        R*                  " S5      (       a4  U[,        R.                  [,        R0                  4;   a  [,        R.                  n[        [        [3        UR4                  5      R7                  UR4                  5      R7                  [,        R8                  [,        R:                  [,        R0                  [,        R.                  [,        R<                  [,        R>                  [,        R@                  /5      5      S:  UR                  < S	UR                  < S
X   S   < S	U< S35        URB                  (       a  GM  X   S   c  GM   e   GM     g )Nr  r  r  rO  rh  rR   r   rp   r  r  r/  z), r0  r  )"r   rV   r   rO  rh  r   zipr  r'   len	enumeratecolumnsr   rp   	__class__r  r  rs   r   
TypeEnginer   r  	sql_typesDateDateTimer  __mro__intersectionr   NumericTimer   _BinaryrN   )r   r   	use_viewsra  rS   rO  	addressesri  r   ry   tableschema_namer  ir   ctype	ctype_defs                    r<   r  (ComponentReflectionTest.test_get_columns;  s    ''FF KK--t{{/J/JyJK"$56Kz"!$[)2D!EJ K##J#CDCIM3t9- $EMM2CHHdgfo.11HH	i)<)<== ) 3 3I ??8,,NN&&? 2 !*I
 EMM*%i&7&78% ) 1 1 ) 1 1 ) 2 2 ) ) ) 0 0 ) 1 1
 " xx476?EC#* 79-555Q 3 "Fr?   c                     U R                  5       nU R                  U   n[        U[        5       US9nU R	                  X4SS9  g )Nr   F)strict_constraints)rl   r   r   r   assert_tables_equal)r   r   ry   rz   reflected_user_tmps        r<   test_reflect_table_temp_table5ComponentReflectionTest.test_reflect_table_temp_table  sL    ))+
;;z*"
*
 	  U 	! 	
r?   c                 .   U R                  5       nU R                  U   n[        U5      nUR                  U5      n[	        [        U5      S:  [        U5      5        [        UR                  5       H   u  pg[        UR                  XV   S   5        M"     g )Nr   rp   )
rl   r   r   r  r'   r  r  r  r   rp   )r   r   ry   rz   r   r  r  r   s           r<   test_get_temp_table_columns3ComponentReflectionTest.test_get_temp_table_columns  sy    ))+
;;z*z"
+D	As4y) 0 01FA$'&/* 2r?   c                     [        U5      nUR                  S5      n[        U Vs/ sH  oDS   PM	     sn/ SQ5        g s  snf )Nr   rp   )rL   rp   r   )r   r  r   )r   r   r   r  r   s        r<   test_get_temp_view_columns2ComponentReflectionTest.test_get_temp_view_columns  s=     z"-D)DS[D)+@A)s   >)Fc                    U(       a  [         R                  R                  nOS nU R                  R                  U R                  R
                  pT[        U5      nU R                  US9nUR                  UR                  US9nU R                  U/XsUR                  4   /U R                  5        UR                  UR                  US9n	XsUR                  4   S   n
[        U	S   U
5        [         R                  R                  R                  5          [        U	S   S5        S S S 5        U R                  R                   R                  nU R                  UR                  XS9/XsU4   /U R                  5        g ! , (       d  f       N_= f)NrR   r  rp   rm  )r   r   rV   r   rO  rh  r   r  r  rp   _check_listr  r   rT   r  fail_ifry  )r   r   ra  rS   rO  r  r   r  
users_cons	addr_consexp_colsr  s               r<   r  .ComponentReflectionTest.test_get_pk_constraint  s\   
 ^^//FF;;,,dkk.I.Iyz"ll&l)++EJJv+F
L3

345t7M7M	
 **9>>&*I		/01FGI+,h7//779	&!=1 : ++00##F#:;&!"#""	
	 :9s   E>>
Fc                 P   U(       a  [         R                  nOS nU R                  R                  U R                  R                  pT[        U5      nUn[        R                  R                  R                  (       a  UR                  UR                  US9nUS   n	[        R                  R                  R                  5          [        U	S   S5        S S S 5        [        U	S   U5        [        U	S   UR                  5        [        U	S   S/5        [        U	S	   S
/5        UR                  UR                  US9n
U
S   n	[        R                  R                  R                  5          [!        U	S   S L5        S S S 5        [        U	S   U5        [        U	S   UR                  5        [        U	S   S/5        [        U	S	   S/5        U R                  R"                  R                  n[        UR                  XS9/ 5        g ! , (       d  f       GN9= f! , (       d  f       N= f)NrR   r   rp   rN  r  r  r  rP  r  rV  ri  )r   rV   r   rO  rh  r   r   rT   r  r5   r"  rp   r  r  r   implicitly_named_constraintsr'   ry  )r   r   ra  rS   rO  r  r   expected_schemausers_fkeysfkey1
addr_fkeysr  s               r<   r#  -ComponentReflectionTest.test_get_foreign_keys  s   
 ''FF KK--t{{/J/Jyz"  99AA//

6/JKNE!!33;;=E&M<0 > '(/:&'4()I;7+,/?.@A **9>>&*I
1::BBDE&M-. E 	E#$o6E"#UZZ0E$%	{3E'(+;*<=++00D!!&!8"=+ >= EDs   H*H
H
H%c                 b   U R                  SUR                  R                  -  S[        R                  R
                  -  S[        R                  R
                  -  5      u  p#n[        U5      nUR                  UR                  5      n[        [        U5      S5        US   n[        US   [        R                  R
                  5        [        US   UR                  5        [        US   S	/5        [        US
   S/5        UR                  UR                  [        R                  R
                  S9n[        [        U5      S5        US   n	[        U	S   S UR                  R                  4;   5        [        U	S   UR                  5        [        U	S   S	/5        [        U	S
   S/5        g )Nz%s.local_tablez%s.remote_tablez%s.remote_table_2r   r   r  r  r  rL   r  r|  rR   r~  )r   r   r  r   r   rV   r   r"  rp   r   r  r'   )
r   r   r{  r}  r  r   local_fkeysr  remote_fkeysfkey2s
             r<   "test_get_inter_schema_foreign_keys:ComponentReflectionTest.test_get_inter_schema_foreign_keys  s    59KKz11EEE : ::'.."<"<<5
1> z"++K,<,<=Ca AE#$gnn&@&@AE"#^%8%89E$%v.E'(;-8,,gnn&@&@ - 
 	Cq!Q#$""66	
 	E"#[%5%56E$%v.E'(:,7r?   c                 j   U(       a  [         R                  nOS n[        U5      nUR                  SUS9nU R	                  US9nU R                  XVUS4   U R                  5        U R                  R                  R                  nU R                  UR                  XsS9XcU4   U R                  5        g )NrO  rR   )
r   rV   r   r&  r  r  r  r   ry  rp   )r   r   ra  rS   r   indexesr  r  s           r<   r'  (ComponentReflectionTest.test_get_indexes  s    
 ''FF z"""76":f-&'*+T-F-F	
 ++00V3 !%%	
r?   )r  r  )r  r  ztname,ixnamec                    [        U5      nUR                  U5      nU R                  5       S U4   nU R                  XVU R                  5        [        U[        5       US9n[        [        UR                  5      S5        [        [        UR                  5      S   R                  U5        [        [        UR                  5      S   R                  U5        g )Nr   r   r   )r   r&  r  r  r  r   r   r   r  r  r   r  r  rp   )r   r   tnameixnamer   r  expected_indexesrh  s           r<   test_get_noncol_index-ComponentReflectionTest.test_get_noncol_index1  s     z"""5)  ++-tUm<D4M4MN%:>C		NADOA$$a(DOA##V,r?   c                     [        U5      nU R                  5       nUR                  U5      nU R                  SS9S U4   nU R	                  XEU R
                  5        g )NT)r%  )r   rl   r*  r&  r  r  )r   r   r   rp   	reflectedr  s         r<   &test_get_temp_table_unique_constraints>ComponentReflectionTest.test_get_temp_table_unique_constraintsG  s[     z"##%//5	lll%tTl3)B)BCr?   c                 Z   [        U5      nU R                  5       nUR                  U5      nU H  nUR                  SS 5        M     SS/SS./n[        R
                  R                  R                  (       a  / US   S'   [        U Vs/ sH  owS   S:X  d  M  UPM     snU5        g s  snf )	Nr  Fr   r  )rd  r
  rp   r   r  rp   )	r   rl   r&  r  r   rT   index_reflects_included_columnsr5   r   )r   r   r   ry   r  indexpectedr   s           r<   test_get_temp_table_indexes3ComponentReflectionTest.test_get_temp_table_indexesP  s    z"))+
"":.CGG%t,  ug}M
 ;;CC-/HQK)*#DGS6{m'CSGD	
Ds   
B(B(c                 0   U(       a  [         R                  nOS n[        SS/S.S/ SQS.S/ SQS.SS	S
/S.SS/S.SS/S./[        R                  " S5      S9n[        SU[        S[        R                  " S5      5      [        S[        R                  " S5      5      [        S[        R                  5      [        S	[        R                  " S5      5      [        S
[        R                  " S5      5      US9nU H.  nUR                  [        R                  " US   SUS   065        M0     UR                  U5        [        U5      n[        UR                  SUS9[        R                  " S5      S9n	[        5       n
[!        [#        U5      [#        U	5      5        [%        XY5       HV  u  pUR'                  SS 5      nU(       a  U
R)                  U5        [!        UR'                  SS 5      S 5        [!        X5        MX     [+        5       n[        SUUUS9n	U	R,                   Vs1 sH  oR.                  iM     nnU	R0                   Vs1 sH0  n[3        U[        R                  5      (       d  M$  UR.                  iM2     snR5                  S/5      nUR7                  U5      (       a   eU
(       a   [!        U
U5        [!        U[        5       5        U R8                  R:                  R.                  n[!        UR                  UUS9/ 5        g s  snf s  snf )Nunique_ar   )rp   r
  unique_a_b_c)r   br   unique_c_a_b)r   r   r  unique_asc_keyascr   zi.have.dotsr  zi have spacesr   rp   r   testtblrk  rc  rR   r
  r  r   )r   rS   )r   rV   re  operator
itemgetterr   r   rs   r   r   append_constraintr   r   r   r*  r  r   r  r  r  r  r   r  rp   constraintsr  
differencer  r   ry  )r   r\   r   ra  rS   uniquesr  r#  r   r  names_that_duplicate_indexr  refldupereflected_metadatar   	idx_namesuquq_namesr  s                       r<   r+  3ComponentReflectionTest.test_get_unique_constraintsa  s    ''FF#cU;'I'I)E5>J&>(3%@ ##F+

 3		"&3		"&3

#5"))B-(5"))B-(

 B####R%7IbjI  	Z z"''	&'A##F+
	
 &)U"CL#i.)g1JD 88.5D*..t4D)40O 2 &Z$	
	 *3):):;):#XX):	;  ++
+"b112 BGG+
 *n%
&	 	 ))(3333%*I6#% ++00D''v'>C <
s   'L"L1Lc                     U(       a  [         R                  nOS n[        U5      nS H&  nUR                  XSS9n[	        [        U5      5        M(     g )Nr  rR   )r   rV   r   r  r'   bool)r   r   ra  rS   r   viewr  s          r<   r  0ComponentReflectionTest.test_get_view_definition  sK    
 ''FFz"DD(((=ADG Er?   c                    [        U5      n[        [        5         UR                  S5        S S S 5        [        [        5         UR                  S5        S S S 5        g ! , (       d  f       N8= f! , (       d  f       g = f)Nview_does_not_existrO  )r   r   r   r  r   s      r<   'test_get_view_definition_does_not_exist?ComponentReflectionTest.test_get_view_definition_does_not_exist  sX    z"+,$$%:; -+,$$W- -, -,,,s   AA0
A-0
A>c                     [        U5      nS HG  u  p4UR                  U5      nU Vs0 sH  ofS   U_M
     snU   nUR                  SS5      (       a  MG   e   gs  snf )aX  test that 'autoincrement' is reflected according to sqla's policy.

Don't mark this test as unsupported for any backend !

(technically it fails with MySQL InnoDB since "id" comes before "id2")

A backend is better off not returning "autoincrement" at all,
instead of potentially returning "False" for an auto-incrementing
primary key column.

))rO  rP  )rh  r_  )r]  r^  rp   r  TN)r   r  get)r   r   r   r  cnamer  r   id_s           r<   test_autoincrement_col.ComponentReflectionTest.test_autoincrement_col  si     z"
LE
 ##E*D)-.AV9a<.u5C77?D1111
 /s   Ac                    [        [        R                  5      nU(       a  [        R                  OS n[        R
                  R                  R                  (       aS  UR                  SUS9n[        [        U[        5      5        UR                  SUS9n[        [        U[        5      5        g [        [        5         UR                  SUS9nS S S 5        g ! , (       d  f       g = f)NrO  rR   ry  )r   r   r:   rV   r   rT   r  r5   r  r'   r  r8   r   r  )r   ra  r   rS   r  s        r<   r  .ComponentReflectionTest.test_get_table_options  s     vyy!'1##t1199(((@CJsD)*(()9&(ICJsD)*23,,WV,D 433s   >C
C&c           	         [        [        R                  5      n[        R                  R
                  R                  (       aa  U(       a  [        R                  OS nUR                  US9nUR                  US9 Vs0 sH  nX54UR                  XSS9_M     nn[        XF5        g [        [        5         UR                  5       nS S S 5        g s  snf ! , (       d  f       g = f)NrR   )r   r   r:   r   rT   r  r5   rV   get_multi_table_optionsrd  r  r   r   r  )r   ra  r   rS   r  r  r  s          r<   test_multi_get_table_options4ComponentReflectionTest.test_multi_get_table_options  s    vyy!1199+5V''4F..f.=C "111@@E !7!7!7!MM@   M23224 43 43s   <C3C
C c                    ^ U4S jnU$ )Nc                   > [        T5      nU" US5        XS.nU (       a  U " 5       n / n[        R                  U;   a  UR                  / SQ5        [        R                  U;   a  UR                  SS/5        [        R
                  U;   a  UR                  SS/5        U (       a  XS'   U(       a  XS'   U" U UUUR                  S5      S	9n	U/n
U[        R                  :X  a2  UR                  5       nUR                  S
5        U
R                  U5        U[        R                  :X  a2  UR                  5       nUR                  S5        U
R                  U5        [        T5      X4$ )Nrh  )r1   r   )ro  rO  does-not-existr  r  r  rS   rD  )rS   r1   r   rD  r1   r   )r   r   r@  r  rA  rB  r  r   r=  copyr  append)rS   r1   r   r<  single_reflect_fn
exp_methodr   rx   rD  r  kwsnkwr   s               r<   provide_fixture>ComponentReflectionTest.get_multi_exp.<locals>.provide_fixture  sC    :&D d$56 /BL4'##? $&##%8:J$KL++t3##^5E$FG%8%1>"VVN3	C $C+++ggi 

3z'''ggi

3:&00r?   r@   )r   r   r  s    ` r<   get_multi_exp%ComponentReflectionTest.get_multi_exp  s    ,	1\ r?   c                     U" UUUU[         R                  U R                  5      u  pgnU H0  n	UR                  5         UR                  " S0 U	D6n
[        X5        M2     g Nr@   )r   r  r  r   r  r   r   r  rS   r1   r   r<  r   r  r  rx   results              r<   #test_multi_get_table_options_tables;ComponentReflectionTest.test_multi_get_table_options_tables=  sc    
 '''
3 B117B7F r?   c                     U" UUUU[         R                  U R                  5      u  pgnU H/  n	UR                  5         [	        UR
                  " S0 U	D6U5        M1     g r  )r   r.  r  r   r   get_multi_table_comment)
r   r  rS   r1   r   r<  r   r  r  rx   s
             r<   test_get_multi_table_comment4ComponentReflectionTest.test_get_multi_table_commentO  s`    
 '''
3 B,,2r2C8 r?   c           	         S[         4S jn[        U[        5      (       a6  [        UR	                  5        VVs0 sH  u  pVU" U5      U_M     snnX#5        g [        U Vs/ sH
  oT" U5      PM     snX#5        g s  snnf s  snf )Nr  c                 N    [         R                  " SSU 5      R                  5       $ )Nz['\" ]rM  )resubr2  )r  s    r<   _clean:ComponentReflectionTest._check_expressions.<locals>._cleana  s    66)R.4466r?   )r9  r  r8   r   r  )r   r  r  err_msgr  er  s          r<   _check_expressions*ComponentReflectionTest._check_expressions`  sk    	7 	7 c4  &,,.9.$!A.93HF+FqF+S: :+s   A9
 A?c                 `   Uc  [        XU5        g [        [        U5      [        U5      U5        [        X5       Hp  u  pV[        U5      [        U5      -   HP  nXs;   d  Xu;   d  M  Xv;   d  M  U SU SU 3nUS;   a  U R	                  XW   Xg   U5        M?  [        XW   Xg   U5        MR     Mr     g )Nz - )r  r  )r   r  r  r  r  )	r   r  r  req_keysmsgrr  r   r  s	            r<   r  #ComponentReflectionTest._check_listi  s    S!FSXs+F(Q#a&A}AF%(EQCs1#"6 AA 33AD!$HadG4 ) )r?   c                     [        [        UR                  5       5      [        UR                  5       5      5        U H(  nX   X%   pvU(       a  U/U/pvU R                  XgX55        M*     g r   )r   r  keysr  )r   r  r  r  
make_listsr   r!  r  s           r<   _check_table_dict)ComponentReflectionTest._check_table_dictw  sT    CCHHJ0A9cfqsQC1Q8/	 r?   c                     U" UUUU[         R                  U R                  5      u  pgnU HA  n	UR                  5         UR                  " S0 U	D6n
U R                  XU R                  5        MC     g r  )r   r  r  r   get_multi_columnsr&  r  r  s              r<   test_get_multi_columns.ComponentReflectionTest.test_get_multi_columns  sq     '!!
3 B++1b1F""60J0JK r?   c                     U" UUUU[         R                  U R                  5      u  pgnU H@  n	UR                  5         UR                  " S0 U	D6n
U R                  XU R                  SS9  MB     g )NT)r%  r@   )r   r  r  r   get_multi_pk_constraintr&  r  r  s              r<   test_get_multi_pk_constraint4ComponentReflectionTest.test_get_multi_pk_constraint  sy    
 '''LL
3 B117B7F""T33 #  r?   c                    [         R                  R                  R                  (       d[  X4 HS  nUR	                  5        H<  n[        U5      S:  d  M  [        S U 5       5      (       d  M-  UR                  US9  M>     MU     g g )Nr   c              3   f   #    U H(  oR                  S 5      S[        R                  4;   v   M*     g7f)rp   N)r  r(   r?  ).0r  s     r<   	<genexpr>7ComponentReflectionTest._adjust_sort.<locals>.<genexpr>  s'      ,CFaf$)993s   /1r  )r   rT   r  r5   r  r  anysort)r   r  r  r   objr  s         r<   _adjust_sort$ComponentReflectionTest._adjust_sort  sn    <<DD)::<C3x!| ,CF, ) ) S)	 ( * Er?   c                    U" UUUU[         R                  U R                  5      u  pgnU HT  n	UR                  5         UR                  " S0 U	D6n
U R                  XS 5        U R                  XU R                  5        MV     g )Nc                     [        U S   5      $ )Nr  tupleds    r<   r   EComponentReflectionTest.test_get_multi_foreign_keys.<locals>.<lambda>  s    uQ/D-E'Fr?   r@   )r   r"  r  r   get_multi_foreign_keysr8  r&  r  r  s              r<   test_get_multi_foreign_keys3ComponentReflectionTest.test_get_multi_foreign_keys  s    
 '&&LL
3 B00626FF ""60F0FG r?   c                     U" UUUU[         R                  U R                  5      u  pgnU HA  n	UR                  5         UR                  " S0 U	D6n
U R                  XU R                  5        MC     g r  )r   r&  r  r   get_multi_indexesr&  r  r  s              r<   test_get_multi_indexes.ComponentReflectionTest.test_get_multi_indexes  sq    
 '!!
3 B++1b1F""60I0IJ r?   c                    U" UUUU[         R                  U R                  5      u  pgnU HT  n	UR                  5         UR                  " S0 U	D6n
U R                  XS 5        U R                  XU R                  5        MV     g )Nc                     [        U S   5      $ )Nr
  r<  r>  s    r<   r   KComponentReflectionTest.test_get_multi_unique_constraints.<locals>.<lambda>  s    U1^;L5Mr?   r@   )r   r*  r&  r   get_multi_unique_constraintsr8  r&  r)  r  s              r<   !test_get_multi_unique_constraints9ComponentReflectionTest.test_get_multi_unique_constraints  s    
 ',,LL
3 B66<<Ff+MN""60N0NO	 r?   c                    U" UUUU[         R                  U R                  5      u  pgnU HT  n	UR                  5         UR                  " S0 U	D6n
U R                  XS 5        U R                  XU R                  5        MV     g )Nc                     [        U S   5      $ Nr6  r<  r>  s    r<   r   JComponentReflectionTest.test_get_multi_check_constraints.<locals>.<lambda>  s    U1Y<5Hr?   r@   )r   r2  r:  r   get_multi_check_constraintsr8  r&  r=  r  s              r<    test_get_multi_check_constraints8ComponentReflectionTest.test_get_multi_check_constraints  s    
 '++LL
3 B55;;Ff+HI""60F0FG	 r?   r  r  r  r"  r&  r*  r2  r.  methodc                     [        U5      n[        X15      n[        [        5         U" S5        S S S 5        g ! , (       d  f       g = f)Ntable_does_not_exists)r   getattrr   r   )r   rU  r   r   r   s        r<   test_not_existing_table/ComponentReflectionTest.test_not_existing_table  s6    0 z"t$+,() -,,s	   	8
Ac           	      ^  ^ [         R                  mU4S jn[        R                  R	                  [         SU5         [        [        S5         [        U5      R                  [        S[        5       5      S 5        S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)Nc                  T   > UR                  S0 5      n[        S5      US'   T" U 0 UD6$ )Nunreflectableerr)N
some_table)
setdefaultr   )r   r   urmcs      r<   patched;ComponentReflectionTest.test_unreflectable.<locals>.patched	  s1    or2B'>u'EB#$q;A;r?   r)  r^  r_  )r   r)  r(   patchobjectr   r   r   reflect_tabler   r   )r   r   rc  rb  s      @r<   test_unreflectable*ComponentReflectionTest.test_unreflectable	  sx    ((	
 ZZy*=wG&'>F
#11,
3T G HGFF HGs#   B.B<B
B	B
B,r   c                    [        5       nU(       a  [        R                  OS nUR                  XUSS9  [	        U5      nUR                  U5      nU(       a'  XvR                  U5      -  n XvR                  U5      -  nU(       a  U Vs/ sH	  o SU 3PM     nn[        [        UR                  5      [        U5      5        g ! [         a     NQf = fs  snf )NF)rS   r   resolve_fksrL  )r   r   rV   reflectr   rd  rn  ro  r  r   re  r   )	r   r   ra  r   mrS   r   r   rh  s	            r<   test_metadata%ComponentReflectionTest.test_metadata&	  s    
 J'1##t			*5e	Lz"%%f-))&11F::6BB /56v!!ovF6F188fVn-	 '  7s   ,C 
C
CCc                 B   [        SU[        S[        SS9[        S[        SS9SS9  UR                  U5        [	        U5      nUR                  S5      n[        USS05        UR                  S5      nU Vs0 sH  ofS	   US
   _M     nnSSS.n[        Xx5        g s  snf )Nunicode_commentsunicodeu   é試蛇ẟΩrr  emojiu	   ☁️✨u   試蛇ẟΩ✨r  rp   r   )rr  rs  r   r   r   r   r   r.  r   r  )	r   r   r\   r   tcr  r   valuer  s	            r<   test_comments_unicode-ComponentReflectionTest.test_comments_unicode;	  s    9g?7G[9$	
 	J'z"##$67B)*+ 23267$Q6AiL($7)K@E 8s   8Bc           
          [        SU[        S[        SS9SS9  UR                  U5        [	        U5      nUR                  S5      n[        USS05        UR                  S5      S   n[        US   US	   0SS05        g )
Nrq  rs  u&   🐍🧙🝝🧙‍♂️🧙‍♀️rr  u&   🎩🁰🝑🤷‍♀️🤷‍♂️r  r   rp   r   rt  )r   r   r\   r   ru  r   s         r<   test_comments_unicode_full2ComponentReflectionTest.test_comments_unicode_fullP	  s    7G-UV<		
 	J'z"##$67BABC/03QvY)%1Y'Z[r?   r@   r   r)   )NF)orA   rB   rC   rD   run_insertsrun_deletesr   rE   r]   rI  rl   rZ   rX   r  r  r  r   r?  r   r  r  r  propertyr  r  r  r  r  r  r  r&  r)  r:  r=  r   rT   schema_reflectionrA  rF  rM  rP  schema_create_deleterU  rZ  r]  r   !foreign_key_constraint_reflectionrU   rk  rp  r  ru  rW   rv   ry  r7  r~  r  r|  r  r  r  r  r  r  !primary_key_constraint_reflectionr  r#  r  r  r  r'  r  r  r  r6  r  temp_table_reflect_indexesr  r+  r  r  table_reflectionr  r  r  fixturer  r  rE  r  r  r  r  r&  r*  r.  r8  rB  rF  rL  r8  rS  rY  rh  r   rn  rw  comment_reflection_full_unicoderz  rF   r@   r?   r<   rG  rG    s    $$K+KN N
 k- k-Z 
 

 O OB  4!)Z oo^^B oo^^"L oo^^^@ 7 7
 oo^^.` / /
 oo^^Vp 
 
 oo^^sj 2 2
 oo^^CJ ( (
 oo^^8t # # ''G (G
 ''8 (8 ''G (G ''
8 (
8 ''**; + (; ''> (>
 ''N (N 	((JJK
 	w''(%,!-!-F 	w''(%,-- &&D 'D
 %%%%6 & &6
 ((, ), ((H  )H
0 	g&&../	ug&&667$$w'7'7'G'GG	

 (
<6
<6B ++	
 ,	
 +++ ,+ ++,,%%B & - ,B
 4))112\ 77
 8
: 4))112\ 77$> 8$>L 00"8  1"8H 4))112\ &&
 '
, 3/
 &&**22- 3 + '- ++22D 3 ,D 00
 1
  	w''((\ 22TD 3TDl %%4))112\ & %%. &. &&2 '20 	w''((\EE 4!1!1!9!9:EB5 C5 __/ /b ++  ,  ((9  )9;50 L L" 77  8$* 77H  8H& &&K  'K  22P  3P" 11H  2H" 	g..DDE>>	

 >>	
 
((99:$99	

 $88	
 
g..AAB+.*/.* $=	w%%&. >." (( )( 55\ 6\r?   rG  c                       \ rS rSrSrSr\R                  S 5       r\R                  S 5       r	S r
S rS r\R                  R                  S	 5       r\R                  R                  S
 5       rSrg)TableNoColumnsTestib	  )reflect_tables_no_columnsTc                 >    [        SU5        UR                  U5        g Nr  )r   r   r   r   r\   s      r<   table_no_columns#TableNoColumnsTest.table_no_columnsf	  s    gx J'r?   c                     [        SU5        [        R                  " US[        S5      5        [        R                  " US[        S5      5        UR	                  U5        g )Nr  r`   z*CREATE VIEW empty_v AS SELECT * FROM emptyra   zDROP VIEW IF EXISTS empty_v)r   r   rc   r    r   r  s      r<   view_no_columns"TableNoColumnsTest.view_no_columnsk	  sR    gx <=	
 	mS)F%G	
 	J'r?   c                 h    [        S[        5       US9n[        [        UR                  5      / 5        g )Nr  r   r   r   r   r  r   )r   r   r  t2s       r<   test_reflect_table_no_columns0TableNoColumnsTest.test_reflect_table_no_columns{	  s$    7HJjADJr?   c                     [        U5      n[        UR                  S5      / 5        UR                  5       n[        US/ 05        g )Nr  r  )r   r   r  r)  )r   r   r  r   multis        r<   !test_get_columns_table_no_columns4TableNoColumnsTest.test_get_columns_table_no_columns	  s>    z"DW%r*&&(EOR()r?   c                     [        5       nUR                  U5        [        UR                  5      R	                  S/5      (       d   eg r  )r   rl  r  r   r  )r   r   r  rm  s       r<   "test_reflect_incl_table_no_columns5TableNoColumnsTest.test_reflect_incl_table_no_columns	  s6    J			*188}))7)4444r?   c                 h    [        S[        5       US9n[        [        UR                  5      / 5        g )Nempty_vr   r  )r   r   r  r  s       r<   test_reflect_view_no_columns/TableNoColumnsTest.test_reflect_view_no_columns	  s$    9hj
CDJr?   c                     [        U5      n[        UR                  S5      / 5        UR                  [        R
                  S9n[        US/ 05        g )Nr  )r   )Nr  )r   r   r  r)  r   rA  )r   r   r  r   r  s        r<    test_get_columns_view_no_columns3TableNoColumnsTest.test_get_columns_view_no_columns	  sH    z"DY',&&JOO&<E%r*+r?   r@   N)rA   rB   rC   rD   __requires__r   r   r  r  r  r  r  r  rT   r   r  r  rF   r@   r?   r<   r  r  b	  s    1LK__( ( __( (*5
   , ,r?   r  c                   *   \ rS rSrSr\R                  " SS/S9S 5       r\R                  " 5       S 5       rS r	\R                  R                  S 5       r\R                  R                  \R                  " S	S
SSS9S 5       5       r\R                  R                  \R                  " SSSSS9S 5       5       r\R                  R                  S 5       r\R                  R$                  S 5       r\R                  R(                  S 5       rS r\R                  R.                  S 5       r\R                  R.                  S 5       r\R                  R.                  S 5       r\R                  " SSS\R                  R6                  4SSS\R                  R8                  40 SS\R                  R8                  40 SS\R                  R:                  4SSS\R                  R<                  4SSS\R                  R>                  4SS9S 5       r Sr!g) ComponentReflectionTestExtrai	  TF)paramsc                 F    UR                   (       a  [        R                  $ g r   )paramr   rV   )r   requests     r<   use_schema_fixture/ComponentReflectionTestExtra.use_schema_fixture	  s    ==%%%r?   c                 B   ^^^ [         R                  UUU4S j5       nU$ )Nc              3   N   >#    T[        T5      4v   TR                  T5        g 7fr   )r   r   )r   r   r\   r  s    r<   go:ComponentReflectionTestExtra.inspect_for_table.<locals>.go	  s$     $gj&999
+s   "%)
contextlibcontextmanager)r   r\   r   r  r  s    ``` r<   inspect_for_table.ComponentReflectionTestExtra.inspect_for_table	  s"    		"	"	, 
#	,
 	r?   c           
          S n[        U Vs/ sH  nUS   U" US   5      S.PM     snS S9n[        US S9n[        X5        g s  snf )Nc                     SR                  [        R                  " SU R                  5       [        R                  5      5      $ )N zand|\d|=|a|b|c|or|<|>)joinr  findallr2  I)r6  s    r<   	normalize5ComponentReflectionTestExtra.ck_eq.<locals>.normalize	  s.    88

3W]]_bddK r?   rp   r6  rp   r6  c                     U S   $ rP  r@   items    r<   r   4ComponentReflectionTestExtra.ck_eq.<locals>.<lambda>	      d9or?   r  c                     U S   $ rP  r@   r  s    r<   r   r  	  r  r?   )re  r   )r   r  r  r  r  s        r<   ck_eq"ComponentReflectionTestExtra.ck_eq	  sh    	
  &%D f)DO2LM% /
	 .
 	I s   Ac                     U" S5       u  p4[        SU[        S[        R                  " S5      5      US9  S S S 5        U R	                  WR                  SWS9/ 5        g ! , (       d  f       N/= f)Nry  rO   rk  rR   )r   r   rs   r   r  r2  )r   r\   r  rS   r   s        r<   #test_check_constraint_no_constraint@ComponentReflectionTestExtra.test_check_constraint_no_constraint	  sf    /04GV vryy}-	 1 	

++,<V+L	
 10s   -A
A-	my_inlineMyInlineNconstraint_namer   c                 v   U" S5       u  pE[        SU[        S[        5       SS9[        S[        5       [        R                  " SUS95      [        S[        S	5      5      US
9  S S S 5        WR                  SWS
9nU R                  UU=(       d    [        R                  SS./5        g ! , (       d  f       NL= f)Nsa_ccrL   TrM   r   a > 1 AND a < 5r   rO   rP   rR   a > 1 and a < 5r  )
r   r   r   rs   r   r   r2  r  r(   r?  r   r\   r  r  rS   r   r  s          r<   test_check_constraint_inline9ComponentReflectionTestExtra.test_check_constraint_inline	  s     w'+>FtWYD9I&&) vvbz* (  33GF3K	

 ,7txx0	
% ('s   AB**
B8my_ck_const	MyCkConstc                 *   U" S5       u  pE[        SU[        S[        5       5      [        R                  " SUS9US9  S S S 5        WR                  SWS9nU R                  UU=(       d    [        R                  SS./5        g ! , (       d  f       NL= f)Nr  r   za = 1 OR (a > 2 AND a < 5)r   rR   za = 1 or a > 2 and a < 5r  )	r   r   r   rs   r   r2  r  r(   r?  r  s          r<    test_check_constraint_standalone=ComponentReflectionTestExtra.test_check_constraint_standalone	  s     w'+>FsGI&""0  ( 33GF3K	

 ,7txx9	
 ('s   5B
Bc                 b   U" S5       u  p4[        SU[        S[        5       SS9[        S[        5       [        R                  " S5      5      [        S[        5       [        R                  " SS	S
95      [        S[        5       5      [        S[        S5      5      [        R                  " SSS
9[        R                  " SSS
9[        R                  " SSS
9US9  S S S 5        WR                  SWS9nU R                  USSS.S	SS.[        R                  SS./5        g ! , (       d  f       NK= f)Nr  rL   TrM   r   r  r  zb > 1 AND b < 5r  r   r   rO   rP   some_uqzc > 1 AND c < 5cc1	some_c_uqrR   zc > 1 and c < 5r  zb > 1 and b < 5r  )r   r   r   rs   r   r   r   r2  r  r(   r?  )r   r\   r  rS   r   r  s         r<   test_check_constraint_mixed8ComponentReflectionTestExtra.test_check_constraint_mixed
  s   w'+>FtWYD9sGIr'9'9:K'LMI&&'8{K
 sGI&vvbz*##F;""#45A##Ck: (& 33GF3K	

+<=$1BC.?@	
+ ('s   CD  
D.c                 @  ^^ [        SU[        S[        S5      5      [        S[        S5      5      [        S[        S5      5      5      n[        S[        R
                  " UR                  R                  5      UR                  R                  [        R
                  " UR                  R                  5      5        Sm[        S[        R                  " UR                  R                  T5      5        [        S	UR                  R                  5        UR                  T5        [        T5      nS	S/S
0 S./nU4S jnU" US   5         " S S[        5      n " U4S jS[        5      n[        R                  R                   R"                  (       a  S/ SQU" S5      SU" S5      /S
S.n	U" U	5        UR%                  SU	5        SS /U" ST S35      /S
S.n
U" U
5        UR'                  U
5        [)        UR+                  S5      U5        [-        5       n[        SUTS9nOD[/        S5         [)        UR+                  S5      U5        [-        5       n[        SUTS9nS S S 5        U R1                  WUTR2                  R4                  5        g ! , (       d  f       N6= f)Nrh  xrc  yzt_idxa  long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string 
t_idx_longt_idx_2F)rp   r
  rd  r  c                    > [         R                  R                  R                  (       a$  / U S'   TR                  R
                   S3/ 0U S'   g U R                  S0 5        g )Nr  _includer  )r   rT   r  r5   rY  rp   r`  )entryr   s    r<   completeIndexYComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.completeIndexO
  s\    ??GG+-'(!((--.h7,'(   !2B7r?   r   c                       \ rS rSrS rSrg)[ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_striZ
  c                 \    UR                  5       nSU;   =(       a    SU;   =(       d    SU;   $ )Nr2  r  r  r2  )r   r   ols      r<   r  bComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_str.__eq__[
  s)    [[]"}A#)*@sbyAr?   r@   Nr  r@   r?   r<   lower_index_strr  Z
  s    Br?   r  c                   "   > \ rS rSrU 4S jrSrg)^ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.coalesce_index_stri`
  c                 B   > SUR                  5       ;   =(       a    TU;   $ )Ncoalescer  )r   r   long_strs     r<   r  eComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.coalesce_index_str.__eq__a
  s    !U[[]2Hx57HHr?   r@   Nr  )r  s   r<   coalesce_index_strr  `
  s    I Ir?   r  )Nr  Nzlower(x)zlower(y))rp   r
  r  rd  zcoalesce(x, 'z')r   z>Skipped unsupported reflection of expression-based index t_idx)r   r   r   r!   r   r2  r   r  r  r  r  r   r   r9  r   rT    reflect_indexes_with_expressionsr5   insertr  r   r&  r   r	   !compare_table_index_with_expectedrY  rp   )r   r\   r   rh  r   r  r  r  r  
expr_indexexpr_index_longr   r  r  s     `          @r<   %test_reflect_expression_based_indexesBComponentReflectionTestExtra.test_reflect_expression_based_indexes3
  s?   3r
#3r
#3r
#
 	gtzz!##%%(!##%%ACCEE1BC'lDMM!##%%:;iJ'z" "!$#%	
	8 	hqk"	Bc 	B	I 	I
 <<DD 1#J/#J/ 
  	J *%OOAz* %!%&xj'CD   O /*OOO,  %x0BsBj9B  D$$S)84Z3*= 	..*++00	
 s   .1J
Jc                    [        SU[        S[        S5      5      [        S[        S5      5      5      n[        SUR                  R
                  5      nS/UR                  UR                  R                     S'   UR                  U5        [        U5      nUR                  S5      n[        USS/S/S[        R                  S./5        [        US	   S
   SUR                  R                  -     S/5        [        S[        5       US9n[        [!        UR"                  5      S	   R                  UR                  R                     S   S/5        g )Nrh  r  rc  r  r  includeF)rp   r
  r  rd  r  r   r  z
%s_includer   )r   r   r   r!   r   r  r  rY  rp   r   r   r&  r   r(   r?  r   r  r  )r   r\   r   rh  r   r   r&  r  s           r<   test_reflect_covering_index8ComponentReflectionTestExtra.test_reflect_covering_index
  sE   3r
#3r
#	
 GQSSUU#BEJ--223I>J'z"&&s+ $%(E(+u#'+xx	
 	N,-z00555 E		
 3
*=Q//
0A0A0F0FG E		
r?   c                     [        SU/[        U5       VVs/ sH  u  pE[        SU-  U5      PM     snnQ76 nUR                  U5        [	        U5      R                  S5       Vs/ sH  owS   PM	     sn$ s  snnf s  snf )Nrh  zt%dr  )r   r  r   r   r   r  )r   r   r\   r   r  type_rh  r   s           r<   _type_round_trip-ComponentReflectionTestExtra._type_round_trip
  s    
 8A7GH7G81fUQY&7GH

 	
#*:#6#B#B3#GH#Ga&	#GHH	 I Is   A5%A;c                     U R                  X[        R                  " SS5      5       HP  n[        U[        R                  5      (       d   e[	        UR
                  S5        [	        UR                  S5        MR     g )N   rR  )r  r  r  r  r   	precisionscaler   r   r\   typs       r<   test_numeric_reflection4ComponentReflectionTestExtra.test_numeric_reflection
  s`    (()"3"3B":
C c9#4#45555r"		1
r?   c                     U R                  X[        R                  " S5      5      S   n[        U[        R                  5      (       d   e[	        UR
                  S5        g )N4   r   )r  r  r   r  r   lengthr  s       r<   test_varchar_reflection4ComponentReflectionTestExtra.test_varchar_reflection
  sS    ##)"2"22"6

 #y//0000CJJr?   c                     [        SU[        S[        SS9[        S[        SS95      nUR                  U5        [	        [        U5      R                  S5       Vs0 sH  nUS   US   _M     snSSS	.5        g s  snf )
Nrh  r   TrS  r  Frp   rT  )r   r  )r   r   r   r   r   r   r  )r   r   r\   rh  r   s        r<   test_nullable_reflection5ComponentReflectionTestExtra.test_nullable_reflection
  s    3$/3%0	
 	
 #:.::3??C FS_,? U#	
s   A9CASCADEzSET NULLz	NO ACTIONRESTRICTzexpected,ondelete,onupdatec                    0 nU(       a  XFS'   U(       a  XVS'   Uc  Un[        SU[        S[        SS9SS9  [        SU[        S[        SS9[        S	[        [        S
SS95      [        S[	        S5      5      SS9  [        SU[        S[        SS9[        S[	        S5      SS9[        S[        5      [
        R                  " S/S/4SS0UD6SS9  UR                  U5        [        U5      nUR                  S5      S   S   n[        U V	s0 sH  oU	   (       d  M  XU	   _M     sn	0 5        UR                  S5      S   S   n[        X5        g s  sn	f )Nondeleteonupdater  rL   TrM   r   r  x_idzx.idxidr   test
   userrp   rP   FrS  tidztable.idmyfkr   r2   )r   r   r   r   r   rs   r   r   r   r"  r   )
r   r   r\   r  r  r  r2   r   optsr   s
             r<   test_get_foreign_key_options9ComponentReflectionTestExtra.test_get_foreign_key_options
  sl   T "*J"*JH4d3		
 	4d367JvE$BC66":&	
 	4d366":65'"##*,26= 
	
 	J'z" $$W-a0;1AaZQQZ126$$V,Q/	:D 2s   E	Er@   )"rA   rB   rC   rD   r   r   r  r  r  r  rT   r8  r  "inline_check_constraint_reflectionr   r  r  r  indexes_with_expressionsr  r  r  r  r  r  r  r  1foreign_key_constraint_option_reflection_ondelete1foreign_key_constraint_option_reflection_onupdate1fk_constraint_option_reflection_ondelete_noaction1fk_constraint_option_reflection_onupdate_restrict1fk_constraint_option_reflection_ondelete_restrictr%  rF   r@   r?   r<   r  r  	  s   K__T5M* + __ !. 11
 2
 88Z0A
 9
@ 11{D3D
 2
4 88
 9
> ..X
 /X
t 55(
 6(
TI && ' && ' &&
 '
  NN		
 NN		
 NN		
 NN		
 NN		
 NN		
 .K&N3O&N3r?   r  c                   8    \ rS rSrSrSr\S 5       rS rS r	Sr
g)	NormalizedNameTestiC  )denormalized_namesTc                     [        [        SSS9U[        S[        SS95        [        [        SSS9U[        S[        SS9[        S[	        S5      5      5        g )	Nr   Tr  rL   rM   r  t1idzt1.id)r   r"   r   r   r   r[   s     r<   r]    NormalizedNameTest.define_tablesG  sU    D)4d3	

 	D)4d36:g./		
r?   c                    [        5       n[        [        SSS9U[        R                  S9nUR
                  S   nUR                  R                  R                  UR                  R                  5      (       d   e[        5       nUR                  [        R                  S S9  UR
                  S   R                  R                  R                  UR
                  S   R                  R                  5      (       d   eg )Nr  Tr2  r   r   c                 (    U R                  5       S;   $ )Nr   r  r  )rp   rm  s     r<   r   INormalizedNameTest.test_reflect_lowercase_forced_tables.<locals>.<lambda>_  s    DJJLL,Hr?   )only)r   r   r"   r   r:   r   r   r3  r   rL   rl  )r   r   t2_reft1_refm3s        r<   $test_reflect_lowercase_forced_tables7NormalizedNameTest.test_reflect_lowercase_forced_tablesU  s    ZD)2VYY
 4xx}}''4444Z


IIH 	 	
 yy  %%0041B1B1E1EFFFFr?   c                 ^   [        [        R                  5      R                  5        Vs/ sH  nUR	                  5       S;   d  M  UPM     nn[        US   R                  5       US   R	                  5       5        [        US   R                  5       US   R	                  5       5        g s  snf )Nr7  r   r   )r   r   r:   rd  r2  r   upper)r   rh  
tablenamess      r<   rk  'NormalizedNameTest.test_get_table_namesc  s     VYY'779
9wwyL( 9 	 
 	JqM!:a=#6#6#89JqM!:a=#6#6#89
s   B*B*r@   N)rA   rB   rC   rD   r  r   rE   r]   r=  rk  rF   r@   r?   r<   r/  r/  C  s)    *LK
 
G:r?   r/  c                   d    \ rS rSrS rS rS rS r\R                  R                  S 5       rSrg)	ComputedReflectionTestin  c                     [        [        R                  5      nUR                  S5      nU Vs0 sH  o3S   U_M
     nn[	        SUS   S   ;   5        [        US   S   S 5        [        US   S   S 5        g s  snf )Ncomputed_default_tablerp   42with_defaultr  normalcomputed_col)r   r   r:   r  r'   r   )r   r   r  r   col_datas        r<   !test_computed_col_default_not_set8ComputedReflectionTest.test_computed_col_default_not_seto  s    vyy! 89*./$QfIqL$/0;;<HXy)40H^$Y/6 0s   A8c                 j   [        [        R                  5      nUR                  S5      nU Vs0 sH  o3S   U_M
     nnS H  n[	        SXE   ;  5        M     US   n[	        SU;   5        [	        SUS   ;   5        [        U R                  US   S   5      S5        [        SUS   ;   [        R                  R                  R                  5        [        R                  R                  R                  (       a5  [        US   S   [        R                  R                  R                  5        g g s  snf )	NrF  rp   )rL   rI  rH  computedrJ  r6  	normal+42	persisted)r   r   r:   r  r'   r   r  r   rT   "computed_columns_reflect_persistedr5   "computed_columns_default_persisted)r   r   r  r   rO   r   compDatas          r<    test_get_column_returns_computed7ComputedReflectionTest.test_get_column_returns_computedx  s   vyy! 89&*+d&	1d+3CJdi/0 4'
h&'	Xj112DNN8J/	:;[I8J//??GG	
 >>FF$[1  CCKK G ,s   D0c                     [        SX   ;   5        X   S   n[        U R                  US   5      U5        [        R                  R
                  R                  (       a  [        SU;   5        [        US   U5        g g )NrO  r6  rQ  )r'   r   r  r   rT   rR  r5   r   )r   rO   columnr6  rQ  rT  s         r<   check_column#ComputedReflectionTest.check_column  sl    
dl*+<
+DNN8I./9>>FFK8+,%y1 Gr?   c                    [        [        R                  5      nUR                  S5      nU Vs0 sH  o3S   U_M
     nnU R	                  USS[
        R                  R                  R                  5        [
        R                  R                  R                  (       a  U R	                  USSS5        [
        R                  R                  R                  (       a  U R	                  USS	S
5        g g s  snf )Ncomputed_column_tablerp   computed_no_flagrP  computed_virtualznormal+2Fcomputed_storedz	normal-42T)r   r   r:   r  rY  r   rT   rS  r5   computed_columns_virtualcomputed_columns_storedr   r   r  r   rO   s        r<   !test_get_column_returns_persisted8ComputedReflectionTest.test_get_column_returns_persisted  s    vyy! 78&*+d&	1d+??GG		
 44<<"	 33;;!	 < ,s   C1c                    [        [        R                  5      nUR                  S[        R                  S9nU Vs0 sH  o3S   U_M
     nnU R                  USS[        R                  R                  R                  5        [        R                  R                  R                  (       a  U R                  USSS5        [        R                  R                  R                  (       a  U R                  US	S
S5        g g s  snf )Nr\  rR   rp   r]  z	normal/42r^  znormal/2Fr_  z	normal*42T)r   r   r:   r  rV   rY  r   rT   rS  r5   r`  ra  rb  s        r<   -test_get_column_returns_persisted_with_schemaDComputedReflectionTest.test_get_column_returns_persisted_with_schema  s    vyy!#F,>,>   
 '++d&	1d+??GG		
 44<<"	 33;;!	 < ,s   C>r@   N)rA   rB   rC   rD   rL  rU  rY  rc  r   rT   rU   rf  rF   r@   r?   r<   rD  rD  n  s6    7*26  r?   rD  c                   x    \ rS rSrS=rrSrSr\S 5       r	S r
S r\R                  R                  S 5       rS	rg)
IdentityReflectionTesti  NT)identity_columnsr  c                    [        SU[        S[        5      [        S[        [        5       5      5        [        SU[        S[        [        SSSS	S
SSS95      5        [        R
                  R                  R                  (       aA  [        SU[        S[        5      [        S[        [        SSS95      [        R                  S9  g g )Nr   rI  id1r  r   Tr   r   rv     alwaysstart	incrementminvaluemaxvaluecyclecacherk  )rp  rq  rR   )
r   r   r   r   r   rT   rU   r5   r   rV   r[   s     r<   r]   $IdentityReflectionTest.define_tables  s    8W%5'8:.		
 		
" ##++x)ugxt2'FG)) ,r?   c                    [         R                  R                  R                  (       a  Sn[	        U5       H  nXT;  d  M
  UR                  U5        M     U(       am  [        [        U5      [        U5      5        U HH  nUS:X  a  [        X   X%   :*  5        M  US;   a  [        X   X%   :  5        M7  [        X   X%   U5        MJ     g [        X5        g [        US   US   5        [        US   US   5        g )Nro  rs  >   rv  rt  rq  rr  )	r   rT   identity_columns_standardr5   r  r  r   r  r'   )r   rv  r  approxcommon_keysr   s         r<   checkIdentityReflectionTest.check  s    55==K %['IIaL ! CJC)AJCF 2333CF 23EHcfa0  EgG-k"C$45r?   c                 4   [        [        R                  5      nUR                  S5      UR                  S5      -   nU H  nUS   S:X  a  [	        SU;   5        M  US   S:X  aT  SU;   a  [        US   5        [        US   S 5        [        SU;   5        U R                  US   [        S	S
S
S
SS	S
S9SS9  My  US   S:X  d  M  SU;   a  [        US   5        [        US   S 5        [        SU;   5        U R                  US   [        SSSSSSSS9S	S9  M     g )Nr   r  rp   rI  identityrl  r  r  Fr   ro  Trz  r   r   r   rm  rv  rn  )	r   r   r:   r  r&   r'   r   r|  r8   r   r   r  r   s       r<   test_reflect_identity,IdentityReflectionTest.test_reflect_identity  sA   vyy!%(8(8(>>C6{h&s*+V%"c)C01C	ND)
c)*


O$"#!"!+#     V%"c)C01C	ND)
c)*


O#"#!#!#" !  5 r?   c                 p   [        [        R                  5      nUR                  S[        R                  S9nU Hy  nUS   S:X  a  [        SU;   5        M  US   S:X  d  M'  SU;   a  [        US   5        [        US   S 5        [        SU;   5        U R                  US   [        S	S
SSSSSS9S	S9  M{     g )Nr   rR   rp   rI  r  rl  r  r  Trk  r   r  Fro  r  )
r   r   r:   r  rV   r&   r'   r   r|  r8   r  s       r<   test_reflect_identity_schema3IdentityReflectionTest.test_reflect_identity_schema@  s    vyy!V-?-?@C6{h&s*+V%"c)C01C	ND)
c)*


O# "#!"!+#     r?   r@   )rA   rB   rC   rD   r|  r}  r   r  rE   r]   r|  r  r   rT   rU   r  rF   r@   r?   r<   ri  ri    sT     $$K+K;L B6:*X  r?   ri  c                       \ rS rSrSr\S 5       r\R                  R                  S 5       r
\R                  R                  S 5       rSrg)CompositeKeyReflectionTesti\  Tc                    [        SU[        S[        5      [        S[        5      [        S[        R                  " S5      5      [
        R                  " SSSSS9S SS	9n[        S
U[        S[        SS9[        S[        5      [        S[        5      [        S[        R                  " S5      5      [
        R                  " / SQUR                  R                  UR                  R                  UR                  R                  /SS9S SS	9	  g )Ntb1rL   attrrp   rk  pk_tb1r   Tr\  tb2rM   pidpattrpnamer  r  r  fk_tb1_name_id_attr)r   r   r   r  ru   rs   r   r   r   rp   rL   r  )r;   r\   r  s      r<   r]   (CompositeKeyReflectionTest.define_tables_  s    4!67#69,,R01##FD&xH	
 	4d35'"7G$7I--b12##)SUUXXsuuzz2*
 	
r?   c                     [        U5      nUR                  U R                  R                  R                  5      n[        UR                  S5      / SQ5        g )Nr  rp   rL   r  )r   r  r   r  rp   r   r  )r   r   r   rN   s       r<   test_pk_column_order/CompositeKeyReflectionTest.test_pk_column_order{  sA     z",,T[[__-A-ABKOO124JKr?   c                     [        U5      nUR                  U R                  R                  R                  5      n[        [        U5      S5        US   n[        UR                  S5      / SQ5        [        UR                  S5      / SQ5        g )Nr   r   r  r  r  r  )r   r"  r   r  rp   r   r  r  )r   r   r   foreign_keysr  s        r<   test_fk_column_order/CompositeKeyReflectionTest.test_fk_column_order  sn     z",,T[[__-A-ABCq!QEII()+ABEII+,.GHr?   r@   N)rA   rB   rC   rD   r   rE   r]   r   rT   r  r  r  r  rF   r@   r?   r<   r  r  \  s]    K
 
6 77L 8L 77I 8Ir?   r  )rG  r  r  r   r   rH   r   r/  rD  ri  r  )Dr  r  r  r6   rs   rM  r   r   r   r   r   r	   r
   r   	provisionr   r   rS   r   r   r   r   r   r   r   r   r   r   r   r   r  rY  r   r   r   excr   r   r    r!   sql.elementsr"   
sql.schemar#   r$   r%   r&   r'   r(   r\   rO  
TablesTestr+   rH   r   TestBaser   r   rE  rG  r  r  r/  ComputedReflectionFixtureTestrD  ri  r  __all__r@   r?   r<   <module>r     s     	      $    + /            "    ! # *   ' & & %    %h11  S:* S:lI
8&& I
X81x'8'8 81vR0X00 R0j1<H\n.E H\V:2,** 2,jh?H4E4E hX(:,, (:V^XCC ^BJX00 JZ.I!4!4 .Ibr?   