
    Ki                       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S+KJ4r4  S,u  r5r6 " S- S.\Rn                  5      r8 " S/ S0\85      r9 " S1 S2\Rn                  5      r: " S3 S4\Rv                  5      r< " S5 S6\Rv                  5      r= " S7 S8\Rn                  5      r>S9 r? " S: S;\0\85      r@ " S< S=\Rv                  5      rA " S> S?\/\Rv                  5      rB " S@ SA\Rn                  5      rC " SB SC\R                  5      rE " SD SE\Rn                  5      rF " SF SG\Rn                  5      rGSHrHg)I    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_none)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
sqlalchemyr2   r   testing_enginedict
StaticPooldb)clsr2   s     j/var/www/html/dynamic-report/venv/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__classmethodrA   __static_attributes__rD   rC   r@   r/   r/   ;   s     rC   r/   c                   N   \ rS 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)HasTableTestK   TNc                    [        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schemasr9   r   test_schemaview_reflectiondefine_viewshas_temp_tabledefine_temp_tablesr?   metadatas     r@   define_tablesHasTableTest.define_tablesP   s    4d366":&		
 ##++tW$7vvbz*)) ++X&**22""8, 3rC   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   rX   rY   r9   r   rZ   )r?   r`   querys      r@   r\   HasTableTest.define_viewsf   s    CX~s5z:X}c..AB##+++ &&&&  LL>3u:>LL%););<= ,rC   c                 b    [        [        [        R                  S[        R                   35      $ N	user_tmp_r   r   r>   identr?   s    r@   temp_table_nameHasTableTest.temp_table_name|   %    "FII6<<.9
 	
rC   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 )
NrP   TrQ   namerT   rd   =create temporary view user_tmp_v as select * from user_tmp_%sre   drop view user_tmp_v)r   r   r>   rp   r   r   saINTVARCHARr   rX   r[   r9   temporary_viewsr   rg   r#   rn   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 5rC   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)NrO   rU   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)NrO   	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)NrO   rV   rU   r   )r   r>   r   r)   r   r   rZ   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)NrO   nonexistent_schemarV   )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$%rC   c                 n    [        U5      nU R                  5       n[        UR                  U5      5        g N)r   rp   r+   r   )r   r   r   rp   s       r@   test_has_table_temp_table&HasTableTest.test_has_table_temp_table   s+    z"..0/0rC   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"|,-rC   c                 l    [        U5      n[        UR                  S[        R                  5      5        g r   )r   r+   r   r   rZ   r   s      r@   test_has_table_view_schema'HasTableTest.test_has_table_view_schema   s'     z"tV%7%789rC   rD   )rE   rF   rG   rH   __sparse_driver_backend__run_deletesrI   ra   r\   rp   r^   r   r   r   rX   rY   r   r   viewsr   r]   r   r[   rz   r   r   rJ   rD   rC   r@   rL   rL   K   sd    $K- -*  * 
 

 O O0M  $   & & $$1 %1
 $$%%%%. & & %. :  :rC   rL   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 )NrO   rP   TrQ   rS   rT   data2my_idxrV   my_idx_s)r   r   r   r   r$   crS   r   rX   rY   r9   r   rZ   )r?   r`   tts      r@   ra   HasIndexTest.define_tables   s    4d366":&7F2J'
 	h		"##++tW$7vvbz*))B *bddii( ,rC   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#MrC   )r   r   )r   r   r   s     `r@   
_has_indexHasIndexTest._has_index   s!    9MM4=***rC   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)NrO   r   r   r   nonexistent_idxmy_idx_2test_table_2my_idx_3foor   T)r   r$   tablesrO   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 )NrO   r   rV   r   r   nonexistent_idx_s)r   r   rZ   )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
 	
 
 
rC   rD   N)rE   rF   rG   rH   r   __requires__rI   ra   r   combinationsr   r   r   rX   rY   r   rJ   rD   rC   r@   r   r      sv     $(L) )( 	;HD+ 
! 
!: 		
 
 	
rC   r   c                   t   \ rS rSrSrS rS r\R                  " SSS/5      \" 5       \" 5       \R                  R                  S 5       5       5       5       r\" 5       \" 5       \R                  R                  S 5       5       5       r\" 5       \" 5       \R                  R                  S	 5       5       5       rS
rg)BizarroCharacterTesti0  Tc                  2    [         R                  " SSSSSS9$ )N)	plainname)z(3))zcol%p)z[brack]
columnnamer   r   r   rD   rC   r@   column_names!BizarroCharacterTest.column_names4  s$    ##!
 	
rC   c                  2    [         R                  " SSSSSS9$ )N)plain)z(2))z
per % cent)z
[brackets]	tablenamer   r   rD   rC   r@   table_names BizarroCharacterTest.table_names=  s$    ## 
 	
rC   use_compositeFc                 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)ztests for #10275rP   T)keyrR   test_needs_fkid2rQ   otherrefref2autoload_withr      N)r   r   r   append_columnrw   ForeignKeyConstraintr   rP   r   r   
create_allr   r   r   
referencesr   )
r   r   r`   r   r   r   r   m2o2t1s
             r@   test_fk_ref BizarroCharacterTest.test_fk_refF  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 rC   c                     [        UU[        U[        [        5       SS95        UR	                  U5        [        U5      n[        UR                  U5      S   S   S   S5        g )NTrQ   r   identitystartr   r   r   r   r   r   r   r   get_columnsr   r   r   r   r`   r   s         r@   test_reflect_identity*BizarroCharacterTest.test_reflect_identityu  s`     	:w
E	

 	J'z"DY'*:6w?CrC   c                     [        UU[        S[        SS9[        U[        SS95        UR                  U5        [	        U5      n[        UR                  U5      S   S   S5        g )NrP   TrQ   some commentcommentr   r
  r   r   r   r   r   r   r  r  s         r@   test_reflect_comments*BizarroCharacterTest.test_reflect_comments  sc     	4d3:w?		
 	J'z"DY'*95~FrC   rD   N)rE   rF   rG   rH   r   r   r   r   	variationrX   !foreign_key_constraint_reflectionr   identity_columnsr  comment_reflectionr  rJ   rD   rC   r@   r   r   0  s     $

 u6^]77)1 8   7)1V ^]&&D '  D ^]((G )  GrC   r   c                       \ rS rSrSrSr\R                  S 5       r\R                  R                  S 5       r\R                  R                  S 5       rSrg)	TempTableElementsTesti  T)temp_table_reflectionc                 b    [        [        [        R                  S[        R                   35      $ )N
ident_tmp_rm   r   s    r@   r   TempTableElementsTest.tablename  s%    "FIIFLL>:
 	
rC   c                     [        UU[        S[        [        5       SS95        UR	                  U5        [        U5      n[        UR                  U5      S   S   S   S5        g )NrP   TrQ   r   r   r  r   r  r   r   r   r`   r   s        r@   r  +TempTableElementsTest.test_reflect_identity  s^    4(*$?	

 	J'z"DY'*:6w?CrC   c                     [        UU[        S[        SS9[        S[        SS95        UR                  U5        [	        U5      n[        UR                  U5      S   S   S5        g )	NrP   TrQ   foobarr  r	  r   r
  r  r  s        r@   r  +TempTableElementsTest.test_reflect_comments  sa    4d38Wn=		
 	J'z"DY'*95~FrC   rD   N)rE   rF   rG   rH   r   r   r   fixturer   rX   r  r  temp_table_comment_reflectionr  rJ   rD   rC   r@   r  r    sg     $-L__
 

 &&	D '	D 33
G 4
GrC   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)QuotedNameArgumentTesti  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 ' onerP   rt   rT   rS   
related_idzpk quote ' onert   zix quote ' onezuq quote' onez
related.idzfk quote ' onezname != 'foo'zck quote ' onezquote ' one commentT)r
  r   quote " twozpk quote " twozix quote " twozuq quote" twozfk quote " twozck quote " two zquote " two commentrelatedrQ   r   rf   view %s AS SELECT * FROM rd   re   zDROP VIEW %s)r   r   r   r   rw   PrimaryKeyConstraintr$   UniqueConstraintr   CheckConstraintr   rX   symbol_names_w_double_quoter9   view_column_reflectionr   r>   r   identifier_preparerquoter   rg   r#   )r?   r`   namesrt   rh   s        r@   ra   $QuotedNameArgumentTest.define_tables  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%,	  ;rC   c                 p    [         R                  " SS[         R                  R                  45      " U 5      $ )N)r%  r(  )r   r   rX   r/  )fns    r@   quote_fixtures%QuotedNameArgumentTest.quote_fixtures  s6    ##G,,HHI
  	rC   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   rX   reflect_table_optionsr9   get_table_optionsr+   
isinstancer<   r   NotImplementedError)r   rt   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   rt   r   s      r@   test_get_view_definition/QuotedNameArgumentTest.test_get_view_definition%  s.     vyy!''	D(89999rC   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r>   r  rC  s      r@   test_get_columns'QuotedNameArgumentTest.test_get_columns+  s'    vyy!%%%%rC   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r>   get_pk_constraintrC  s      r@   test_get_pk_constraint-QuotedNameArgumentTest.test_get_pk_constraint0  s'    vyy!%%d++++rC   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r>   get_foreign_keysrC  s      r@   test_get_foreign_keys,QuotedNameArgumentTest.test_get_foreign_keys5  s)     vyy!$$T****rC   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r>   get_indexesrC  s      r@   test_get_indexes'QuotedNameArgumentTest.test_get_indexes;  s)     vyy!%%%%rC   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r>   get_unique_constraintsrC  s      r@   test_get_unique_constraints2QuotedNameArgumentTest.test_get_unique_constraintsA  s)     vyy!**40000rC   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r>   get_table_commentrC  s      r@   test_get_table_comment-QuotedNameArgumentTest.test_get_table_commentG  s)     vyy!%%d++++rC   c                 f    [        [        R                  5      nUR                  U5      (       d   eg r   )r   r   r>   get_check_constraintsrC  s      r@   test_get_check_constraints1QuotedNameArgumentTest.test_get_check_constraintsM  s)     vyy!))$////rC   rD   N)rE   rF   rG   rH   run_create_tablesr   rI   ra   r7  r?  r   rX   r0  rD  rG  rK  r  rO  r   rS  unique_constraint_reflectionrW  r  r[  check_constraint_reflectionr_  rJ   rD   rC   r@   r"  r"    sT    $P Pd - - ,,: - : & & , , 77+ 8 + &&& ' & 221 3 1 ((, ) , 110 2 0rC   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   rZ   rD   rC   r@   r   $_multi_combination.<locals>.<lambda>X  s
    F&&rC   rW   r   r5   r   TF
use_filter)r   r   rX   rY   r    DEFAULT	TEMPORARYANYr   TABLEVIEWMATERIALIZED_VIEWANY_VIEW)r6  rW   r5   r   filter_namess        r@   _multi_combinationrp  T  s    !!&$$	
 F   	E $$:??*:777	D ''elKL%\"-./00rC   c                   F   \ 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       r9SzS, 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                  " S5S6S7S8S9S$9\"RF                  R                  \"RF                  R                  S: 5       5       5       rD\"RZ                  " S3S\"RF                  R^                  4S%S$9\"RF                  R\                  S; 5       5       rE\"RZ                  " S<S=S>S?S@S$9\"RF                  R\                  SA 5       5       rF\"RF                  R                  \"RF                  R^                  SB 5       5       rH\"RZ                  " S3S\"RF                  R^                  4S%S$9\"RF                  R                  SC 5       5       rJ\"RZ                  " SDSESFS$9\"RF                  R                  \"RF                  R                  \"RF                  R                  SG 5       5       5       5       rM\"RZ                  " SHSISJSKSLS$9\"RF                  R                  SM 5       5       rN\"RF                  Rx                  \"RF                  R                  SN 5       5       rP\"RF                  R                  SO 5       rR\"RZ                  " S\"RF                  R^                  4S3S%S$9\"RF                  R                  SP 5       5       rS\"RZ                  " SQSRSSSTSUS$9\"RF                  R                  SV 5       5       rT\"RF                  Rh                  \"RZ                  " S3S\"RF                  R^                  4S%S$9SW 5       5       rU\"RF                  Rh                  SX 5       rV\"RF                  R                  SY 5       rX\"RZ                  " S\"RF                  R^                  4S3S%S$9SZ 5       rY\"RZ                  " S\"RF                  R^                  4S5      S[ 5       rZ\"R                  S\ 5       r\\"RF                  R                  \^S] 5       5       r_\"RF                  Rn                  \^S^ 5       5       r`S_ raS{S` jrbS|Sa jrc\^Sb 5       rd\"RF                  R                  \^Sc 5       5       reSd rf\"RF                  R\                  \^Se 5       5       rg\"RF                  R                  \^Sf 5       5       rh\"RF                  R                  \^Sg 5       5       ri\"RF                  R                  \^Sh 5       5       rk\"RZ                  " Si\"RF                  R                  4SjSk\"RF                  R                  4Sl\"RF                  R\                  4Sm\"RF                  R                  4Sn\"RF                  R                  4So\"RF                  R                  4Sp\"RF                  Rn                  4SqS$9	Sr 5       rlSs rm\"RZ                  " SSS%S$9\"RZ                  " S\"RF                  R                  4SStS$9Su 5       5       ro\"RF                  Rn                  Sv 5       rp\"RF                  R                  Sw 5       rr\"RF                  R                  \"RF                  R                  Sx 5       5       ruSyrvg)}ComponentReflectionTestir  NTc                     U R                  US 5        [        R                  R                  R                  (       a+  U R                  U[        R
                  R                  5        g g r   )define_reflected_tablesr   rX   rY   r9   r   rZ   r_   s     r@   ra   %ComponentReflectionTest.define_tablesw  sF    ##Hd3##++'''..2L2LM ,rC   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'  rD   usersuser_idTrQ   test1   Fnullabletest2parent_user_id	test2 > 0zz_test2_gt_zerousers check constraintrt   r
  test2 <= 1000rW   r   
dingalingsdingaling_id
address_idz%semail_addresses.address_idzz_email_add_id_fgdi fk commentid_userrS      )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_testrP   
id comment)rR   r
  data % commentr	  d2)Comment types type speedily ' " \ '' Fun!d3*   Comment
withescapesthe test % ' " \ table comment)rW   r
  no_constraints"no
constraintshasescapedcommentlocal_table	remote_idz%s.remote_table_2.id)r   rW   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   rX   self_referential_foreign_keysr9   r   r   r   rw   rx   CHARFloatr   r.  r   r-  r   r{  r,  cross_schema_fk_reflectionr   rZ   r>   r   default_schema_namer   r$   r|  r  indexes_with_ascdescreflect_indexes_with_ascdescr  descr0  r\   r  r^   )r?   r`   rW   schema_prefixparent_id_argsrz  r  r  s           r@   rt  /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vrC   c                 b    [        [        [        R                  S[        R                   35      $ rk   rm   ro   s    r@   rp   'ComponentReflectionTest.temp_table_name+  rr   rC   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 )NrP   TrQ   rt   rT   r   user_tmp_uq_r'  user_tmp_ixrd   ru   re   rv   )r   r   r>   rp   r   r   rw   rx   ry   r-  rn   r$   r   rX   r[   r9   rz   r   rg   r#   r{   s        r@   r^   *ComponentReflectionTest.define_temp_tables1  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 5rC   c                    [         R                  R                  R                  (       a  S1nO
[	        5       nS H  nUnU(       a  U SU 3nUS-   nXC;   a  SOSnSU SU S	U 3n[
        R                  " US
[        U5      5        XC;   aU  Sn	U(       a"  [         R                  " S5      (       a  U SU	 3n	SU	 SU S3n
[
        R                  " US
[        U
5      5        [
        R                  " US[        SU SU 35      5        M     g )Nr  rz  r  r  rw  _vzMATERIALIZED rx  zCREATE zVIEW r+  rd   	mat_indexoraclezCREATE INDEX z ON z(data)re   zDROP )	r   rX   materialized_viewsr9   setr   rg   r#   against)r?   r`   rW   materializedr}   fullname	view_nameprefixrh   
index_namer   s              r@   r\   $ComponentReflectionTest.define_viewsS  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rC   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   rk  updaterl  rm  )r   r   r   r   r  r>  s         r@   _resolve_kind%ComponentReflectionTest._resolve_kindn  sX    t#JJv??d"JJu''4/JJ|$
rC   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   rX   r0  r9   clearr  r  )r   r   r  s      r@   _resolve_views&ComponentReflectionTest._resolve_viewsx  s^    66>> KKM!!44<<LL&  =rC   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)NTrD   )_s    r@   r   8ComponentReflectionTest._resolve_names.<locals>.<lambda>  s    rC   c                     SU S   ;  $ Ntmpr   rD   r   s    r@   r   r    s    U!A$%6rC   c                     SU S   ;   $ r  rD   r  s    r@   r   r    s    Uad]rC   r  r  r  r  r  r   r   )r    rh  ri  r   r   rZ   rp   rX   r  r9   addr  r   r  temp_table_namesrz   items)
r   rW   r5   ro  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   rz  r  r  r  r  r  r  r  r  r  r,   rj  r  rp   r  r  )	r   rW   r5   r   ro  r  r   r   r>  s	            r@   exp_options#ComponentReflectionTest.exp_options  s1     0$((;()488Y\"DHH

 	E0Wtxx\"DHH&'^$dhh%&]#TXX^$dhh%&+,dhh)*DHH))+,dhh
   uC!!&C
rC   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   rz  r  r  r  r  r  r  r  r  r  r  r  )r  rp   r  r  )
r   rW   r5   r   ro  emptyr  r   r   r>  s
             r@   exp_comments$ComponentReflectionTest.exp_comments  s    0%8()5Y\"E

 	E0Wu\"E&'^$=' %&@) ]#U^$e%&+,e)*E))+,e
"   uC!!&C
rC   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)rt   autoincrementtypedefaultr
  r  omitr  )r,   rj  pop)rt   autor  r
  r  r>  s         r@   r   0ComponentReflectionTest.exp_columns.<locals>.col  s;     !%""$C v~(JrC   c                 B   > S[         R                  SS.UEnT" U 40 UD6$ )NTF)r  r  r  r,   rj  )rt   r|   r   s     r@   pk/ComponentReflectionTest.exp_columns.<locals>.pk  s&    488M"MBt?r?"rC   r  r  r  )r  r  r  r  rS   r  r  r  r  r{  r|  r~  r  r  r   rP   rt   r   rz  r  r  r  r  r	  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )r   rW   r5   r   ro  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
rC   c                 
    1 Sk$ )N>   rt   r  r  r  rD   r  s    r@   _required_column_keys-ComponentReflectionTest._required_column_keysN  s    66rC   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_columnsrt   r
  )list)rt   r
  colss      r@   r  +ComponentReflectionTest.exp_pks.<locals>.pkY  s    '+Dz" rC   r'  r  r  r  r  r   rz  r{  r  r  r  r  r  r  rP   r  r  r  r  r  r  rt   )r,   rj  r   rX   materialized_views_reflect_pkr9   r  rp   reflects_pk_namesr  r  r  )r   rW   r5   r   ro  r  r  r  r   r   valr>  s               r@   exp_pksComponentReflectionTest.exp_pksR  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
rC   c                 
    SS1$ )Nrt   r
  rD   r  s    r@   _required_pk_keys)ComponentReflectionTest._required_pk_keys  s    -..rC   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>.tti  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rC   rD   NrE   rF   rG   rH   r  rJ   rD   rC   r@   r   r    s    rC   r   c                 H   > U UU[         R                  Ub  UOT" 5       UUS.$ )N)r
  referred_columnsrt   r6   referred_schemareferred_tabler
  r   )r  ref_col	ref_table
ref_schemart   r
  r   s         r@   fk+ComponentReflectionTest.exp_fks.<locals>.fk  s1     (,$+88","8Jbd"+"
 
rC   r  r  r  r   rz  r  r{  ry  r'  r  r  r  r  r  r  r  r  r  r  r  r  rP   r  )r#  r  r  r  r  rt   )r,   rj  r  r   rZ   rp   r   rX   r  r9   r  named_constraintsr  r  r  )r   rW   r5   r   ro  r$  r  r   r   valsr  r>  r   s               @r@   exp_fksComponentReflectionTest.exp_fks  s'   	 	 	(  0"5()2Y\"B

 	E0W$%	{G,O  \"I;W5!N!N%-+	% &'$%	{G<* ^$b%&]# MF$%11	& ^$J<$4H' %&+,b)*B))+,bC"
F ==EEG$%++-1199C6{$((2&*hhF   (
   uC!!&C
rC   c                 
    1 Sk$ )N>   rt   r   r  r  r
  rD   r  s    r@   _required_fk_keys)ComponentReflectionTest._required_fk_keys  s    
 	
rC   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)r  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 )NrD   )r  r   rt   dialect_optionsinclude_columnsr.  r   expressionsduplicates_constraint)	r   rX   foreign_keys_reflect_as_index#unique_constraints_reflect_as_index*reflect_indexes_with_ascdesc_as_expressionr9   r  r,   rj  )rt   r  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   rS   r  r'  rz  r  ry  T)rt   r$  r{  r  r|  r  r  )rt   r  r  )rt   r  r/  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  )r  )rt   r.  r  r  r   r  rt   r  )rt   r/  r  )r  extendr,   rj  rp   r   rn   r   rX   r  r9   r  r  r  r  )
r   rW   r5   r   ro  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
rC   c                 
    1 Sk$ )N>   rt   r  r   rD   r  s    r@   _required_index_keys,ComponentReflectionTest._required_index_keys]  s    11rC   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/$ )NrD   )r   rt   r
  rD  )r   rX   *unique_index_reflect_as_unique_constraintsr9   r  )rt   rD  rE  r
  r  reqr>  s          r@   uc+ComponentReflectionTest.exp_ucs.<locals>.uci  sJ     ""MMC $T
"C
  *:&'5LrC   r  r  r  r   rz  r|  r  r  T)rt   rD  rE  r  rS   )rt   rD  r  r  r  r  )rt   rD  r
  r  r  r  r  r  r  r  r  rt   r  r'  )r  r,   rj  rp   r   rn   r  r  )r   rW   r5   r   ro  all_rI  r  r   r   r>  s              r@   exp_ucsComponentReflectionTest.exp_ucsa  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JrC   c                 
    SS1$ )Nrt   r   rD   r  s    r@   _required_unique_cst_keys1ComponentReflectionTest._required_unique_cst_keys  s    ''rC   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(rx  )`)lowerreplace)r   r   r>  s      r@   r  2ComponentReflectionTest.exp_ccs.<locals>.tt.__eq__  s>    KKMWS"%WS"%WS"%	  {"rC   rD   Nr  rD   rC   r@   r   rS    s    #rC   r   c                    > T" U 5      XS.$ )N)sqltextrt   r
  rD   )r  rt   r
  r   s      r@   cc+ComponentReflectionTest.exp_ccs.<locals>.cc  s    !$xJJrC   r  r  r  r   rz  r  r  r  r  r	  r  z$address_id > 0 and address_id < 1000r  r'  r  r  r  r  r  r  r  r  r   )strr  r,   rj  rp   r  r  )r   rW   r5   r   ro  r]  r  r   r   r>  r   s             @r@   exp_ccsComponentReflectionTest.exp_ccs  s?   	# 	#	K
  0"5()2Y\"B

 	E0W?DHH-&4  \":-% &'^$b%&]#R^$b%&+,b)*B))+,b/
2   uC!!&C
rC   c                 
    SS1$ )Nrt   r\  rD   r  s    r@   _required_cc_keys)ComponentReflectionTest._required_cc_keys  s    	""rC   c                     [        U5      n[        [        R                  R                  UR                  5       ;   5        g r   )r   r+   r   r   rZ   get_schema_namesr   s      r@   test_get_schema_names-ComponentReflectionTest.test_get_schema_names  s,    z"**d.C.C.EEFrC   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   rZ   r)   r   s      r@   test_has_schema'ComponentReflectionTest.test_has_schema  s9    z" : :;<!567rC   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   rZ   r   r+   rf  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FrC   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   ro  rp  rj  )	rr  r&   r   r   rZ   r   r+   rk  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7rC   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)   rf  rk  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~~'<====rC   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MrC   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  r  r  r  r  r  r  r   r  r  )r  r  rz  )r   rZ   r   get_sorted_table_and_fkc_namesget_table_namesr   sorted)r   r   r  r  rW   _ignore_tablesr   recr   tr   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   rZ   get_view_namesr   rX   r  r9   r   r  get_materialized_view_names)r   r   r  r   rW   r   r  s          r@   test_get_view_names+ComponentReflectionTest.test_get_view_namesW  s     z"''FF))&1..66{#&99%EF008>:JKEF{#V,rC   c                     [        U5      nUR                  5       n[        [        U5      S[        R
                   3/5        g rk   )r   get_temp_table_namesr   r  r   rn   r   r   r   r  s       r@   test_get_temp_table_names1ComponentReflectionTest.test_get_temp_table_namesh  s9    z"446F#$6<<.'A&BCrC   c                 f    [        U5      nUR                  5       n[        [        U5      S/5        g r   )r   get_temp_view_namesr   r  r  s       r@   test_get_temp_view_names0ComponentReflectionTest.test_get_temp_view_namesn  s/     z"335F#$|n5rC   c                 &    U R                  U5        g r   )_test_get_commentsr   r   s     r@   test_get_comments)ComponentReflectionTest.test_get_commentsu  s    
+rC   c                 X    U R                  U[        R                  R                  5        g r   )r  r   r   rZ   r  s     r@   test_get_comments_with_schema5ComponentReflectionTest.test_get_comments_with_schemay  s     	
GNN,F,FGrC   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 )NrV   r  rz  )r   r  r   rZ  r   r  rt   )r   r   rW   r   expno_csts         r@   r  *ComponentReflectionTest._test_get_comments~  s    z"v."">&"A()	

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

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

 ++00""6"9 !	
rC   )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  rz  r  rV   r   rt   r  r  rU  z), rV  r  )"r   rZ   r   rz  r  r   zipr  r+   len	enumeratecolumnsr   rt   	__class__r  r<  rw   r   
TypeEnginer   r  	sql_typesDater   r  __mro__intersectionr   NumericTimer   _BinaryrR   )r   r   	use_viewsr  rW   rz  	addressesr   r   r}   tableschema_namer  ir   ctype	ctype_defs                    r@   rG  (ComponentReflectionTest.test_get_columns  s    ''FF KK--t{{/J/JyJK"$56Kz"!$[)2D!EJ K##J#CDCIM3t9- $EMM2CHHdgfo.11HH	i)<)<== ) 3 3I ??8,,NN&&? 2 !*I
 EMM*%i&7&78% ) 1 1 ) 1 1 ) 2 2 ) ) ) 0 0 ) 1 1
 " xx476?EC#* 79-555Q 3 "FrC   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)rp   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 	! 	
rC   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   rt   )
rp   r   r   r  r+   r  r  r  r   rt   )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$'&/* 2rC   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   rt   )rP   rt   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)NrV   r
  rt   r  )r   r   rZ   r   rz  r  r   r  rJ  rt   _check_listr  r   rX   r  fail_ifr  )r   r   r  rW   rz  r  r   r  
users_cons	addr_consexp_colsr  s               r@   rK  .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PK_test_tablepk_test_tablemixedCasePKzpk.with.dotspk_namec                 "   [        SU[        S[        5      [        S[        S5      5      [        R
                  " SUS95        UR                  U5        [        U5      nUR                  S5      n[        US   U5        [        US   S/5        g)	zRTest that primary key constraint names with various casing are
properly reflected.rO   rP   rS   rT   r'  rt   r
  N)
r   r   r   r   rw   r,  r   r   rJ  r   )r   r   r`   r  r   pk_conss         r@   "test_get_pk_constraint_quoted_name:ComponentReflectionTest.test_get_pk_constraint_quoted_name"  s     	4!66":&##Dw7	
 	J'z"((6GFOW%G)*TF3rC   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)NrV   r   rt   ry  r  r   r  r{  r
  r  r  )r   rZ   r   rz  r  r   r   rX   r  r9   rN  rt   r&  r  r   implicitly_named_constraintsr+   r  )r   r   r  rW   rz  r  r   expected_schemausers_fkeysfkey1
addr_fkeysr  s               r@   rO  -ComponentReflectionTest.test_get_foreign_keysA  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%FK_users_idfk_users_idmixedCaseNamezfk.with.dotsfk_namec                 B   [        SU[        S[        SS9SS9  [        SU[        S[        SS9[        S[        5      [        R                  " S/S/US	9SS9  UR                  U5        [        U5      nUR                  S5      n[        [        U5      S
5        US   n[        R                  R                  R                  5          [        US   U5        SSS5        [        US   S5        [        US   S/5        [        US   S/5        g! , (       d  f       N>= f)zRTest that foreign key constraint names with various casing are
properly reflected.	users_refr{  TrQ   r   user_ordersorder_idzusers_ref.user_idr'  r   r   rt   Nr   r  r
  )r   r   r   rw   r   r   r   rN  r   r  r   rX   r&  r  )r   r   r`   r  r   fkeysfkeys          r@   !test_get_foreign_keys_quoted_name9ComponentReflectionTest.test_get_foreign_keys_quoted_namek  s    	9g48		
 	:wD99g&##$%
 	
 	J'z"%%m4CJQx//779Vg& : 	D!"K0D#$yk2D&')5 :9s   D
D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  rP   r
  r  rV   r  )r   r   r  r   r   rZ   r   rN  rt   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'(:,7rC   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 )Nrz  rV   )
r   rZ   r   rR  r>  r  rA  r   r  rt   )r   r   r  rW   r   indexesr  r  s           r@   rS  (ComponentReflectionTest.test_get_indexes  s    
 ''FF z"""76":f-&'*+T-F-F	
 ++00V3 !%%	
rC   )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   rR  r>  r  rA  r   r   r   r  r  r   r  r  rt   )r   r   tnameixnamer   r  expected_indexesr  s           r@   test_get_noncol_index-ComponentReflectionTest.test_get_noncol_index  s     z"""5)  ++-tUm<D4M4MN%:>C		NADOA$$a(DOA##V,rC   IX_test_dataix_test_datamixedCaseIndexzix.with.dotsidx_namec                    [        SU[        S[        SS9[        S[        S5      5      5      n[	        X4R
                  R                  5        UR                  U5        [        U5      nUR                  S5      nU Vs/ s H  owS   PM	     nnX8;   d   SU S	U 35       eU Vs/ s H  owS   U:X  d  M  UPM     n	n[        [        U	5      S
5        [        U	S   S   S/5        gs  snf s  snf )zATest that index names with various casing are properly reflected.rO   rP   TrQ   rS   rT   rt   z	Expected z in r   r   r   N)r   r   r   r   r$   r   rS   r   r   rR  r   r  )
r   r   r`   r  r  r   r  r   index_namesmatching_idxs
             r@   test_get_indexes_quoted_name4ComponentReflectionTest.test_get_indexes_quoted_name  s     4d366":&	
 	h!J'z"""<0.56gs6{g6&O)H:T+(OO& (/Jwf+2IwJCq!LON+fX6 7 Ks   ?C&%C+5C+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)rK  )r   rp   rV  rL  r  rA  )r   r   r   rt   	reflectedr  s         r@   &test_get_temp_table_unique_constraints>ComponentReflectionTest.test_get_temp_table_unique_constraints  s[     z"##%//5	lll%tTl3)B)BCrC   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 )	Nr1  Fr   r  )r  r   rt   r   r2  rt   )	r   rp   rR  r  r   rX   index_reflects_included_columnsr9   r   )r   r   r   r}   r  indexpectedr   s           r@   test_get_temp_table_indexes3ComponentReflectionTest.test_get_temp_table_indexes  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   )rt   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   rt   r   testtblr  r  rV   r   rD  r
  r1  )r   rW   )r   rZ   r  operator
itemgetterr   r   rw   r   r   append_constraintr-  r   r   rV  r  r   r  r  r  r  r   r  rt   constraintsr<  
differencer  r   r  )r   r`   r   r  rW   uniquesr  rI  r   r
  names_that_duplicate_indexr;  refldupereflected_metadatar   	idx_namesuquq_namesr  s                       r@   rW  3ComponentReflectionTest.test_get_unique_constraints*  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'UQ_emailuq_emailmixedCaseUQzuq.with.dotsuq_namec                 V   [        SU[        S[        SS9[        S[        S5      5      [        R
                  " SUS95        UR                  U5        [        U5      nUR                  S5      n[        [        U5      S5        [        US	   S
   U5        [        US	   S   S/5        g)zMTest that unique constraint names with various casing are
properly reflected.rO   rP   TrQ   emailrT   r'  r   r   rt   r   N)r   r   r   r   rw   r-  r   r   rV  r   r  )r   r   r`   r-  r   uq_conss         r@   'test_get_unique_constraints_quoted_name?ComponentReflectionTest.test_get_unique_constraints_quoted_name  s     	4d37F2J'g6	
 	J'z"--l;CL!GAJv(GAJ~&	2rC   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  rV   )r   rZ   r   rB  r+   bool)r   r   r  rW   r   viewr  s          r@   rD  0ComponentReflectionTest.test_get_view_definition  sK    
 ''FFz"DD(((=ADG ErC   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_existrz  )r   r   r!   rB  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.

))rz  r{  )r  r  )r  r  rt   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)Nrz  rV   r  )r   r   r>   rZ   r   rX   r:  r9   r;  r+   r<  r<   r   r=  )r   r  r   rW   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)NrV   )r   r   r>   r   rX   r:  r9   rZ   get_multi_table_optionsr  r;  r   r   r=  )r   r  r   rW   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$ )Nr  )r5   r   )r  rz  does-not-existr  rI  r  rW   ro  )rW   r5   r   ro  r5   r   )r   r   rk  r=  rl  rm  r<  r    rh  copyr  append)rW   r5   r   rg  single_reflect_fn
exp_methodr   r|   ro  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0rC   rD   )r   r   rP  s    ` r@   get_multi_exp%ComponentReflectionTest.get_multi_exp  s    ,	1\ rC   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 NrD   )r   r;  r  r   rD  r   r   rR  rW   r5   r   rg  r   rN  r  r|   results              r@   #test_multi_get_table_options_tables;ComponentReflectionTest.test_multi_get_table_options_tables'	  sc    
 '''
3 B117B7F rC   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 rU  )r   rZ  r  r   r   get_multi_table_comment)
r   rR  rW   r5   r   rg  r   rN  r  r|   s
             r@   test_get_multi_table_comment4ComponentReflectionTest.test_get_multi_table_comment9	  s`    
 '''
3 B,,2r2C8 rC   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['\" ]rx  )resubrX  )r  s    r@   _clean:ComponentReflectionTest._check_expressions.<locals>._cleanK	  s    66)R.4466rC   )r_  r<  r<   r   r  )r   rW  r  err_msgrb  er  s          r@   _check_expressions*ComponentReflectionTest._check_expressionsJ	  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 - )r3  r.  )r   r  r  r  rf  )	r   rW  r  req_keysmsgrre  r   rd  s	            r@   r  #ComponentReflectionTest._check_listS	  s    S!FSXs+F(Q#a&A}AF%(EQCs1#"6 AA 33AD!$HadG4 ) )rC   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   rW  r  ri  
make_listsr   rk  re  s           r@   _check_table_dict)ComponentReflectionTest._check_table_dicta	  sT    CCHHJ0A9cfqsQC1Q8/	 rC   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 rU  )r   r  r  r   get_multi_columnsrp  r  rV  s              r@   test_get_multi_columns.ComponentReflectionTest.test_get_multi_columnsi	  sq     '!!
3 B++1b1F""60J0JK rC   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)ro  rD   )r   rJ  r  r   get_multi_pk_constraintrp  r  rV  s              r@   test_get_multi_pk_constraint4ComponentReflectionTest.test_get_multi_pk_constraint{	  sy    
 '''LL
3 B117B7F""T33 #  rC   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)rt   N)r<  r,   rj  ).0r  s     r@   	<genexpr>7ComponentReflectionTest._adjust_sort.<locals>.<genexpr>	  s'      ,CFaf$)993s   02r  )r   rX   r  r9   r  r  anysort)r   rW  r  r   objr  s         r@   _adjust_sort$ComponentReflectionTest._adjust_sort	  sn    <<DD)::<C3x!| ,CF, ) ) S)	 ( * ErC   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'FrC   rD   )r   rN  r(  r   get_multi_foreign_keysr  rp  r+  rV  s              r@   test_get_multi_foreign_keys3ComponentReflectionTest.test_get_multi_foreign_keys	  s    
 '&&LL
3 B00626FF ""60F0FG rC   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 rU  )r   rR  r>  r   get_multi_indexesrp  rA  rV  s              r@   test_get_multi_indexes.ComponentReflectionTest.test_get_multi_indexes	  sq    
 '!!
3 B++1b1F""60I0IJ rC   c                    U" UUUU[         R                  U R                  5      u  pgnU HT  n	UR                  5         UR                  " S0 U	D6n
U R                  XS 5        U R                  XU R                  5        MV     g )Nc                     [        U S   5      $ )Nr   r  r  s    r@   r   KComponentReflectionTest.test_get_multi_unique_constraints.<locals>.<lambda>	  s    U1^;L5MrC   rD   )r   rV  rL  r   get_multi_unique_constraintsr  rp  rO  rV  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	 rC   c                    U" UUUU[         R                  U R                  5      u  pgnU HT  n	UR                  5         UR                  " S0 U	D6n
U R                  XS 5        U R                  XU R                  5        MV     g )Nc                     [        U S   5      $ Nr\  r  r  s    r@   r   JComponentReflectionTest.test_get_multi_check_constraints.<locals>.<lambda>	  s    U1Y<5HrC   rD   )r   r^  r`  r   get_multi_check_constraintsr  rp  rc  rV  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	 rC   r;  r  rJ  rN  rR  rV  r^  rZ  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   r  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;rC   rs  r  r  )r   rs  r,   patchobjectr	   r"   r   reflect_tabler   r   )r   r   r  r  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)rW   r   resolve_fksrw  )r   r   rZ   reflectr   r  r  r  r=  r   r  r   )	r   r   r  r   mrW   r   r   r  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   é試蛇ẟΩr	  emojiu	   ☁️✨u   試蛇ẟΩ✨r  rt   r
  )r  r  r   r   r   r   r   rZ  r   r  )	r   r   r`   r   tcr  r   valuer  s	            r@   test_comments_unicode-ComponentReflectionTest.test_comments_unicode%
  s    9g?7G[9$	
 	J'z"##$67B)*+ 23267$Q6AiL($7)K@E 8s   8Bc           
          [        SU[        S[        SS9SS9  UR                  U5        [	        U5      nUR                  S5      n[        USS05        UR                  S5      S   n[        US   US	   0SS05        g )
Nr  r  u&   🐍🧙🝝🧙‍♂️🧙‍♀️r	  u&   🎩🁰🝑🤷‍♀️🤷‍♂️r  r   rt   r
  r  )r   r   r`   r   r  r   s         r@   test_comments_unicode_full2ComponentReflectionTest.test_comments_unicode_full:
  s    7G-UV<		
 	J'z"##$67BABC/03QvY)%1Y'Z[rC   c                    [         R                  R                  [        5      n[	        SU[        S[        R                  " US95      [        S[        R                  " 5       5      5        UR                  U5        [        5       n[	        SXAS9n[        UR                  R                  R                  R                  U5        [        UR                  R                   R                  R                  5        [#        U5      nUR%                  S5      u  px[        US   R                  U5        [        US   R                  5        g )Nr  collated)	collationnot_collatedr   r  )r   rX   get_order_by_collationr   r   r   rw   r   r   r   r   r   r  r  r  r*   r  r   r  )	r   r   r`   r  r   t2r   r  r  s	            r@    test_column_collation_reflection8ComponentReflectionTest.test_column_collation_reflectionK
  s     $$;;FC	:ryy9=>>299;/		
 	J'Z35BDDMM(()4!!&&001z"!%!1!1#!6HV&&	2V$../rC   rD   r   r-   )NF)wrE   rF   rG   rH   run_insertsr   r   rI   ra   rt  rp   r^   r\   r  r  r  r    rj  r   r  r  r  propertyr  r  r  r(  r+  r>  rA  rL  rO  r`  rc  r   rX   schema_reflectionrg  rl  rs  rv  schema_create_deleter{  r  r  r   r  rY   r  r  r  r  r[   rz   r  r  r  r  r  rG  r  r  r  r0  r  !primary_key_constraint_reflectionrK  r  r  rO  r  r  r  r   rS  r  r  r  r  rb  r  temp_table_reflect_indexesr  rW  r1  rD  r9  table_reflectionr?  r?  rE  r  rR  r:  rp  rX  r\  rf  r  rp  rt  rx  r  r  r  r  rc  r  r  r  r   r  r  comment_reflection_full_unicoder  column_collation_reflectionorder_by_collationr  rJ   rD   rC   r@   rr  rr  r  ss    $$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
:  77''4 ( 84, 4))112\ 77$> 8$>L  77%6 8%6N 00"8  1"8H 4))112\ &&
 '
, 3/
 &&**22- 3 + '-  &&7 '70 ++22D 3 ,D 00
 1
  	w''((\ 22VD 3VDp  223 33. %%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\  11((0 ) 20rC   rr  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)TableNoColumnsTestic
  )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_columnsg
  s    gx J'rC   c                     [        SU5        [        R                  " US[        S5      5        [        R                  " US[        S5      5        UR	                  U5        g )Nr  rd   z*CREATE VIEW empty_v AS SELECT * FROM emptyre   zDROP VIEW IF EXISTS empty_v)r   r   rg   r#   r   r  s      r@   view_no_columns"TableNoColumnsTest.view_no_columnsl
  sR    gx <=	
 	mS)F%G	
 	J'rC   c                 h    [        S[        5       US9n[        [        UR                  5      / 5        g )Nr  r   r   r   r   r  r   )r   r   r  r  s       r@   test_reflect_table_no_columns0TableNoColumnsTest.test_reflect_table_no_columns|
  s$    7HJjADJrC   c                     [        U5      n[        UR                  S5      / 5        UR                  5       n[        US/ 05        g )Nr  r  )r   r   r  rs  )r   r   r  r   multis        r@   !test_get_columns_table_no_columns4TableNoColumnsTest.test_get_columns_table_no_columns
  s>    z"DW%r*&&(EOR()rC   c                     [        5       nUR                  U5        [        UR                  5      R	                  S/5      (       d   eg r  )r   r  r  r   r  )r   r   r  r  s       r@   "test_reflect_incl_table_no_columns5TableNoColumnsTest.test_reflect_incl_table_no_columns
  s6    J			*188}))7)4444rC   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rC   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  rs  r   rl  )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*+rC   rD   N)rE   rF   rG   rH   r   r   r   r  r  r  r  r  r  rX   r   r  r  rJ   rD   rC   r@   r  r  c
  s    1L $__( ( __( (*5
   , ,rC   r  c                   D   \ 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\R                  R,                  S 5       rS r\R                  R2                  S 5       r\R                  R2                  \R                  " \R8                  \R:                  \R<                  \R>                  \R                  R@                  4\RB                  \R                  R@                  4SS9S 5       5       r"\R                  R2                  S 5       r#\R                  " SSS\R                  RH                  4SSS\R                  RJ                  40 SS\R                  RJ                  40 SS\R                  RL                  4SSS\R                  RN                  4SSS\R                  RP                  4SS9S  5       r)\R                  " \*\+RX                  " S!5      S"4\*S!S"4\-\+R\                  " 5       S#4\*\+RX                  " S$5      S%\R                  R^                  4\*\+RX                  " S&5      S'\R                  R^                  4\0\1Rd                  " 5       S(4\*\+Rf                  " S)5      \+Rf                  " S*5      -   S%\R                  R^                  4S+S9\R                  Rh                  S, 5       5       r5S-r6g).ComponentReflectionTestExtrai
  TF)paramsc                 F    UR                   (       a  [        R                  $ g r   )paramr   rZ   )r   requests     r@   use_schema_fixture/ComponentReflectionTestExtra.use_schema_fixture
  s    ==%%%rC   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"    		"	"	, 
#	,
 	rC   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`  findallrX  I)r\  s    r@   	normalize5ComponentReflectionTestExtra.ck_eq.<locals>.normalize
  s.    88

3W]]_bddK rC   rt   r\  rt   r\  c                     U S   $ r  rD   items    r@   r   4ComponentReflectionTestExtra.ck_eq.<locals>.<lambda>
      d9orC   r  c                     U S   $ r  rD   r  s    r@   r   r  
  r  rC   )r  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  rS   r  rV   )r   r   rw   r   r  r^  )r   r`   r  rW   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_ccrP   TrQ   r   a > 1 AND a < 5r'  rS   rT   rV   a > 1 and a < 5r  )
r   r   r   rw   r.  r   r^  r  r,   rj  r   r`   r  r  rW   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'  rV   za = 1 or a > 2 and a < 5r  )	r   r   r   rw   r.  r^  r  r,   rj  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  rP   TrQ   r   r  r  zb > 1 AND b < 5r  r'  r   rS   rT   some_uqzc > 1 AND c < 5cc1	some_c_uqrV   zc > 1 and c < 5r  zb > 1 and b < 5r  )r   r   r   rw   r.  r   r-  r^  r  r,   rj  )r   r`   r  rW   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                    U" S5       u  p4[        SU[        S[        SS9[        S[        5      [        S[        5      5      n[        SUR                  R
                  UR                  R                  UR                  R                  5        SSS5        WR                  S5      n[        US	   S
   / SQ5        g! , (       d  f       N4= f)ztest for #12894sa_multi_indexColumn1TrQ   Column2Column3Index_ExampleNr   r   )r2  r0  r1  )
r   r   r   r$   r   r2  r0  r1  rR  r   )r   r`   r  rW   r   rO   r  s          r@   test_index_column_order4ComponentReflectionTestExtra.test_index_column_order4  s     /04GV y't<y'*y'*J $$$$$$	 1 ''(89GAJ~&(IJ 10s   BB<<
C
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)Nr  xr  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)rt   r   r  r1  c                    > [         R                  R                  R                  (       a$  / U S'   TR                  R
                   S3/ 0U S'   g U R                  S0 5        g )Nr2  _includer1  )r   rX   r  r9   r  rt   r  )entryr   s    r@   completeIndexYComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.completeIndexd  s\    ??GG+-'(!((--.h7,'(   !2B7rC   r   c                       \ rS rSrS rSrg)[ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_strio  c                 \    UR                  5       nSU;   =(       a    SU;   =(       d    SU;   $ )NrX  r7  r8  rX  )r   r   ols      r@   r  bComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_str.__eq__p  s)    [[]"}A#)*@sbyArC   rD   Nr  rD   rC   r@   lower_index_strrC  o  s    BrC   rH  c                   "   > \ rS rSrU 4S jrSrg)^ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.coalesce_index_striu  c                 B   > SUR                  5       ;   =(       a    TU;   $ )NcoalescerE  )r   r   long_strs     r@   r  eComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.coalesce_index_str.__eq__v  s    !U[[]2Hx57HHrC   rD   Nr  )rM  s   r@   coalesce_index_strrJ  u  s    I IrC   rO  )Nr9  Nzlower(x)zlower(y))rt   r   r3  r  zcoalesce(x, 'z')r   z>Skipped unsupported reflection of expression-based index t_idx)r   r   r   r$   r   rX  r   r7  r9  r8  rL  r   r   r_  r   rX    reflect_indexes_with_expressionsr9   insertrK  r   rR  r   r
   !compare_table_index_with_expectedr  rt   )r   r`   r   r  r   r  r@  rH  rO  
expr_indexexpr_index_longr   r  rM  s     `          @r@   %test_reflect_expression_based_indexesBComponentReflectionTestExtra.test_reflect_expression_based_indexesH  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 )Nr  r7  r  r8  r:  includeF)rt   r   r2  r  r1  r   r1  z
%s_includer   )r   r   r   r$   r   r7  r1  r  rt   r   r   rR  r   r,   rj  r   r  r  )r   r`   r   r  r   r   rR  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		
rC   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 )Nr  zt%dr  )r   r  r   r   r   r  )r   r   r`   r   r  type_r  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   r}  )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
rC   r\  c                    U R                  XU" S5      5      S   n[        U[        R                  5      (       a"  [	        U[        R                  5      (       d   eOb[        U[        R
                  5      (       a"  [	        U[        R
                  5      (       d   eO![	        U[        R                  5      (       d   e[        UR                  S5        [	        UR                  [        5      (       d   eg )N4   r   )
r]  
issubclassr  ry   r<  r  r   r   lengthint)r   r   r`   r\  rc  s        r@   test_string_length_reflection:ComponentReflectionTestExtra.test_string_length_reflection  s     ##J%)DQGeY..//c9#4#45555y~~..c9>>2222c9#3#34444CJJ#**c****rC   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 )
Nr  r   Tr~  r  Frt   r  )r   r  )r   r   r   r   r   r   r  )r   r   r`   r  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onupdater7  rP   TrQ   r   r  x_idzx.idxidr'  test
   userrt   rT   Fr~  tidztable.idmyfkr   r6   )r   r   r   r   r   rw   r   r   r   rN  r   )
r   r   r`   r  rs  rt  r6   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 )Nr  rP   TrQ   thecol)server_defaultr   r  z	[\(\) \']rx  )flags)
r   r   r   r   r   r  r`  ra  r   
IGNORECASE)	r   r`   r   datatyper  expected_regr  r
  reflected_sanitizeds	            r@   test_server_defaults1ComponentReflectionTestExtra.test_server_defaultsd  sy    : 4d38X>	
 	
J'33C8;IF	 ff\2yA$"--HrC   rD   )7rE   rF   rG   rH   r   r   r  r  r  r  rX   rc  r  "inline_check_constraint_reflectionr   r!  r&  r,  indexes_check_column_orderr4  indexes_with_expressionsrU  r  rY  r]  r  rd  r  r   ry   r  NVARCHARnvarchar_typesNCHARrk  rn  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   rw   r  r   trueexpression_server_defaultsr   r   nowliteral_columnserver_defaultsr  rJ   rD   rC   r@   r  r  
  s    $__T5M* + __ !. 11
 2
 88Z0A
 9
@ 11{D3D
 2
4 88
 9
> 00K 1K& ..X
 /X
t 55(
 6(
TI && ' &&			W--<<=	'**99:
+ '
+ &&
 '
  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rC   r  c                   8    \ rS rSrSrSr\S 5       rS rS r	Sr
g)	NormalizedNameTesti  )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r2  rP   rQ   r  t1idzt1.id)r   r%   r   r   r   r_   s     r@   ra    NormalizedNameTest.define_tables  sU    D)4d3	

 	D)4d36:g./		
rC   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  Tr  r   r   c                 (    U R                  5       S;   $ )Nr   r  rE  )rt   r  s     r@   r   INormalizedNameTest.test_reflect_lowercase_forced_tables.<locals>.<lambda>  s    DJJLL,HrC   )only)r   r   r%   r   r>   r   r   r  r   rP   r  )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FrC   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 )Nr  r   r   )r   r   r>   r  rX  r   upper)r   r  
tablenamess      r@   r  '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+rD   N)rE   rF   rG   rH   r   r   rI   ra   r  r  rJ   rD   rC   r@   r  r    s*    *L $
 
G:rC   r  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_tablert   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 )	Nr  rt   )rP   r  r  computedr  r\  	normal+42	persisted)r   r   r>   r  r+   r   r  r   rX   "computed_columns_reflect_persistedr9   "computed_columns_default_persisted)r   r   r  r   rS   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 )Nr  r\  r  )r+   r   r  r   rX   r  r9   r   )r   rS   columnr\  r  r  s         r@   check_column#ComputedReflectionTest.check_column  sl    
dl*+<
+DNN8I./9>>FFK8+,%y1 GrC   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_tablert   computed_no_flagr  computed_virtualznormal+2Fcomputed_storedz	normal-42T)r   r   r>   r  r  r   rX   r  r9   computed_columns_virtualcomputed_columns_storedr   r   r  r   rS   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 )Nr  rV   rt   r  z	normal/42r  znormal/2Fr  z	normal*42T)r   r   r>   r  rZ   r  r   rX   r  r9   r  r  r  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?rD   N)rE   rF   rG   rH   r  r  r  r  r   rX   rY   r  rJ   rD   rC   r@   r  r    s6    7*26  rC   r  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)r  r  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     alwaysr  	incrementminvaluemaxvaluecyclecacher  )r  r  rV   )
r   r   r   r   r   rX   rY   r9   r   rZ   r_   s     r@   ra   $IdentityReflectionTest.define_tables   s    8W%5'8:.		
 		
" ##++x)ugxt2'FG)) ,rC   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   rX   identity_columns_standardr9   r  r  r   r  r+   )r   r  r  approxcommon_keysr   s         r@   checkIdentityReflectionTest.checkB  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5rC   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  rt   r  r   r  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@   r  ,IdentityReflectionTest.test_reflect_identity_  sA   vyy!%(8(8(>>C6{h&s*+V%"c)C01C	ND)
c)*

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


O#"#!#!#" !  5 rC   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   rV   rt   r  r   r  r  r  Tr  r   r  Fr  r  )
r   r   r>   r  rZ   r)   r+   r   r  r<   r  s       r@   test_reflect_identity_schema3IdentityReflectionTest.test_reflect_identity_schema  s    vyy!V-?-?@C6{h&s*+V%"c)C01C	ND)
c)*


O# "#!"!+#     rC   rD   )rE   rF   rG   rH   r  r   r   r   rI   ra   r  r  r   rX   rY   r  rJ   rD   rC   r@   r  r    sU     $$K+ $;L B6:*X  rC   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tb1rP   attrrt   r  pk_tb1r'  Tr  tb2rQ   pidpattrpnamer  r  r  fk_tb1_name_id_attr)r   r   r   r  ry   rw   r,  r   r   rt   rP   r  )r?   r`   r  s      r@   ra   (CompositeKeyReflectionTest.define_tables  s    4!67#69,,R01##FD&xH	
 	4d35'"7G$7I--b12##)SUUXXsuuzz2*
 	
rC   c                     [        U5      nUR                  U R                  R                  R                  5      n[        UR                  S5      / SQ5        g )Nr
  rt   rP   r  )r   rJ  r   r  rt   r   r<  )r   r   r   rR   s       r@   test_pk_column_order/CompositeKeyReflectionTest.test_pk_column_order  sA     z",,T[[__-A-ABKOO124JKrC   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   rN  r   r  rt   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HrC   rD   N)rE   rF   rG   rH   r   rI   ra   r   rX   r  r  r  r  rJ   rD   rC   r@   r  r    s^     $
 
6 77L 8L 77I 8IrC   r  )rr  r  r  r"  r   rL   r   r  r  r  r  r  )Ir  r  r`  r:   rw   rx  r   r   r   r   r   r	   r
   r   r   	provisionr   r   rW   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,   r`   rz  
TablesTestr/   rL   r   TestBaser   r  r"  rp  rr  r  r  r  ComputedReflectionFixtureTestr  r  r  __all__rD   rC   r@   <module>r     s     	       $    + /              "    ! # *   ' & & %     %h11  U:* U:pJ
8&& J
ZdG8,, dGN#GH-- #GLT0X00 T0n1<n0n.E n0b?2,** 2,jsI?H4E4E sIl(:,, (:V^XCC ^BJX00 JZ.I!4!4 .IbrC   