
    ,hɲ                       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S(KJ1r1  SS)KJ2r2  SS*KJ3r3  S+u  r4r5 " S, S-\Rl                  5      r7 " S. S/\75      r8 " S0 S1\Rl                  5      r9 " S2 S3\Rt                  5      r; " S4 S5\Rl                  5      r<S6 r= " S7 S8\0\75      r> " S9 S:\Rt                  5      r? " S; S<\/\Rt                  5      r@ " S= S>\Rl                  5      rA " S? S@\R                  5      rC " SA SB\Rl                  5      rD " SC SD\Rl                  5      rESErFg)F    N   )config)engines)eq_)eq_regex)expect_raises)expect_raises_message)expect_warnings)fixtures)is_)get_temp_table_name)temp_table_keyword_args)Column)Table   )Boolean)DateTime)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)OneConnectionTablesTest:   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
sqlalchemyr1   r   testing_enginedict
StaticPooldb)clsr1   s     `/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/testing/suite/test_reflection.py
setup_bind"OneConnectionTablesTest.setup_bind;   sI    
 66>>'))tgF  99     N)__name__
__module____qualname____firstlineno__classmethodr@   __static_attributes__rC   rB   r?   r.   r.   :   s     rB   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)HasTableTestJ   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schemasr8   r   test_schemaview_reflectiondefine_viewshas_temp_tabledefine_temp_tablesr>   metadatas     r?   define_tablesHasTableTest.define_tablesM   s    4d366":&		
 ##++tW$7vvbz*)) ++X&**22""8, 3rB   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   rW   rX   r8   r   rY   )r>   r_   querys      r?   r[   HasTableTest.define_viewsc   s    CX~s5z:X}c..AB##+++ &&&&  LL>3u:>LL%););<= ,rB   c                 b    [        [        [        R                  S[        R                   35      $ N	user_tmp_r   r   r=   identr>   s    r?   temp_table_nameHasTableTest.temp_table_namey   %    "FII6<<.9
 	
rB   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 )
NrO   TrP   namerS   rc   =create temporary view user_tmp_v as select * from user_tmp_%srd   drop view user_tmp_v)r   r   r=   ro   r   r   saINTVARCHARr   rW   rZ   r8   temporary_viewsr   rf   r#   rm   r>   r_   kw
table_nameuser_tmps        r?   r]   HasTableTest.define_temp_tables   s    $VVYY7((*
4T262::b>*	

 
 ,,44  0088LL028,,? LL=#6L2MN 9 5rB   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)NrN   rT   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)NrN   	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)NrN   rU   rT   r   )r   r=   r   r)   r   r   rY   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)NrN   nonexistent_schemarU   )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$%rB   c                 n    [        U5      nU R                  5       n[        UR                  U5      5        g N)r   ro   r*   r   )r   r   r   ro   s       r?   test_has_table_temp_table&HasTableTest.test_has_table_temp_table   s+    z"..0/0rB   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"|,-rB   c                 l    [        U5      n[        UR                  S[        R                  5      5        g r   )r   r*   r   r   rY   r   s      r?   test_has_table_view_schema'HasTableTest.test_has_table_view_schema   s'     z"tV%7%789rB   rC   N)rD   rE   rF   rG   __backend__rH   r`   r[   ro   r]   r   r   r   rW   rX   r   r   viewsr   r\   r   rZ   ry   r   r   rI   rC   rB   r?   rK   rK   J   s^   K- -*  * 
 

 O O0M  $   & & $$1 %1
 $$%%%%. & & %. :  :rB   rK   c                       \ rS 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   T)index_reflectionc                    [        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 )NrN   rO   TrP   rR   rS   data2my_idxrU   my_idx_s)r   r   r   r   r$   crR   r   rW   rX   r8   r   rY   )r>   r_   tts      r?   r`   HasIndexTest.define_tables   s    4d366":&7F2J'
 	h		"##++tW$7vvbz*))B *bddii( ,rB   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#MrB   )r   r   )r   r   r   s     `r?   
_has_indexHasIndexTest._has_index   s!    9MM4=***rB   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)NrN   r   r   r   nonexistent_idxmy_idx_2test_table_2my_idx_3foor   T)r   r$   tablesrN   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 )NrN   r   rU   r   r   nonexistent_idx_s)r   r   rY   )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
 	
 
 
rB   rC   N)rD   rE   rF   rG   r   __requires__rH   r`   r   combinationsr   r   r   rW   rX   r   rI   rC   rB   r?   r   r      su    K(L) )( 	;HD+ 
! 
!: 		
 
 	
rB   r   c            
           \ rS 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)!foreign_key_constraint_reflection)rO   )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 )NrO   T)keyrQ   test_needs_fkid2rP   otherrefref2autoload_withr      )r   r   r   append_columnrv   ForeignKeyConstraintr   rO   r   r   
create_allr   r   r   
referencesr   )
r   r   r_   r   r   r   r   m2o2t1s
             r?   test_fk_ref,BizarroCharacterFKResolutionTest.test_fk_ref3  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 rB   rC   N)rD   rE   rF   rG   __doc__r   r   r   r   	variationr   rI   rC   rB   r?   r   r   -  st    K9L:|l u6(1 7(1rB   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\\
R                  R                   S
 5       5       r\\
R                  R$                  S 5       5       r\\
R                  R(                  S 5       5       r\\
R                  R,                  S 5       5       r\\
R                  R0                  S 5       5       rSrg)QuotedNameArgumentTestii  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 ' onerO   rs   rS   rR   
related_idzpk quote ' oners   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relatedrP   r   re   view %s AS SELECT * FROM rc   rd   zDROP VIEW %s)r   r   r   r   rv   PrimaryKeyConstraintr$   UniqueConstraintr   CheckConstraintr   rW   symbol_names_w_double_quoter8   view_column_reflectionr   r=   r   identifier_preparerquoter   rf   r#   )r>   r_   namesrs   rg   s        r?   r`   $QuotedNameArgumentTest.define_tablesm  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%,	  ;rB   c                 p    [         R                  " SS[         R                  R                  45      " U 5      $ )N)r   r   )r   r   rW   r  )fns    r?   quote_fixtures%QuotedNameArgumentTest.quote_fixtures  s6    ##G,,HHI
  	rB   c                 R   [        [        R                  5      n[        R                  R
                  R                  (       a+  UR                  U5      n[        [        U[        5      5        g [        [        5         UR                  U5        S S S 5        g ! , (       d  f       g = fr   )r   r   r=   r   rW   reflect_table_optionsr8   get_table_optionsr*   
isinstancer;   r   NotImplementedError)r   rs   r   ress       r?   test_get_table_options-QuotedNameArgumentTest.test_get_table_options  sg    vyy!1199((.CJsD)*23&&t, 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   rs   r   s      r?   test_get_view_definition/QuotedNameArgumentTest.test_get_view_definition  s.     vyy!''	D(89999rB   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  s'    vyy!%%%%rB   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++++rB   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****rB   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  s)     vyy!%%%%rB   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0rB   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++++rB   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!))$////rB   rC   N)rD   rE   rF   rG   run_create_tablesr   rH   r`   r  r  r   rW   r  r  r   r$  r   r(  r   r,  unique_constraint_reflectionr0  comment_reflectionr4  check_constraint_reflectionr8  rI   rC   rB   r?   r   r   i  sS   KP Pd - - ,,: - : & & , , 77+ 8 + &&& ' & 221 3 1 ((, ) , 110 2 0rB   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   rY   rC   rB   r?   r   $_multi_combination.<locals>.<lambda>  s
    F&&rB   rV   r   r4   r   TF
use_filter)r   r   rW   rX   r    DEFAULT	TEMPORARYANYr   TABLEVIEWMATERIALIZED_VIEWANY_VIEW)r  rV   r4   r   filter_namess        r?   _multi_combinationrJ     s    !!&$$	
 F   	E $$:??*:777	D ''elKL%\"-./00rB   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   rW   rX   r8   r   rY   r^   s     r?   r`   %ComponentReflectionTest.define_tables#  sF    ##Hd3##++'''..2L2LM ,rB   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   rC   usersuser_idTrP   test1   Fnullabletest2parent_user_id	test2 > 0zz_test2_gt_zerousers check constraintrs   r   test2 <= 1000rV   r   
dingalingsdingaling_id
address_idz%semail_addresses.address_idzz_email_add_id_fgdi fk commentid_userrR      )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_testrO   
id comment)rQ   r   data % commentr   d2)Comment types type speedily ' " \ '' Fun!d3*   Comment
withescapesthe test % ' " \ table comment)rV   r   no_constraints"no
constraintshasescapedcommentlocal_table	remote_idz%s.remote_table_2.id)r   rV   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   rW   self_referential_foreign_keysr8   r   r   r   rv   rw   CHARFloatr   r  r   r  r   rU  r  cross_schema_fk_reflectionr   rY   r=   r   default_schema_namer   r$   rV  rZ  indexes_with_ascdescreflect_indexes_with_ascdescr  descr  r[   temp_table_reflectionr]   )r>   r_   rV   schema_prefixparent_id_argsrT  r  r  s           r?   rN  /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vrB   c                 b    [        [        [        R                  S[        R                   35      $ rj   rl   rn   s    r?   ro   'ComponentReflectionTest.temp_table_name  rq   rB   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 )NrO   TrP   rs   rS   r   user_tmp_uq_r   user_tmp_ixrc   rt   rd   ru   )r   r   r=   ro   r   r   rv   rw   rx   r  rm   r$   r   rW   rZ   r8   ry   r   rf   r#   rz   s        r?   r]   *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 5rB   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 )Nrb  rT  rm  rb  rQ  _vzMATERIALIZED rR  zCREATE zVIEW r  rc   	mat_indexoraclezCREATE INDEX z ON z(data)rd   zDROP )	r   rW   materialized_viewsr8   setr   rf   r#   against)r>   r_   rV   materializedr|   fullname	view_nameprefixrg   
index_namer   s              r?   r[   $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rB   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   rE  updaterF  rG  )r   r   r   r   r  r  s         r?   _resolve_kind%ComponentReflectionTest._resolve_kind  sX    t#JJv??d"JJu''4/JJ|$
rB   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   rW   r  r8   clearr  r  )r   r   r  s      r?   _resolve_views&ComponentReflectionTest._resolve_views$  s^    66>> KKM!!44<<LL&  =rB   c           	      6   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)NTrC   )_s    r?   r   8ComponentReflectionTest._resolve_names.<locals>.<lambda>-  s    rB   c                     SU S   ;  $ Ntmpr   rC   r   s    r?   r   r  /  s    U!A$%6rB   c                     SU S   ;   $ r  rC   r  s    r?   r   r  1  s    Uad]rB   r  r  r  r  r  r   r   )r    rB  rC  r   r   rY   ro   rW   r  r8   addr  r   r  temp_table_namesry   items)
r   rV   r4   rI  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8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   rT  rb  rm  rt  r~  r  r  r  r  r  r+   rD  r  ro   r  r  )	r   rV   r4   r   rI  r  r   r   r  s	            r?   exp_options#ComponentReflectionTest.exp_optionsW  s1     0$((;()488Y\"DHH

 	E0Wtxx\"DHH&'^$dhh%&]#TXX^$dhh%&+,dhh)*DHH))+,dhh
   uC!!&C
rB   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   rT  rb  rm  rt  r}  r~  r  r  r  r  r  r  )r  ro   r  r  )
r   rV   r4   r   rI  emptyr  r   r   r  s
             r?   exp_comments$ComponentReflectionTest.exp_commentsv  s    0%8()5Y\"E

 	E0Wu\"E&'^$=' %&@) ]#U^$e%&+,e)*E))+,e
"   uC!!&C
rB   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)rs   autoincrementtypedefaultr   rY  omitr  )r+   rD  pop)rs   autor  r   rY  r  s         r?   r   0ComponentReflectionTest.exp_columns.<locals>.col  s;     !%""$C v~(JrB   c                 B   > S[         R                  SS.UEnT" U 40 UD6$ )NTF)r  r  rY  r+   rD  )rs   r{   r   s     r?   pk/ComponentReflectionTest.exp_columns.<locals>.pk  s&    488M"MBt?r?"rB   r  rc  r  )r  rY  rd  rg  rR   r  rn  ro  r  rU  rV  rX  rZ  r[  r   rO   rs   r   rT  rb  rm  rt  ru  rw  rv  rx  ry  rz  r|  r~  r  r  r  r  r  r  r  r  r  )r   rV   r4   r   rI  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
rB   c                 
    1 Sk$ )N>   rs   r  r  rY  rC   r   s    r?   _required_column_keys-ComponentReflectionTest._required_column_keys  s    66rB   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$ )Nr_  c                      [        U5      U US.$ )N)constrained_columnsrs   r   )list)rs   r   colss      r?   r  +ComponentReflectionTest.exp_pks.<locals>.pk  s    '+Dz" rB   r   r  rc  r  r  r   rT  rU  rb  rm  rd  rr  rs  rt  rO   r~  r  r  r  r  r  rs   )r+   rD  r   rW   materialized_views_reflect_pkr8   r  ro   reflects_pk_namesr  r  r  )r   rV   r4   r   rI  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
rB   c                 
    SS1$ )Nrs   r  rC   r  s    r?   _required_pk_keys)ComponentReflectionTest._required_pk_keys.  s    -..rB   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>.tti9  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__:  s,    TM Fyy((<<ErB   rC   NrD   rE   rF   rG   r  rI   rC   rB   r?   r   r  9  s    rB   r   c                 H   > U UU[         R                  Ub  UOT" 5       UUS.$ )N)r  referred_columnsrs   r5   referred_schemareferred_tabler   r  )r  ref_col	ref_table
ref_schemars   r   r   s         r?   fk+ComponentReflectionTest.exp_fks.<locals>.fk@  s1     (,$+88","8Jbd"+"
 
rB   r  r  r  r   rT  r[  rU  rS  r   rb  rg  rd  rm  re  rf  r_  rn  rt  r~  r  r  rO   r  )r   r  r  r  r  rs   )r+   rD  r  r   rY   ro   r   rW   r  r8   r  named_constraintsr  r  r  )r   rV   r4   r   rI  r  r  r   r   valsr  r  r   s               @r?   exp_fksComponentReflectionTest.exp_fks2  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
rB   c                 
    1 Sk$ )N>   rs   r  r  r  r  rC   r  s    r?   _required_fk_keys)ComponentReflectionTest._required_fk_keys  s    
 	
rB   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)ri  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 )NrC   )ri  column_namesrs   dialect_optionsinclude_columnsr  r  expressionsduplicates_constraint)	r   rW   foreign_keys_reflect_as_index#unique_constraints_reflect_as_index*reflect_indexes_with_ascdesc_as_expressionr8   r  r+   rD  )rs   ri  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   	C0r  r  r  r   rR   r  r   rT  r[  rS  T)rs   r  rU  rZ  rV  r  r  )rs   ri  rb  )rs   ri  r  rg  rd  rc  rk  rm  ro  rn  rt  r~  r  r  r  r  r  r  r  r  )r  )rs   r  r  r  r   r  rs   r  )rs   r  ri  )r  extendr+   rD  ro   r   rm   r   rW   r  r8   r  r  r  r  )
r   rV   r4   r   rI  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
rB   c                 
    1 Sk$ )N>   rs   ri  r  rC   r  s    r?   _required_index_keys,ComponentReflectionTest._required_index_keys	  s    11rB   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/$ )NrC   )r  rs   r   r"  )r   rW   *unique_index_reflect_as_unique_constraintsr8   r  )rs   r"  r#  r   r  reqr  s          r?   uc+ComponentReflectionTest.exp_ucs.<locals>.uc  sJ     ""MMC $T
"C
  *:&'5LrB   r  r  r  r   rT  rV  rZ  r  T)rs   r"  r#  rb  rR   )rs   r"  rd  rc  rk  rl  )rs   r"  r   rm  rt  r~  r  r  r  r  r  rs   r  r   )r  r+   rD  ro   r   rm   r  r  )r   rV   r4   r   rI  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JrB   c                 
    SS1$ )Nrs   r  rC   r  s    r?   _required_unique_cst_keys1ComponentReflectionTest._required_unique_cst_keysR  s    ''rB   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>.tti]  c                     UR                  5       R                  SS5      R                  SS5      R                  SS5      nX;   $ )N(rR  )`)lowerreplace)r   r   r  s      r?   r  2ComponentReflectionTest.exp_ccs.<locals>.tt.__eq__^  s>    KKMWS"%WS"%WS"%	  {"rB   rC   Nr  rC   rB   r?   r   r1  ]  s    #rB   r   c                    > T" U 5      XS.$ )N)sqltextrs   r   rC   )r  rs   r   r   s      r?   cc+ComponentReflectionTest.exp_ccs.<locals>.ccg  s    !$xJJrB   r  r  r  r   rT  r`  r\  r]  r^  rw  rb  z$address_id > 0 and address_id < 1000rj  r   rm  rt  r~  r  r  r  r  r  r   )strr  r+   rD  ro   r  r  )r   rV   r4   r   rI  r;  r  r   r   r  r   s             @r?   exp_ccsComponentReflectionTest.exp_ccsV  s?   	# 	#	K
  0"5()2Y\"B

 	E0W?DHH-&4  \":-% &'^$b%&]#R^$b%&+,b)*B))+,b/
2   uC!!&C
rB   c                 
    SS1$ )Nrs   r:  rC   r  s    r?   _required_cc_keys)ComponentReflectionTest._required_cc_keys  s    	""rB   c                     [        U5      n[        [        R                  R                  UR                  5       ;   5        g r   )r   r*   r   r   rY   get_schema_namesr   s      r?   test_get_schema_names-ComponentReflectionTest.test_get_schema_names  s,    z"**d.C.C.EEFrB   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   rY   r)   r   s      r?   test_has_schema'ComponentReflectionTest.test_has_schema  s9    z" : :;<!567rB   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   rY   r   r*   rD  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FrB   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   rM  rN  rH  )	rP  r&   r   r   rY   r   r*   rI  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7rB   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)   rD  rI  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   r:   r   hasattrr   )r   engines     r?   test_dialect_initialize/ComponentReflectionTest.test_dialect_initialize  s/    '')v~~'<====rB   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MrB   foreign_keyorder_byr   
use_schemac                    U(       a  [         R                  nOS n1 Skn[        U5      nU(       a1  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  rt  r  r~  r  r  r  r   rc  r  )rb  rm  rT  )r   rY   r   get_sorted_table_and_fkc_namesget_table_namesr   sorted)r   r   rd  re  rV   _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<7	CC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   rY   get_view_namesr   rW   r  r8   r   ri  get_materialized_view_names)r   r   re  r   rV   rm  rn  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,rB   c                     [        U5      nUR                  5       n[        [        U5      S[        R
                   3/5        g rj   )r   get_temp_table_namesr   ri  r   rm   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CrB   c                 f    [        U5      nUR                  5       n[        [        U5      S/5        g r   )r   get_temp_view_namesr   ri  rx  s       r?   test_get_temp_view_names0ComponentReflectionTest.test_get_temp_view_names  s/     z"335F#$|n5rB   c                 &    U R                  U5        g r   )_test_get_commentsr   r   s     r?   test_get_comments)ComponentReflectionTest.test_get_comments!  s    
+rB   c                 X    U R                  U[        R                  R                  5        g r   )r  r   r   rY   r  s     r?   test_get_comments_with_schema5ComponentReflectionTest.test_get_comments_with_schema%  s     	
GNN,F,FGrB   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 )NrU   rt  rT  )r   r  r   r3  r   r~  rs   )r   r   rV   r   expno_csts         r?   r  *ComponentReflectionTest._test_get_comments*  s    z"v."">&"A()	

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

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

 ++00""6"9 !	
rB   )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  rT  rm  rU   r   rs   r  r  r3  z), r4  r  )"r   rY   r   rT  rm  r   zipr  r*   len	enumeratecolumnsr   rs   	__class__r  r  rv   r   
TypeEnginer   r  	sql_typesDater   r  __mro__intersectionr   NumericTimer   _BinaryrQ   )r   r   	use_viewsre  rV   rT  	addressesrm  r   r|   tableschema_namer  ir   ctype	ctype_defs                    r?   r   (ComponentReflectionTest.test_get_columnsB  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rB   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)ro   r   r   r   assert_tables_equal)r   r   r|   r}   reflected_user_tmps        r?   test_reflect_table_temp_table5ComponentReflectionTest.test_reflect_table_temp_table  sL    ))+
;;z*"
*
 	  U 	! 	
rB   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   rs   )
ro   r   r   r  r*   r  r  r  r   rs   )r   r   r|   r}   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$'&/* 2rB   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   rs   )rO   rs   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)NrU   r  rs   rr  )r   r   rY   r   rT  rm  r   r  r#  rs   _check_listr  r   rW   r  fail_ifr~  )r   r   re  rV   rT  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)NrU   r   rs   rS  r  r  r  rU  r  r[  rn  )r   rY   r   rT  rm  r   r   rW   r  r8   r'  rs   r  r  r   implicitly_named_constraintsr*   r~  )r   r   re  rV   rT  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  rO   r  r  rU   r  )r   r   r  r   r   rY   r   r'  rs   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'(:,7rB   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 )NrT  rU   )
r   rY   r   r+  r  r  r  r   r~  rs   )r   r   re  rV   r   indexesr  r  s           r?   r,  (ComponentReflectionTest.test_get_indexes  s    
 ''FF z"""76":f-&'*+T-F-F	
 ++00V3 !%%	
rB   )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  rs   )r   r   tnameixnamer   r  expected_indexesrl  s           r?   test_get_noncol_index-ComponentReflectionTest.test_get_noncol_index8  s     z"""5)  ++-tUm<D4M4MN%:>C		NADOA$$a(DOA##V,rB   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   ro   r/  r*  r  r  )r   r   r   rs   	reflectedr  s         r?   &test_get_temp_table_unique_constraints>ComponentReflectionTest.test_get_temp_table_unique_constraintsN  s[     z"##%//5	lll%tTl3)B)BCrB   c                 \   [        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  )ri  r  rs   r   r  rs   )	r   ro   r+  r  r   rW   index_reflects_included_columnsr8   r   )r   r   r   r|   r  indexpectedr   s           r?   test_get_temp_table_indexes3ComponentReflectionTest.test_get_temp_table_indexesW  s    z"))+
"":.CGG%t,  ug}M
 ;;CC-/HQK)*#DGS6{m'CSGD	
Ds   
B)B)c                 X   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       Hh  u  pUR'                  SS 5      nU(       a  U
R)                  U5        [!        UR'                  SS 5      S 5        UR'                  SS 5        [!        X5        Mj     [+        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   )rs   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   rs   r   testtblrp  rh  rU   r  r"  r   r  )r   rV   )r   rY   ri  operator
itemgetterr   r   rv   r   r   append_constraintr  r   r   r/  r  r   r  r  r  r  r   r  rs   constraintsr  
differencer  r   r~  )r   r_   r   re  rV   uniquesr  r'  r   r  names_that_duplicate_indexr  refldupereflected_metadatar   	idx_namesuquq_namesr  s                       r?   r0  3ComponentReflectionTest.test_get_unique_constraintsh  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HH&-O 2 &Z$	
	 *3):):;):#XX):	;  ++
+"b112 BGG+
 *n%
&	 	 ))(3333%*I6#% ++00D''v'>C <
s   9L"#L'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  rU   )r   rY   r   r  r*   bool)r   r   re  rV   r   viewr  s          r?   r  0ComponentReflectionTest.test_get_view_definition  sK    
 ''FFz"DD(((=ADG ErB   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_existrT  )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 HH  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  MH   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.

))rT  rU  )rm  rd  )rb  rc  rs   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  S S S 5        g ! , (       d  f       g = f)NrT  rU   r~  )r   r   r=   rY   r   rW   r  r8   r  r*   r  r;   r   r  )r   re  r   rV   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&> 433s   >C
C&c           	         [        [        R                  5      n[        R                  R
                  R                  (       ab  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         S S S 5        g s  snf ! , (       d  f       g = f)NrU   )r   r   r=   r   rW   r  r8   rY   get_multi_table_optionsrh  r  r   r   r  )r   re  r   rV   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,,. 43 43s   <C4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$ )Nrm  )r4   r   )rt  rT  does-not-existr  r  r  rV   rI  )rV   r4   r   rI  r4   r   )r   r   rE  r  rF  rG  r  r    rB  copyr  append)rV   r4   r   rA  single_reflect_fn
exp_methodr   r{   rI  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0rB   rC   )r   r   r	  s    ` r?   get_multi_exp%ComponentReflectionTest.get_multi_exp  s    ,	1\ rB   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 NrC   )r   r  r  r   r  r   r   r  rV   r4   r   rA  r   r  r  r{   results              r?   #test_multi_get_table_options_tables;ComponentReflectionTest.test_multi_get_table_options_tablesF  sc    
 '''
3 B117B7F rB   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   r3  r  r   r   get_multi_table_comment)
r   r  rV   r4   r   rA  r   r  r  r{   s
             r?   test_get_multi_table_comment4ComponentReflectionTest.test_get_multi_table_commentX  s`    
 '''
3 B,,2r2C8 rB   c           	         S[         4S jn[        U[        5      (       a7  [        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['\" ]rR  )resubr6  )r  s    r?   _clean:ComponentReflectionTest._check_expressions.<locals>._cleanj  s    66)R.4466rB   )r=  r  r;   r   r  )r   r  r  err_msgr  er  s          r?   _check_expressions*ComponentReflectionTest._check_expressionsi  sk    	7 	7 c4  &,,.9.$!A.93HF+FqF+S: :+s   A;
!B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_listr  s    S!FSXs+F(Q#a&A}AF%(EQCs1#"6 AA 33AD!$HadG4 ) )rB   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_dict  sT    CCHHJ0A9cfqsQC1Q8/	 rB   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 rB   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(  rC   )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 #  rB   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   h   #    U  H(  oR                  S 5      S[        R                  4;   v   M*     g7f)rs   N)r  r+   rD  ).0r  s     r?   	<genexpr>7ComponentReflectionTest._adjust_sort.<locals>.<genexpr>  s'      ,CFaf$)993s   02r  )r   rW   r  r8   r  r  anysort)r   r  r  r   objr  s         r?   _adjust_sort$ComponentReflectionTest._adjust_sort  sn    <<DD)::<C3x!| ,CF, ) ) S)	 ( * ErB   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'FrB   rC   )r   r'  r  r   get_multi_foreign_keysr;  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 rB   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 rB   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?  rA  s    r?   r   KComponentReflectionTest.test_get_multi_unique_constraints.<locals>.<lambda>  s    U1^;L5MrB   rC   )r   r/  r*  r   get_multi_unique_constraintsr;  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	 rB   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?  rA  s    r?   r   JComponentReflectionTest.test_get_multi_check_constraints.<locals>.<lambda>	  s    U1Y<5HrB   rC   )r   r7  r>  r   get_multi_check_constraintsr;  r)  rA  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	 rB   r  r  r#  r'  r+  r/  r7  r3  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   rX  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;rB   r,  ra  rb  )r   r,  r+   patchobjectr	   r"   r   reflect_tabler   r   )r   r   rf  re  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     NRf = fs  snf )NF)rV   r   resolve_fksrQ  )r   r   rY   reflectr   rh  rr  rs  r  r   ri  r   )	r   r   re  r   mrV   r   r   rl  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                 D   [        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   é試蛇ẟΩrw  emojiu	   ☁️✨u   試蛇ẟΩ✨r  rs   r   )ru  rv  r   r   r   r   r   r3  r   r  )	r   r   r_   r   tcr  r   valuer  s	            r?   test_comments_unicode-ComponentReflectionTest.test_comments_unicodeD	  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 )
Nrt  rv  u&   🐍🧙🝝🧙‍♂️🧙‍♀️rw  u&   🎩🁰🝑🤷‍♀️🤷‍♂️r  r   rs   r   rw  )r   r   r_   r   rx  r   s         r?   test_comments_unicode_full2ComponentReflectionTest.test_comments_unicode_fullY	  s    7G-UV<		
 	J'z"##$67BABC/03QvY)%1Y'Z[rB   rC   r   r,   )NF)orD   rE   rF   rG   run_insertsrun_deletesr   rH   r`   rN  ro   r]   r[   r  r  r  r    rD  r   r  r  r  propertyr  r  r  r  r  r  r  r*  r-  r>  rA  r   rW   schema_reflectionrE  rJ  rQ  rT  schema_create_deleterY  r^  ra  r   r   rX   ro  rt  r  ry  rZ   ry   r}  r<  r  r  r  r   r  r  r  r  r  !primary_key_constraint_reflectionr$  r(  r  r  r   r,  r  r  r  r;  r  temp_table_reflect_indexesr  r0  r  r  table_reflectionr  r  r  fixturer  r  rJ  r  r  r  r  r)  r-  r1  r;  rE  rI  rO  r=  rV  r\  rk  r   rq  rz  comment_reflection_full_unicoder}  rI   rC   rB   r?   rL  rL    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VD 3VDp %%4))112\ & %%. &. &&2 '20 	w''((\?? 4!1!1!9!9:EB/ C/ __/ /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\rB   rL  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)TableNoColumnsTestik	  )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_columnso	  s    gx J'rB   c                     [        SU5        [        R                  " US[        S5      5        [        R                  " US[        S5      5        UR	                  U5        g )Nr  rc   z*CREATE VIEW empty_v AS SELECT * FROM emptyrd   zDROP VIEW IF EXISTS empty_v)r   r   rf   r#   r   r  s      r?   view_no_columns"TableNoColumnsTest.view_no_columnst	  sR    gx <=	
 	mS)F%G	
 	J'rB   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rB   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()rB   c                     [        5       nUR                  U5        [        UR                  5      R	                  S/5      (       d   eg r  )r   ro  r  r   r  )r   r   r  rp  s       r?   "test_reflect_incl_table_no_columns5TableNoColumnsTest.test_reflect_incl_table_no_columns	  s6    J			*188}))7)4444rB   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rB   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   rF  )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*+rB   rC   N)rD   rE   rF   rG   r   r   r   r  r  r  r  r  r  rW   r   r  r  rI   rC   rB   r?   r  r  k	  s    1LK__( ( __( (*5
   , ,rB   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 \R                  " \!\"RF                  " S5      S 4\!SS 4\$\"RJ                  " 5       S!4\!\"RF                  " S"5      S#\R                  RL                  4\!\"RF                  " S$5      S%\R                  RL                  4\'\(RR                  " 5       S&4\!\"RT                  " S'5      \"RT                  " S(5      -   S#\R                  RL                  4S)S9\R                  RV                  S* 5       5       r,S+r-g),ComponentReflectionTestExtrai	  TF)paramsc                 F    UR                   (       a  [        R                  $ g r   )paramr   rY   )r   requests     r?   use_schema_fixture/ComponentReflectionTestExtra.use_schema_fixture	  s    ==%%%rB   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"    		"	"	, 
#	,
 	rB   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  findallr6  I)r:  s    r?   	normalize5ComponentReflectionTestExtra.ck_eq.<locals>.normalize	  s.    88

3W]]_bddK rB   rs   r:  rs   r:  c                     U S   $ rS  rC   items    r?   r   4ComponentReflectionTestExtra.ck_eq.<locals>.<lambda>	      d9orB   r  c                     U S   $ rS  rC   r  s    r?   r   r  	  r  rB   )ri  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)Nr~  rR   rp  rU   )r   r   rv   r   r  r7  )r   r_   r  rV   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_ccrO   TrP   r   a > 1 AND a < 5r   rR   rS   rU   a > 1 and a < 5r  )
r   r   r   rv   r  r   r7  r  r+   rD  r   r_   r  r  rV   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   rU   za = 1 or a > 2 and a < 5r  )	r   r   r   rv   r  r7  r  r+   rD  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  rO   TrP   r   r  r  zb > 1 AND b < 5r  r   r   rR   rS   some_uqzc > 1 AND c < 5cc1	some_c_uqrU   zc > 1 and c < 5r  zb > 1 and b < 5r  )r   r   r   rv   r  r   r  r7  r  r+   rD  )r   r_   r  rV   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)Nrl  xrh  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)rs   r  ri  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   rW   r  r8   r]  rs   rc  )entryr   s    r?   completeIndexYComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.completeIndexX
  s\    ??GG+-'(!((--.h7,'(   !2B7rB   r   c                       \ rS rSrS rSrg)[ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_stric
  c                 \    UR                  5       nSU;   =(       a    SU;   =(       d    SU;   $ )Nr6  r  r  r6  )r   r   ols      r?   r  bComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_str.__eq__d
  s)    [[]"}A#)*@sbyArB   rC   Nr  rC   rB   r?   lower_index_strr  c
  s    BrB   r  c                   "   > \ rS rSrU 4S jrSrg)^ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.coalesce_index_strii
  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__j
  s    !U[[]2Hx57HHrB   rC   Nr  )r  s   r?   coalesce_index_strr  i
  s    I IrB   r  )Nr  Nzlower(x)zlower(y))rs   r  r  ri  zcoalesce(x, 'z')r   z>Skipped unsupported reflection of expression-based index t_idx)r   r   r   r$   r   r6  r   r  r  r  r  r   r   r=  r   rW    reflect_indexes_with_expressionsr8   insertr  r   r+  r   r
   !compare_table_index_with_expectedr]  rs   )r   r_   r   rl  r   r  r  r  r  
expr_indexexpr_index_longr   r  r  s     `          @r?   %test_reflect_expression_based_indexesBComponentReflectionTestExtra.test_reflect_expression_based_indexes<
  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 )Nrl  r  rh  r  r  includeF)rs   r  r  ri  r  r   r  z
%s_includer   )r   r   r   r$   r   r  r  r]  rs   r   r   r+  r   r+   rD  r   r  r  )r   r_   r   rl  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		
rB   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 )Nrl  zt%dr  )r   r  r   r   r   r  )r   r   r_   r   r  type_rl  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   A7&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   rW  )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
rB   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rB   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 )
Nrl  r   TrX  r  Frs   rY  )r   r  )r   r   r   r   r   r   r  )r   r   r_   rl  r   s        r?   test_nullable_reflection5ComponentReflectionTestExtra.test_nullable_reflection
  s    3$/3%0	
 	
 #:.::3??C FS_,? U#	
s   A: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  rO   TrP   r   r  x_idzx.idxidr   test
   userrs   rS   FrX  tidztable.idmyfkr   r5   )r   r   r   r   r   rv   r   r   r   r'  r   )
r   r   r_   r  r  r  r5   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10z'?10'?z1|truez3 + 5z3\+5z(3 * 5)z3\*5zcurrent_timestamp|now|getdate35zdatatype, default, expected_regc                    [        SU[        S[        SS9[        SX4S95      nUR                  U5        [	        U5      R                  S5      S   S   n[        R                  " S	S
U5      n[        X[        R                  S9  g )Nrl  rO   TrP   thecol)server_defaultr   r  z	[\(\) \']rR  )flags)
r   r   r   r   r   r  r  r  r   
IGNORECASE)	r   r_   r   datatyper  expected_regrl  r  reflected_sanitizeds	            r?   test_server_defaults1ComponentReflectionTestExtra.test_server_defaultsK  sy    : 4d38X>	
 	
J'33C8;IF	 ff\2yA$"--HrB   rC   ).rD   rE   rF   rG   r   r   r  r  r  r  rW   r=  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&  r   rv   r  r   trueexpression_server_defaultsr   r   nowliteral_columnserver_defaultsr3  rI   rC   rB   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l 	"''$-+	$	"	"'')Y'GGG77		
 GGI77		
 
488:?@c"R%6%6s%;;77		
 3/2 %%I &34IrB   r  c                   8    \ rS rSrSrSr\S 5       rS rS r	Sr
g)	NormalizedNameTestiu  )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
  rO   rP   r  t1idzt1.id)r   r%   r   r   r   r^   s     r?   r`    NormalizedNameTest.define_tablesy  sU    D)4d3	

 	D)4d36:g./		
rB   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  TrE  r   r   c                 (    U R                  5       S;   $ )Nr   r  r  )rs   rp  s     r?   r   INormalizedNameTest.test_reflect_lowercase_forced_tables.<locals>.<lambda>  s    DJJLL,HrB   )only)r   r   r%   r   r=   r   r   rF  r   rO   ro  )r   r   t2_reft1_refm3s        r?   $test_reflect_lowercase_forced_tables7NormalizedNameTest.test_reflect_lowercase_forced_tables  s    ZD)2VYY
 4xx}}''4444Z


IIH 	 	
 yy  %%0041B1B1E1EFFFFrB   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 )NrJ  r   r   )r   r   r=   rh  r6  r   upper)r   rl  
tablenamess      r?   ro  'NormalizedNameTest.test_get_table_names  s     VYY'779
9wwyL( 9 	 
 	JqM!:a=#6#6#89JqM!:a=#6#6#89
s   B+B+rC   N)rD   rE   rF   rG   r   r   rH   r`   rP  ro  rI   rC   rB   r?   rB  rB  u  s)    *LK
 
G:rB   rB  c                   d    \ rS rSrS rS rS rS r\R                  R                  S 5       rSrg)	ComputedReflectionTesti  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_tablers   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_set  s    vyy! 89*./$QfIqL$/0;;<HXy)40H^$Y/6 0s   A9c                 l   [        [        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 )	NrY  rs   )rO   r\  r[  computedr]  r:  	normal+42	persisted)r   r   r=   r  r*   r   r  r   rW   "computed_columns_reflect_persistedr8   "computed_columns_default_persisted)r   r   r  r   rR   r   compDatas          r?    test_get_column_returns_computed7ComputedReflectionTest.test_get_column_returns_computed  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   D1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 )Nrb  r:  rd  )r*   r   r  r   rW   re  r8   r   )r   rR   columnr:  rd  rg  s         r?   check_column#ComputedReflectionTest.check_column  sl    
dl*+<
+DNN8I./9>>FFK8+,%y1 GrB   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_tablers   computed_no_flagrc  computed_virtualznormal+2Fcomputed_storedz	normal-42T)r   r   r=   r  rl  r   rW   rf  r8   computed_columns_virtualcomputed_columns_storedr   r   r  r   rR   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   C2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 )Nro  rU   rs   rp  z	normal/42rq  znormal/2Frr  z	normal*42T)r   r   r=   r  rY   rl  r   rW   rf  r8   rs  rt  ru  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?rC   N)rD   rE   rF   rG   r_  rh  rl  rv  r   rW   rX   ry  rI   rC   rB   r?   rW  rW    s6    7*26  rB   rW  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   r\  id1r  r   Tr   r   r{     alwaysstart	incrementminvaluemaxvaluecyclecacherp  )r  r  rU   )
r   r   r   r   r   rW   rX   r8   r   rY   r^   s     r?   r`   $IdentityReflectionTest.define_tables  s    8W%5'8:.		
 		
" ##++x)ugxt2'FG)) ,rB   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 )Nr  r  >   r  r  r  r  )	r   rW   identity_columns_standardr8   r  r  r   r  r*   )r   ry  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5rB   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  rs   r\  identityr  r  r  Fr   r  Tr  r   r   r   r  r{  r  )	r   r   r=   r  r)   r*   r   r  r;   r   r   r  r   s       r?   test_reflect_identity,IdentityReflectionTest.test_reflect_identityF  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 rB   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   rU   rs   r\  r  r  r  r  Trp  r   r  Fr  r  )
r   r   r=   r  rY   r)   r*   r   r  r;   r  s       r?   test_reflect_identity_schema3IdentityReflectionTest.test_reflect_identity_schemar  s    vyy!V-?-?@C6{h&s*+V%"c)C01C	ND)
c)*


O# "#!"!+#     rB   rC   )rD   rE   rF   rG   r  r  r   r   rH   r`   r  r  r   rW   rX   r  rI   rC   rB   r?   r|  r|    sT     $$K+K;L B6:*X  rB   r|  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tb1rO   attrrs   rp  pk_tb1r   Tra  tb2rP   pidpattrpnamer  r  r  fk_tb1_name_id_attr)r   r   r   r  rx   rv   r  r   r   rs   rO   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*
 	
rB   c                     [        U5      nUR                  U R                  R                  R                  5      n[        UR                  S5      / SQ5        g )Nr  rs   rO   r  )r   r#  r   r  rs   r   r  )r   r   r   rQ   s       r?   test_pk_column_order/CompositeKeyReflectionTest.test_pk_column_order  sA     z",,T[[__-A-ABKOO124JKrB   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  rs   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HrB   rC   N)rD   rE   rF   rG   r   rH   r`   r   rW   r  r  r   r  rI   rC   rB   r?   r  r    s]    K
 
6 77L 8L 77I 8IrB   r  )rL  r  r  r   r   rK   r   rB  rW  r|  r  )Gr  r  r  r9   rv   rR  r   r   r   r   r   r	   r
   r   r   	provisionr   r   rV   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r]  r   r   r    excr!   r"   r#   r$   sql.elementsr%   
sql.schemar&   r'   r(   r)   r*   r+   r_   rT  
TablesTestr.   rK   r   TestBaser   r   rJ  rL  r  r  rB  ComputedReflectionFixtureTestrW  r|  r  __all__rC   rB   r?   <module>r     s     	       $    + /              "    ! # *   ' & & %    %h11  S:* S:lJ
8&& J
Z91x'8'8 91xT0X00 T0n1<J\n.E J\Z:2,** 2,jRI?H4E4E RIj(:,, (:V^XCC ^BJX00 JZ.I!4!4 .IbrB   