id<ddlZddlZddlZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd l m Z dd lmZdd lmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dl m!Z!d dlm"Z"d dlm#Z#d\Z$Z%Gdde j&Z'Gd d!e j&Z(Gd"d#e j&Z)Gd$d%e j&Z*Gd&d'e j+Z,Gd(d)e j&Z-d*Z.dS)+N)assert_raises_message)config)engines)eq_)expect_warnings)fixtures)is_)temp_table_keyword_argsColumn)Table)event)exc) ForeignKey)inspect)Integer)MetaData)String)testing)types) Inspector)DDL)Index) quoted_name)is_false)is_true)NNcXeZdZdZedZdZejj dZ dS) HasTableTestTc Vtd|tdtdtdtdtjjjrPtd|tdtdtdtdtj dSdS) N test_tableidT primary_keydata2 test_table_sschema) rr rrrrequiresschemasenabledr test_schemaclsmetadatas ]/opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/testing/suite/test_reflection.py define_tableszHasTableTest.define_tables&s   4d 3 3 3 66":: & &      # +  tW$777vvbzz**)         ctj5}ttjj|dt tjj|dt tjj|dddddS#1swxYwYdS)Nr"r(nonexistent_table)rdbbeginrdialect has_tablerselfconns r2test_has_tablezHasTableTest.test_has_table7s Y__   M$ FI%//lCC D D D VY&00~FF G G G VY&007JKK L L L M M M M M M M M M M M M M M M M M MsBCC Cctj5}ttjj|dtjttjj|dtjttjj|dtjddddS#1swxYwYdS)Nr"r)r(r6)rr7r8rr9r:r.rr;s r2test_has_table_schemaz"HasTableTest.test_has_table_schema=s% Y__   $  !++,v/A,     !++.1C,     !++-f6H,                     sB;C''C+.C+N) __name__ __module__ __qualname__ __backend__ classmethodr3r>rr+r,r@r4r2r r #sfK[ MMM  r4r ceZdZdZdZedZdZedZee j j dZ edZ edZed Zed Zee j jd Zee j jd Zee j jd ZdS)QuotedNameArgumentTestonceTc0td|tdttdtdtdtdtdtt jddt jd dt jdd t jdgd gd t j d ddd tj j j rtd|tdttdtdtdtdtdtt jddt jddt jddt jdgd gdt j d ddd td|tdtdtdtdtj jj rtj j j rddg}ndg}|D]}dtjjjd|zdtjjj|}t'j|dt+|t'j|d t+d!tjjjd|zzdSdS)"N quote ' oner#namer'r& related_idzpk quote ' onerLzix quote ' onez uq quote' onez related.idzfk quote ' onez name != 'foo'zck quote ' onezquote ' one commentT)comment test_needs_fk quote " twozpk quote " twozix quote " twoz uq quote" twozfk quote " twozck quote " two zquote " two commentrelatedr$rP CREATE VIEW zview %s AS SELECT * FROM after_create before_drop DROP VIEW %s)rr rrsaPrimaryKeyConstraintrUniqueConstraintForeignKeyConstraintCheckConstraintrr+symbol_names_w_double_quoter-view_column_reflectionr7r9identifier_preparerquoterlistenr)r0r1namesrLquerys r2r3z$QuotedNameArgumentTest.define_tablesUs7   4 ! ! 66":: & & 66":: & & < ) )  #D/? @ @ @ H%v . .  $     #-=     5E F F F.%    *   7 ?  tW%%vvbzz**vvbzz**|W--'3CDDD)622#('F\N1A"?9JKKK2"%    *    4d 3 3 3 9g & &        2 : ;C !! "  J&:@@!D(J&:@@FFF  X~s5zzBBB !&!*,@FF%,    )    r4c`tjddtjjf|S)N)rKrQ)r combinationsr+r^)fns r2quote_fixturesz%QuotedNameArgumentTest.quote_fixturess; w#  G,H I    r4cbttj}||dSN)rrr7get_table_optionsr<rLinsps r2test_get_table_optionsz-QuotedNameArgumentTest.test_get_table_optionss+wz"" t$$$$$r4c8ttj}dSrjrrr7rls r2test_get_view_definitionz/QuotedNameArgumentTest.test_get_view_definitionwz""r4c8ttj}dSrjrprls r2test_get_columnsz'QuotedNameArgumentTest.test_get_columnswz""r4c8ttj}dSrjrprls r2test_get_pk_constraintz-QuotedNameArgumentTest.test_get_pk_constraintrur4c8ttj}dSrjrprls r2test_get_foreign_keysz,QuotedNameArgumentTest.test_get_foreign_keysrur4c8ttj}dSrjrprls r2test_get_indexesz'QuotedNameArgumentTest.test_get_indexesrur4c8ttj}dSrjrprls r2test_get_unique_constraintsz2QuotedNameArgumentTest.test_get_unique_constraintsrrr4c8ttj}dSrjrprls r2test_get_table_commentz-QuotedNameArgumentTest.test_get_table_commentrrr4c8ttj}dSrjrprls r2test_get_check_constraintsz1QuotedNameArgumentTest.test_get_check_constraintsrrr4N)rArBrCrun_create_tablesrDrEr3rhrnrr+r_rqrtrwryr{unique_constraint_reflectionr}comment_reflectionrcheck_constraint_reflectionrrFr4r2rHrHQsKQQ[Qf %%^%  ,::-,^:&&^&,,^,++^+&&^& 21132^1 (,,)(^, 10021^000r4rHc< eZdZdxZZdZedZedZedZ edZ edZ edZ e jjd Ze jjd Ze jjd Ze j dHd Ze jjdZe jje jje jjdZe jjdZe jje jjdZe jjdZe jje jj dZ!dIdZ"e jje jj dZ#e jj$dZ%e jj$e jj dZ&e jje jj$dZ'dJdZ(e jjdZ)e jdZ*e jjdZ+e jjdZ,e jje jdZ-e jje jj dZ.e jj/d Z0e jj/e jj$e jjd!Z1e jj$d"Z2e jj$e jj d#Z3e jdId$Z4e jj5d%Z6e jje jj5e jj d&Z7e jje jd'Z8e jdId(Z9e jjd)Z:e jje jj d*Z;e jj<e jj d+Z=e jj>d,Z?e jj@d-ZAe jd.ZBd/ZCe jdId0ZDe jjEd1ZFe jjEe jj d2ZGe jd3ZHe jjEe jjId4ZJe jjEe jjId5ZKe jjLe jd6ZMe jjNd7ZOe jj/e jjNd8ZPe jj/d9ZQe jjNe jj d:ZRe jdId;ZSe jjTd<ZUe jjTe jj d=ZVe jdId>ZWe jdId?ZXe jjd@ZYe jje jj dAZZe j[dBdCe jdIdDZ\dEZ]e jj dFZ^e jje jdGZ_dS)KComponentReflectionTestNTctjjjr.ddlm}t jt|j Stj S)Nr)pool) poolclass)options) r requirementsindependent_connectionsr- sqlalchemyrrtesting_enginedict StaticPoolr7)r0rs r2 setup_bindz"ComponentReflectionTest.setup_bindsY   6 >  ' ' ' ' ' ')t777 9 r4c||dtjjjr'||tjjdSdSrj)define_reflected_tablesrr+r,r-rr.r/s r2r3z%ComponentReflectionTest.define_tablessW ##Hd333   # + N  ' ''.2L M M M M M N Nr4c~ |r|dz}nd}tjjjrt d|t dt jdt dt jdd t d t j dd t d t j t j d |zd|d}ntt d|t dt jdt dt jdd t d t j dd |d}t d|t dt j dt dt j t j d|zt dt j d|dt d|t dt j t dt j t j |j jt dt j dt jdd|dt d|t dt j ddt dt j dd !t d"t j dd#!|d$%tjjjre|t d&|t dt j dt dt j dt d'td(tjjzdt"jjj)nt d*|t dt j dt d+td,t"jjjzt dt j d|dt d-|t dt j dt dt j d|dtjjjr||||st d.|t d/t j dd0}t d1|t dt j dt d/t j dd0}tjjjrXt3d2|j jt3d3|j jtjjjr||||s-tjjjr||dSdSdS)4N.usersuser_idTr$test1Fnullabletest2parent_user_idz%susers.user_id user_id_fkrNr*rP dingalings dingaling_id address_idz%semail_addresses.address_idr&email_addressesremote_user_id email_address email_ad_pk comment_testr# id comment)r%rOdata % comment)rOd2)Comment types type speedily ' " \ '' Fun!the test % ' " \ table comment)r*rO local_table remote_idz%s.remote_table_2.id)rPr* remote_tablelocal_idz%s.local_table.idremote_table_2noncol_idx_test_nopkqrSnoncol_idx_test_pknoncol_idx_nopk noncol_idx_pk) rr+self_referential_foreign_keysr-rr rYINTCHARFloatrrrcrrZcross_schema_fk_reflectionrr.r7r9default_schema_nameindex_reflection define_indexindexes_with_ascdescrrdescr_ define_viewstemp_table_reflectiondefine_temp_tables)r0r1r* schema_prefixrrrs r2rz/ComponentReflectionTest.define_reflected_tabless  "SLMMM   9 A y"&d;;;w U;;;w e<<<$JM)M9 "EE"y"&d;;;w U;;;w e<<<"E    >2:4 @ @ @   <}LMM   629R== ) )     < , ,  "*bmEGO.L.L   ?BIbMM 2 2  #L} E E E     4| L L L 629R==2B C C C  " H    9    6 >' ~!4>>>629R==11#"2W^5OO #'!9,@     "4>>>""/$i/CD629R==11!"&$4>>>629R==11!"&    , 4 J   Xu - - - J',*3 ! --"& ((($&+(4>>>3 ! --"& &&&"#8@J+-A-C-E-J-J-L-LMMM/+=+?+A+F+F+H+HIII   2 : /   Xv . . . -'*@H -  " "8 , , , , , - - - -r4c Htttj}td|t dt jdt dt jdt dt jt jdd t j d dfi|}tj j j r^tj jj rJtj|d t#d tj|d t#ddSdSdS)Nuser_tmpr#Tr$rLr'foo user_tmp_uqrN user_tmp_ixrVz:create temporary view user_tmp_v as select * from user_tmprWzdrop view user_tmp_v)r rr7rr rYrVARCHARr[rrr+view_reflectionr-temporary_viewsrrbr)r0r1kwrs r2rz*ComponentReflectionTest.define_temp_tabless" $VVY 7 7   4T 2 2 2 62:b>> * * 5"& ! !  ] ; ; ; H]E * *         , 4 O 08 O L-    L=#6L2M2M N N N N N O O O Or4ctd|jj|jjtd|jj|jj|jjdS)N users_t_idx users_all_idx)rrrrr)r0r1rs r2rz$ComponentReflectionTest.define_indexsB mUW]EGM::: ouw uw}MMMMMr4c dD]c}|}|r|d|}|dz}d|d|}tj|dt|tj|dtd|zddS) N)rrr_vrTrUrVrWrX)rrbr)r0r1r* table_namefullname view_namerds r2rz$ComponentReflectionTest.define_viewss6  J!H :&,ffjj9 4II E L>3u:: > > > L-^i-G)H)H      r4cttj}|tjj|vdSrj)rrr7assert_rr.get_schema_namesr<rms r2test_get_schema_namesz-ComponentReflectionTest.test_get_schema_namess?wz"" W^/43H3H3J3JJKKKKKr4cJtj}t|dSrj)rrr)r<engines r2test_dialect_initializez/ComponentReflectionTest.test_dialect_initializes'))r4cttj}t|jtjjjdSrj)rrr7rrr9rs r2test_get_default_schema_namez4ComponentReflectionTest.test_get_default_schema_names2wz"" D $gj&8&LMMMMMr4tablec gd |j}t|j}|dkrL||}|ddg}t t ||dS|r d||D}n||} fd|D}|dkrgd}t ||dSgd }t t ||dS) N)rrrrrrviewemail_addresses_vusers_vc.g|]}|d |dS)rrF.0recs r2 zAComponentReflectionTest._test_get_table_names..s61vFr4cg|]}|v| SrFrF)rt_ignore_tabless r2rzAComponentReflectionTest._test_get_table_names..s#HHH0G0G10G0G0Gr4 foreign_key)rrr)rrr) r1rbindget_view_namessortrsortedget_sorted_table_and_fkc_namesget_table_names) r<r* table_typeorder_bymetarm table_namesanswertablesrs @r2_test_get_table_namesz-ComponentReflectionTest._test_get_table_namess=   }ty!!   --f55K      )95F {##V , , , , , 6#BB6JJ --f55HHHHfHHHK=((CCCK(((((CCCF;''00000r4ct|j}|}tt |dgdS)Nr)rrget_temp_table_namesrrr<rmtemp_table_namess r2test_get_temp_table_namesz1ComponentReflectionTest.test_get_temp_table_namessDty!!4466 F# $ $zl33333r4ct|j}|}tt |dgdS)N user_tmp_v)rrget_temp_view_namesrrrs r2test_get_temp_view_namesz0ComponentReflectionTest.test_get_temp_view_namessFty!!3355 F# $ $|n55555r4c.|dSrjrr<s r2test_get_table_namesz,ComponentReflectionTest.test_get_table_namess ""$$$$$r4c2|ddS)Nr)rr r s r2test_get_table_names_fksz0ComponentReflectionTest.test_get_table_names_fkss! ""M":::::r4c.|dSrj)_test_get_commentsr s r2test_get_commentsz)ComponentReflectionTest.test_get_comments s !!!!!r4cN|tjjdSrj)rrrr.r s r2test_get_comments_with_schemaz5ComponentReflectionTest.test_get_comments_with_schema s#  :;;;;;r4cJttj}t|d|ddit|d|dditd|d|Dddd d d d d d d gdS)Nrr)textrrc0g|]}|d|ddS)rLrO)rLrOrFrs r2rz>ComponentReflectionTest._test_get_comments..s8   VY@@   r4rr#)rOrLrr&rr)rrr7rget_table_comment get_columns)r<r*rms r2rz*ComponentReflectionTest._test_get_commentsswz""  " ">& " A A : ;   D " "76 " : :VTNKKK   ++N6+JJ    )$77,f==I        r4cN|tjjdSrjrrrr.r s r2 test_get_table_names_with_schemaz8ComponentReflectionTest.test_get_table_names_with_schema-s# ""7>#=>>>>>r4c2|ddSNr)rr r s r2test_get_view_namesz+ComponentReflectionTest.test_get_view_names2s ""f"55555r4cR|tjjddSrrr s r2test_get_view_names_with_schemaz7ComponentReflectionTest.test_get_view_names_with_schema6s5 "" N &6 #     r4cZ||ddSrr r s r2test_get_tables_and_viewsz1ComponentReflectionTest.test_get_tables_and_views=s3 ""$$$ ""f"55555r4cttj}|jj|jj}}ddg}|dkrddg}t |j}t|||fD]\}} |} | || } | t| dkt| t| j D]{\} } t| j| | d| | d j}| j}t%|t&jjr|j}tjd r&|t.jt.jfvr t.j}| tt5|j|jt.jt.jt.jt.jt.jt.j t.j!gdk| jd | jd | | dd |d | j"s}dS)Nrrrrrr)rrLtypeoracle(z), ))#rrr7rrrrrziprrlen enumeratecolumnsrrL __class__r$ isinstancerYr TypeEngineagainst sql_typesDateDateTimeset__mro__ intersectionrNumericTimer_Binaryr%)r<r*rrr addressesrrmrr schema_namecolsicolctype ctype_defs r2_test_get_columnsz)ComponentReflectionTest._test_get_columnsCs2 ## K-t{/Jy 12   $&9:Kty!!!$[5)2D!E!E/ 6/ 6 J K##J{#CCD LLTQD 2 2 2$EM22( 6( 63CHd1gfo...Q1H i)<==4 ) 3I?8,,/N&?22!*I  EM**%i&788% ) 1 ) 1 ) 2 ) ) ) 0 ) 1  "xxx476???EEEC#*6O( 6/ 6/ 6r4c.|dSrjr@r s r2rtz(ComponentReflectionTest.test_get_columns{      r4ctd|jgdt|DR}|dt |jjdDS)Nrc:g|]\}}td|z|S)zt%dr )rr<type_s r2rz.s* H H H81efUQY&& H H Hr4cg|] }|d S)r$rFrrs r2rz.s)   AfI   r4)rr1r*createrrr)r<rrs r2_type_round_tripz(ComponentReflectionTest._type_round_trips   M I Hy7G7G H H H       &t}'9::FFsKK    r4c|tjddD],}t|jdt|jd-dS)Nr)rJr0r6r precisionscaler<typs r2test_numeric_reflectionz/ComponentReflectionTest.test_numeric_reflections](():2q)A)ABB  C  r " " "  1      r4c|tjdd}t|jddS)N4r)rJr0rrlengthrOs r2test_varchar_reflectionz/ComponentReflectionTest.test_varchar_reflections=##I$4R$8$899!< CJr4c Xtd|jtdtdtdtd}|t t dt|jj dDddddS) NraTrbFc36K|]}|d|dfVdS)rLrNrFrr=s r2 zCComponentReflectionTest.test_nullable_reflection..sCVc*o.r4)rWrX) rr1r rrIrrrrr)r<rs r2test_nullable_reflectionz0ComponentReflectionTest.test_nullable_reflections   M 3$ / / / 3% 0 0 0      "4=#566BB3GG  U # #      r4cP|tjjdSNr)r@rrr.r s r2test_get_columns_with_schemaz4ComponentReflectionTest.test_get_columns_with_schema& gn&@AAAAAr4cvt|j}|jj}t |j}|d}|t|dkt|t|j D]&\}}t|j ||d'dS)NrrrL) rrrrrrrr)r*r+rrL)r<rrrmr;r<r=s r2test_get_temp_table_columnsz3ComponentReflectionTest.test_get_temp_table_columnss "";'ty!! ++ SYY]CII... 011 + +FAs $q'&/ * * * * + +r4ct|j}|d}td|DgddS)Nrcg|] }|d SrNrFrZs r2rzFComponentReflectionTest.test_get_temp_view_columns..s ) ) )SS[ ) ) )r4)r#rLr)rrrr)r<rmr;s r2test_get_temp_view_columnsz2ComponentReflectionTest.test_get_temp_view_columnssRty!! -- ) )D ) ) )+@+@+@AAAAAr4c2|ddSrrBr s r2test_get_view_columnsz-ComponentReflectionTest.test_get_view_columnss &11111r4cR|tjjddS)Nr)r*rr_r s r2!test_get_view_columns_with_schemaz9ComponentReflectionTest.test_get_view_columns_with_schemas5 >-&      r4c|j}|jj|jj}}t |j}||j|}|d}t|dg||j|}|d} t| dgtj j 5t|ddddddS#1swxYwYdS)Nr)constrained_columnsrrrLr) r1rrrrrget_pk_constraintrLrrr+reflects_pk_namesfail_if) r<r*rrr9rm users_cons users_pkeys addr_cons addr_pkeyss r2_test_get_pk_constraintz/ComponentReflectionTest._test_get_pk_constraints*};,dk.Iyty!!++EJv+FF  !67  K)%%%**9>&*II 45  J'''   / 7 7 9 9 2 2  &!= 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2sC%%C),C)c.|dSrj)rtr s r2rwz.ComponentReflectionTest.test_get_pk_constraints $$&&&&&r4cP|tjjdSr^)rtrrr.r s r2"test_get_pk_constraint_with_schemaz:ComponentReflectionTest.test_get_pk_constraint_with_schemas& $$GN,F$GGGGGr4c|j}|jj}t|j}t t jd|j|j dS)Nz+.*get_primary_keys\(\) method is deprecated) r1rrrrrsa_excSADeprecationWarningget_primary_keysrL)r<rrrms r2 test_deprecated_get_primary_keysz8ComponentReflectionTest.test_deprecated_get_primary_keyssT} !##  ' :  ! J      r4c&|j}|jj|jj}}t |j}|}t jjj r| |j |}|d}t jj 5t|dddddn #1swxYwYt|d|t|d|j t|ddgt jjj rt|d d g| |j |} | d}t jj 5||ddudddn #1swxYwYt|d|t|d|j t|ddgt|d d gdS) Nr)rrLrreferred_schemareferred_tablereferred_columnsrrlrr)r1rrrrrrr+rr-get_foreign_keysrLnamed_constraintsrorimplicitly_named_constraintsr) r<r*rrr9rmexpected_schema users_fkeysfkey1 addr_fkeyss r2_test_get_foreign_keysz.ComponentReflectionTest._test_get_foreign_keyssq} K-t{/Jyty!!    9 A F// 6/JJKNE!3;;== 1 1E&M<000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 '(/ : : : &' 4 4 4 ()I; 7 7 7=E FE/03C2DEEE**9>&*II 1    : B B D D 4 4 LLvd2 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 E# $o666 E" #UZ000 E$ % {333 E' (+;*<=====s$B66B:=B:=F''F+.F+c.|dSrj)rr s r2ryz-ComponentReflectionTest.test_get_foreign_keyss ##%%%%%r4cP|tjjdSr^)rrrr.r s r2!test_get_foreign_keys_with_schemaz9ComponentReflectionTest.test_get_foreign_keys_with_schemas& ##7>+E#FFFFFr4cp|dtjjjzdtjjzdtjjz\}}}tt j}||j }tt|d|d}t|dtjjt|d|j t|dd gt|d d g||j tjj }tt|d|d}t|d|j t|dd gt|d d gdS)Nz%s.local_tablez%s.remote_tablez%s.remote_table_2rr~rrr#rlrr)r) rrr7r9rrr.rrrLrr)) r<rrrrm local_fkeysr remote_fkeysfkey2s r2"test_get_inter_schema_foreign_keysz:ComponentReflectionTest.test_get_inter_schema_foreign_keys s59KK wz1E E  : : '."< <5 5 1 \> vy!!++K,<==  C  a   A E# $gn&@AAA E" #^%8999 E$ %v... E' (;-888,,  gn&@-   C  q!!!Q E" #[%5666 E$ %v... E' (:,77777r4c2|ddS)NCASCADE)ondelete_test_get_foreign_key_optionsr s r2%test_get_foreign_key_options_ondeletez=ComponentReflectionTest.test_get_foreign_key_options_ondeleteCs **I*>>>>>r4c2|ddS)NzSET NULL)onupdaterr s r2%test_get_foreign_key_options_onupdatez=ComponentReflectionTest.test_get_foreign_key_options_onupdateGs **J*?????r4c |j}td|tdtddtd|tdtdtdtt jdd td t d dtd |tdtdtdt ddtdtt jdgdgfddi|d|t|j }| dddttfdDi| d ddttfdD|dS)Nxr#Tr$rSrx_idzx.idxidrNtest userrLr'Frtidztable.idmyfkrrc3<K|]}| ||fVdSrjrFrkoptss r2r[zHComponentReflectionTest._test_get_foreign_key_options..s477!tAw7!T!W777777r4c3<K|]}| ||fVdSrjrFrs r2r[zHComponentReflectionTest._test_get_foreign_key_options..vrr4)r1rr rrYrrr\ create_allrrrrr)r<rrrmrs @r2rz5ComponentReflectionTest._test_get_foreign_key_optionsKs}   4d 3 3 3         4d 3 3 3 67BM&u$E$E$E F F 66":: & &         4d 3 3 3 66":: 6 6 6 5' " "  #*  ,2 6=    ty!!$$W--a0; D7777t777 7 7<<<$$V,,Q/ : D7777t777 7 7AAAAAr4cd|D}|D]D}|||d}|D]}t||||EdS)Ncg|] }|d SrNrF)rds r2rz@ComponentReflectionTest._assert_insp_indexes..ys222Qqy222r4rL)indexr)r<indexesexpected_indexes index_namese_indexrkeys r2_assert_insp_indexesz,ComponentReflectionTest._assert_insp_indexesxsy22'222 ' . .GK--gfo>>?E . .GCL%*---- . . .r4c|j}t|j}|d|}dddgdddgdd dg}|||dS) Nrr)Frrrunique column_namesrL)rrrr)r1rr get_indexesr)r<r*rrmrrs r2_test_get_indexesz)ComponentReflectionTest._test_get_indexess}ty!!""76":: !(' 2%    = = ='     !!'+;<<<< !!'+;<<< %TY 7 7 7 C NNA DOOA  $a((( DOOA  #V,,,,,r4c2|dddS)Nrrrr s r2test_get_noncol_index_no_pkz3ComponentReflectionTest.test_get_noncol_index_no_pks" ##$:Skipped unsupported reflection of expression-based index t_idxt_idx_2r)rLrr) rr1r rrrbrrrrrrrrs r2%test_reflect_expression_based_indexesz=ComponentReflectionTest.test_reflect_expression_based_indexessl   M 3r # # 3r # #     M  = > >    M>3/M+N+N      """t})**  L       %%#cUaHHI                     s*DDDc.|dSrj)_test_get_unique_constraintsr s r2r}z3ComponentReflectionTest.test_get_unique_constraintss ))+++++r4ct|j}|d}|D]}|ddt |dgddgdS)Nrduplicates_indexrLr)rrL)rrget_unique_constraintspopr)r<rm reflectedrefls r2&test_get_temp_table_unique_constraintsz>ComponentReflectionTest.test_get_temp_table_unique_constraintssrty!!// ;;  / /D HH' . . . . I&=IIJKKKKKr4ct|j}|d}|D]}|ddt d|DddgddgdS)Nrdialect_optionsc*g|]}|ddk|S)rLrrFridxs r2rzGComponentReflectionTest.test_get_temp_table_indexes..s& D D DSs6{m'C'CS'C'C'Cr4Frrr)rrrrr)r<rmrinds r2test_get_temp_table_indexesz3ComponentReflectionTest.test_get_temp_table_indexessty!!"":.. - -C GG%t , , , ,  E DG D D D$%*G)  r4cP|tjjdSr^)rrrr.r s r2'test_get_unique_constraints_with_schemaz?ComponentReflectionTest.test_get_unique_constraints_with_schemas& ))1K)LLLLLr4c2tddgddgdddgdddd d gdd d gdd dgdgtjd}|j}t d|t dt jdt d t jdt dt jt d t jdt d t jd|}|D]2}| t j |dd|di3| t|j }t|d|tjd}t}t!||D]B\} } | dd} | r|| t'| | Ct)} t d| |j |}td|jD} td|jDdg}|r.t'|| t'|tdSdS)Nunique_arW)rLr unique_a_b_c)rWrXr unique_c_a_b)rrWrXunique_asc_keyascrz i.have.dotsrXz i have spacesrrLrtesttblrrr)rr)rr*cg|] }|j SrFrNrs r2rzHComponentReflectionTest._test_get_unique_constraints..?s???c???r4cPg|]#}t|tj|j$SrF)r-rYr[rL)ruqs r2rzHComponentReflectionTest._test_get_unique_constraints..As=   b""566    r4)roperator itemgetterr1rr rYrrappend_constraintr[rrrrr3r(raddrrr constraints difference)r<r*uniques orig_metaruc inspectorrnames_that_duplicate_indexorigrdupereflected_metadata idx_namesuq_namess r2rz4ComponentReflectionTest._test_get_unique_constraintss#cU;;'II'II)E5>JJ&>>(3%@@  #F++    M    3 " & & 3 " & & 3 # # 5")B-- ( ( 5")B-- ( (      B  # ##R%7IbjII     IN++   , ,Yv , F F#F++   &)UU"gy11  JD$88.55D 5*..t444 dOOOO%ZZ  #.    ??Y->???@@   #/     *n% & &  & ! *I 6 6 6 #%%  ! !r4c.|dSrj)_test_get_check_constraintsr s r2rz2ComponentReflectionTest.test_get_check_constraintsMs ((*****r4cP|tjjdSr^)rrrr.r s r2!test_get_check_constraints_schemaz9ComponentReflectionTest.test_get_check_constraints_schemaQs& ((0J(KKKKKr4c |j}td|tdtt jddt jdd||t|j}t| d|tj d  }d fd |D}t|dd ddddgdS)Nsa_ccrWza > 1 AND a < 5cc1rNza = 1 OR (a > 2 AND a < 5)cc2r)rLrcdtjd|tjS)N zand|\d|=|a|or|<|>)joinrefindalllowerI)sqltexts r2 normalizezFComponentReflectionTest._test_get_check_constraints..normalizems488 /"$GG r4cDg|]}|d|ddS)rLr rLr rF)ritemr s r2rzGComponentReflectionTest._test_get_check_constraints..rsC   &\iiY.H.H I I   r4za > 1 and a < 5r za = 1 or a > 2 and a < 5)r1rr rrYr]rrrrget_check_constraintsrrr)r<r*rrrr s @r2rz3ComponentReflectionTest._test_get_check_constraintsVs3M    3 " "  0u = = =  ;% H H H      IN++   + +GF + C C#F++           !    +<==+EFF      r4c|j}d}d}t|j}|||}|||||}||dS)Nrrr))r1rrget_view_definitionr)r<r*r view_name1 view_name2rmv1v2s r2_test_get_view_definitionz1ComponentReflectionTest._test_get_view_definition~s|} ( ty!!  % %j % @ @ R  % %j % @ @ Rr4c.|dSrj)rr s r2rqz0ComponentReflectionTest.test_get_view_definitions &&(((((r4cP|tjjdSr^)rrrr.r s r2$test_get_view_definition_with_schemazzBComponentReflectionTest.test_autoincrement_col..s...A1V9a...r4N)r1rrr)r<rrmrcnamer;id_s r2test_autoincrement_colz.ComponentReflectionTest.test_autoincrement_colsh}ty!!  2 2LE5 ##E**D.....u5CC  2 2r4)NrNrj)Nr)`rArBrC run_inserts run_deletesrDrErr3rrrrrr+schema_reflectionrrrprovide_metadatarrrrrrtable_reflectionr !foreign_key_constraint_reflectionrrrr,rrrr_rr r"r@rtrJrQrUr\r`rrcrfrhrjrt!primary_key_constraint_reflectionrwrwr|rryrrr1foreign_key_constraint_option_reflection_ondeleter1foreign_key_constraint_option_reflection_onupdaterrrrrr{rrrrrindexes_with_expressionsrrr}rrrrrrrrrrqronly_onrr r"r(rFr4r2rrs $$K+K[NN[N M-M-[M-^OO[O4NN[N[  'LL('L  '>>('>  'NN('N 8<$1$1$1$1L &44'&4  % & %66&%'&&%6  &%%'&% & 7;;87'&; ("")(" ( <<)(<    6 & ??'&? ,66-,6 ,   -,  & ,66-,'&666666666p &!!'&!       &'&  &'&  &   '&  & BB'&B +++,++ + , %BB&%-,,+B  ,22-,2 ,   -,  2222  7''87' & 7 HH87'&H &    '&   >>>>@ 7&&87& 7 GG87G 0 88108B G??HG? G@@HG@ *B*B*BX... ====* &!!'&! & BB'&B ---  & *OO+*'&O & *KK+*'&K . /.6 2,,32, + 2LL32,+L +  ,+ $ 2 MM32M L!L!L!L!\ 1++21+ 1 LL21L % % % % N  %))&%) % JJ&%JW_\#899 +++:9+ *** MMM & 22'&222r4rc8eZdZdZdZedZdZdZdS)NormalizedNameTest)denormalized_namesTc ttdd|tdtdttdd|tdtdtdt ddS) Nt1Trar#r$t2t1idzt1.id)rrr rrr/s r2r3z NormalizedNameTest.define_tabless D ) ) )  4d 3 3 3    D ) ) )  4d 3 3 3 6:g.. / /      r4cttj}tt dd|d}|jd}ttj}|ddS)Nr:Tr9)autoloadr8c.|dvS)Nr8r:r)rLms r2zINormalizedNameTest.test_reflect_lowercase_forced_tables..s (Dr4)only)rrr7rrrreflect)r<m2t2_reft1_refm3s r2$test_reflect_lowercase_forced_tablesz7NormalizedNameTest.test_reflect_lowercase_forced_tablessl gj ! !{4t444b4HHH4gj ! ! DD EEEEEr4cpdttjD}t |d|dt |d|ddS)Nc>g|]}|dv|S)r?r@)rrs r2rz;NormalizedNameTest.test_get_table_names..s5   wwyyL(( (((r4rr)rrr7rrupperr)r< tablenamess r2r z'NormalizedNameTest.test_get_table_namess  WZ((88::   JqM   ! !:a=#6#6#8#8999 JqM   ! !:a=#6#6#8#899999r4N) rArBrC __requires__rDrEr3rIr rFr4r2r5r5sX*LK   [   G G G:::::r4r5cPeZdZdZdZdZdZejj dZ dS)ComputedReflectionTestcttj}|d}|D]D}|ddkrt d|dv&|dst |ddEdS)Ncomputed_column_tablerL with_default42default autoincrement)rrr7rrr )r<rmr;r=s r2!test_computed_col_default_not_setz8ComputedReflectionTest.test_computed_col_default_not_setsvy!! 788 * *C6{n,,I.////) *C ND)))  * *r4cXttj}|d}d|D}dD]}t d||v|d}t d|vt d|dvt ||dddt d|dvtjj j tjj j r2t |ddtjj j dSdS) Ncomputed_default_tablec i|] }|d| SrNrFrHs r2r%zKComputedReflectionTest.test_get_column_returns_computed..+++& 1+++r4)r#normalrScomputed computed_colr  normal+42 persisted) rrr7rrrr rr+"computed_columns_reflect_persistedr-"computed_columns_default_persisted)r<rmr;r&rcompDatas r2 test_get_column_returns_computedz7ComputedReflectionTest.test_get_column_returns_computeds9vy!! 899++d+++3 1 1C Jd3i/ 0 0 0 0' h&''' Xj11222 DNN8J/ : ; ;[III 8J/ /   ? G      > F  $[1 CK       r4c td||v||d}t||d|tjjjr)td|vt|d|dSdS)Nr]r r`)rrr rr+rar-r )r<r&columnr r`rcs r2 check_columnz#ComputedReflectionTest.check_columns d6l*+++< + DNN8I. / /999   > F 2 K8+ , , , %y 1 1 1 1 1 2 2r4cttj}|d}d|D}||ddt jjjt jj jr||dddt jj jr||dd d dSdS) NrRc i|] }|d| SrNrFrHs r2r%zLComputedReflectionTest.test_get_column_returns_persisted..r[r4computed_no_flagr_computed_virtualznormal+2Fcomputed_storedz normal-42T) rrr7rrgrr+rbr-computed_columns_virtualcomputed_columns_storedr<rmr;r&s r2!test_get_column_returns_persistedz8ComputedReflectionTest.test_get_column_returns_persisted svy!! 788++d+++       ? G      4 <    "       3 ;    !        r4cttj}|dtj}d|D}||ddt jjj t jj j r||dddt jj j r||d d d dSdS) NrRr)c i|] }|d| SrNrFrHs r2r%zXComputedReflectionTest.test_get_column_returns_persisted_with_schema../r[r4rjz normal/42rkznormal/2Frlz normal*42T) rrr7rr.rgrr+rbr-rmrnros r2-test_get_column_returns_persisted_with_schemazDComputedReflectionTest.test_get_column_returns_persisted_with_schema(svy!! #F,>   ,+d+++       ? G      4 <    "       3 ;    !        r4N) rArBrCrWrdrgrprr+r,rsrFr4r2rPrPsr****2226 r4rPceZdZdZedZejjej dZ ejj ej dZ dS)CompositeKeyReflectionTestTcBtd|tdttdttdtjdt jdddddd }td |tdtd td ttd ttdtjdt jgd|jj |jj |jj gddd dS)Ntb1r#attrrLrpk_tb1rNTrtb2r$pidpattrpnamer}r{r|fk_tb1_name_id_attr) rr rr0rrYrZr\rrLr#rx)r0r1rws r2r3z(CompositeKeyReflectionTest.define_tablesJs   4 ! ! 67 # # 69,R00 1 1  #FD&x H H H        4d 3 3 3 5' " " 7G $ $ 7I-b11 2 2  #)))SUXsuz2*          r4c|j}t|j}||jjj}t|dgddS)NrlrLr#rx) r1rrrmrrwrLrget)r<rrmr%s r2test_pk_column_orderz/CompositeKeyReflectionTest.test_pk_column_orderfs^}ty!!,,T[_-ABB  KOO1 2 24J4J4JKKKKKr4cb|j}t|j}||jjj}tt|d|d}t| dgdt| dgddS)Nrrrrrlr~) r1rrrrrzrLrr)r)r<rrm foreign_keysrs r2test_fk_column_orderz/CompositeKeyReflectionTest.test_fk_column_orderos}ty!!,,T[_-ABB  C  q!!!Q EII( ) )+A+A+ABBB EII+ , ,.G.G.GHHHHHr4N) rArBrCrDrEr3rr+r/r,rr.rrFr4r2ruruGsK  [ 6 7 LL87L 7 II87IIIr4ru)rrHr r5rPru)/rrrrYrrrrrrr r provisionr r*r rrrryrrrrrrrr0engine.reflectionrrr sql.elementsrrrr1r TablesTestr rHrr5ComputedReflectionFixtureTestrPru__all__rFr4r2rs/ $$$$$$//////""""""******''''''%+++++8&+++\N0N0N0N0N0X0N0N0N0bX2X2X2X2X2h1X2X2X2v%:%:%:%:%:,%:%:%:P_____XC___D2I2I2I2I2I!42I2I2Ij r4