
    ɯeiF                       U d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlmZmZmZmZ d dlmZmZ d dl	mZ d dlmZ d dlm Z  d dlm!Z! d dl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2 d dl3Z4d d	l5m6Z6 d d
l7m8Z8m9Z9 d dl:m;Z;m<Z< d dl=m>Z>m?Z? d dl@mAZB d dlCmDZD d dlEmFZF d dlGmAZH e$rd dlImJZJmKZK d dlLmMZM d dlNmOZO 	 d dl7mPZP  e
j                  d      ZSdZTdZUdZVeTeUgZWeWeVgz   ZXdZYdZZdZ[deZ de[ dZ\dZ]dZ^ ej                  d e\ d!e\ d"e\ d#      Z` ej                  e]      Za ej                  e^      Zbd$e\ dZcd%Zdej                  ej                  z   Zg ej                  d&ej                        Zi ej                  d'ej                        Zji d(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdS	Zkekj                         D  ci c]  \  } }|| 
 c}} ZmdTZndUZoh dVZph dWZqh dXZrdYZsdZZtej                  j                  ej                  j                  ex      d[      Zyd\Zzd]ez d^Z{d_d`dadbdcddZ|ej                  j                  ej                  j                  ex      de      Z}dfZ~dgZdZdhZdiZg djZdk Z e       Z eee>       Z G dl dme      Zi dnh dodph dqdrh dsdth dudvh dwdxh dydzh d{d|h d}d~h ddh ddh ddh ddh ddh ddh dddhddhh dddhddhddhddhddhdZ eej                               Zej                         D  ci c]  \  } }|D ]  }||   c}}} Z eej                               Zd Zdede/eef   fdZdefdZdedefdZedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       ZdedefdZdedefdZdedefdZdedefdZd ZdedefdZdededefdZdedefdZdeddfdZdedefdZdedefdZdede/eef   fdZdedefdZdedefdZdedefdZdefdZejX                  	 	 	 dkdede-e   dedede#e   f
d       Zde%de*fdĄZde%de/e*ef   fdńZdddededefdʄZ	 	 	 	 	 dldededede-e   dededefd̈́Zdede0e   dedefdфZdmdedefdӄZ	 	 	 	 dnde-e'eef      de-e   dedede'eef   f
dׄZdd؜dededeeef   fdڄZdedefdۄZd܄ ZdedefdބZdodedefdZd Zde1e*e8   e*d   f   de/e-e*e      e-e*e&      f   fdZ	 	 dpde*e%   de-e1e*e8   e*d   f      dede*eF   fdZ	 	 dpde9de-e*e8      dede)eF   fdZ G d de      Z G d d      Zi Ze'eef   ed<   dqdedededdfdZ G d d      Z G d d      Zdede1ej                  ef   fdZdede1ej                  ef   fdZe G d de             Ze G d de             Ze G d de             Z G d d      Z eΫ       aeeÐd <   defdZАde̐deddfdZ e2de&      ZҐdedefdZӐd	e+d
   dededede&f
dZԐd	e+d
   dede&fdZՐddddededede&fdZ֐ddddededede&fdZאdede&fdZؐddddededede&fdZِdededefdZ	 drde-e*e1ee/eef   f         deddfdZېde1de(e   df   ddfdZܐde'ee%f   d e.e   de/e'ee%f   e'ee%f   f   fd!Zݐde'ee%f   de/e'ee%f   e'ee%f   f   fd"Zސde'ee%f   de/e'ee%f   e'ee%f   f   fd#Zߐd$ed%e'eef   defd&Zd'edefd(Zd'ede*e   fd)ZdZd*Z ej                  d+ej                        Z ej                  d,      Zdsded-edefd.Zdedefd/Zd0edefd1Zd2edefd3Z ej                  d4      Zd2edefd5Zd6d7d8ed9d:d;e-e1e(d<   d7f      d=e-d<   f
d>Zd?eddfd@ZdAe%defdBZdCe1eef   defdDZdEe1dFe/dGef   e'eef   f   fdHZ G dI dJe>      Zde/e?ef   fdKZ G dL dM      Z e       ZeeÐdN<    G dO dPe      ZdQe*dR   defdSZdT ZdU ZdVefdWZdXedYe*e   defdZZ G d[ d\e,      Z d]ed^e*e   d_ede*d`   fdaZ	 dtdbedce1e'edFf   e*dF   f   ddeddFfdeZdfe1dg   dheddRfdiZejX                  de&g ef   fdj       Zy# eQ$ r e8ZPY w xY wc c}} w c c}}} w (u      N)EnumIntEnumautounique)	lru_cachewraps)count)JSONEncoderperf_counter)Random)IOTYPE_CHECKINGAnyCallableDictIterableIteratorListLiteral
NamedTupleOptionalSetTupleTypeUnionTypeVar)FIELD_ID_TO_NAME)ResultMetadataSnowflakeCursor)OPERATING_SYSTEMPLATFORM)MissingOptionalDependencyModuleLikeObject)VERSION)SnowparkClientExceptionMessagesRow)SnowflakePlanQueryLineInterval
Selectable)TimestampTimeZone)ResultMetadataV2zsnowflake.snowpark@zsnow:///   z([a-zA-Z_][\w\$]{0,255})z("([^"]|""){1,255}")(|)z("([A-Z_][A-Z0-9_\$]{0,255})")z([a-zA-Z0-9_\$]{0,255})z^((z
\.){0,2}|(z\.\.))$z(%?SNOWPARK_TEMP_z^(\s|\()*(select|with)z^\s*with\s+\w+\s+as\s+procedurezabsl-pyabslzasync-timeoutasync_timeoutattrsattrbrotlipybrotlizcharset-normalizercharset_normalizerzgoogle-authzgoogle.authzgoogle-auth-oauthlibgoogle_auth_oauthlibzgoogle-pastapastagrpciogrpczimportlib-metadataimportlib_metadatancursescursesz
py-xgboostxgboostzpyasn1-modulespyasn1_modulespyjwtjwt	pyopensslOpenSSLpysockssockszpython-dateutildateutilflatbufferstorchyamlrequests_oauthlibsklearnsqlite3tensorboard_plugin_wittensorflow_estimatortyping_extensions)	zpython-flatbufferspytorchpyyamlzrequests-oauthlibzscikit-learnsqliteztensorboard-plugin-witztensorflow-estimatorztyping-extensions)z.pycz.pyoz.pydz.pyi)PARQUETORCAVROJSONCSV>	   FORCEPURGEON_ERROR
SIZE_LIMITENFORCE_LENGTHTRUNCATECOLUMNSRETURN_FAILED_ONLYLOAD_UNCERTAIN_FILESMATCH_BY_COLUMN_NAME>   SINGLE	OVERWRITEMAX_FILE_SIZEDETAILED_OUTPUTINCLUDE_QUERY_ID>   FILESPATTERNTRY_CASTFILE_FORMATFORMAT_NAMECOPY_OPTIONSINFER_SCHEMATARGET_COLUMNSTRANSFORMATIONSVALIDATION_MODEFORMAT_TYPE_OPTIONSINFER_SCHEMA_OPTIONSENFORCE_EXISTING_FILE_FORMATROWTAGROW_DATAzxml_reader.pyzDataFrameReader.xml[rowTag]z/* Python:snowflake.snowpark.z */xpath_array_handlerxpath_string_handlerxpath_boolean_handlerxpath_int_handlerxpath_float_handler)arraystringbooleanintfloatzxpath_handlers.py	QUERY_TAG   	TEMPORARYzSCOPED TEMPORARY)temp	temporary	transientc                  x    ddl m}   |        }	 t        j                  d      }ddlm} |S # t        $ r Y |S w xY w)zRHelper function to lazily import pandas and return MissingPandas if not installed.r   )MissingPandaspandas	DataFrame)snowflake.connector.optionsr   	importlibimport_moduler   r   ImportError)r   r   r   s      d/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/snowflake/snowpark/_internal/utils.py_pandas_importerr      sD    9_F((2$ M  Ms   , 	99c                   <    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZy)TempObjectTypeTABLEVIEWSTAGEFUNCTIONrp   r   COLUMN	PROCEDURETABLE_FUNCTIONDYNAMIC_TABLEAGGREGATE_FUNCTIONCTEN)__name__
__module____qualname__r   r   r   r   rp   r   r   r   r   r   r   r        r   r   r     s?    EDEHKIFI%N#M-
Cr   r   year>   yyryyyrsyyyr   yyyyyearsquarter>   qqtrqtrsr   quartersmonth>   mmmonmonsr   monthsweek>   wwkwywoyr   
weekofyearday>   dddr   days
dayofmonthhour>   hhhhrhrsr   hoursminute>   mmiminminsr   minutessecond>   ssecsecsr   secondsmillisecond>   msmsecr   millisecondsmicrosecond>   ususecr   microseconds
nanosecond>   nsnsecnanosecnsecondnanosecsnsecondsr   nanoseconds	dayofweek>   dwdowweekdayr   dayofweekiso>   dw_isodow_isoweekday_isor   	dayofyear>   dydoyyeardayr   weekiso>   r   week_isoweekofyearisoweekofyear_iso
yearofweekyearofweekiso>   epochepoch_secondepoch_secondsepoch_millisecondepoch_millisecondsepoch_microsecondepoch_microsecondsepoch_nanosecondepoch_nanosecondstimezone_hourtzhtimezone_minutetzm)r   r   r   r   r  r  c                 `    | j                         }|t        v r	t        |   S t        |  d      )Nz' is not a recognized date or time part.)lowerDATETIME_ALIASESALIASES_TO_DATETIME_PART
ValueError)partlowered_parts     r   unalias_datetime_partr  =  s4    ::<L'''55D6!HIJJr   durationreturnc                 ^    | j                  d      \  }}t        |      }t        |      }||fS )N )splitr   r  )r  lengthunits      r   parse_duration_stringr  E  s1    >>#&LFD[F &D4<r   namec                 X    t         j                  |       st        j                  |       y N)SNOWFLAKE_OBJECT_RE_PATTERNmatchr&   GENERAL_INVALID_OBJECT_NAMEr  s    r   validate_object_namer  L  s&    &,,T2-II$OO 3r   stage_locationc                 f    | j                         } | st        d      | d   dk(  rt        d      | S )Nzzstage_location cannot be empty. It must be a full stage path with prefix and file name like @mystage/stage/prefix/filenamer0   zRstage_location should end with target filename like @mystage/prefix/stage/filename)stripr	  )r  s    r   validate_stage_locationr!  Q  sM    #))+N I
 	
 bS `
 	
 r   c                  j    dj                  t        D  cg c]  } | t        |        c}       S c c} w N.)joinsnowpark_versionstrr   s    r   get_versionr)  ^  s(    88%5GSVGHHG   00c                  *    t        j                         S r  )platformpython_versionr   r   r   get_python_versionr.  c  s    ""$$r   c                      t        t        d      xs. t        j                  j                  xs dt        j                  v S )Nps1snowbook)hasattrsysflagsinteractivemodulesr   r   r   is_interactiver7  h  s,    3T#))"7"7T:;TTr   c                  j    dj                  t        D  cg c]  } | t        |        c}       S c c} w r#  )r%  connector_versionr'  r(  s    r   get_connector_versionr:  m  s(    88%6H!-SVHIIHr*  c                  *    t        j                         S r  )r,  systemr   r   r   get_os_namer=  r  s    ??r   c                       y)NPythonSnowparkr   r   r   r   get_application_namer@  w  s    r   c                 J    | j                  d      xr | j                  d      S )N')
startswithendswithr  s    r   is_single_quotedrE  |  s    ??36DMM#$66r   c                 0    t         j                  |       d uS r  )/SNOWFLAKE_CASE_INSENSITIVE_QUOTED_ID_RE_PATTERN	fullmatchr  s    r   'is_snowflake_quoted_id_case_insensitiverI    s    :DDTJRVVVr   c                 0    t         j                  |       d uS r  )5SNOWFLAKE_CASE_INSENSITIVE_UNQUOTED_SUFFIX_RE_PATTERNrH  r  s    r   -is_snowflake_unquoted_suffix_case_insensitiverL    s    =GGM	r   c                 j    | j                         }t        |      r|dd }|j                  dd      }|S )N   r  \'rB  )r   rE  replacer  new_names     r   unwrap_single_quoterS    s7    zz|H!Ab>s+HOr   c                 &    | j                  dd      S )NrB  rO  )rP  )	input_strs    r   escape_single_quotesrV    s    S%((r   sqlc                 b    t         j                  |       d uxr t        j                  |       d u S r  )#SNOWFLAKE_SELECT_SQL_PREFIX_PATTERNr  %SNOWFLAKE_ANONYMOUS_CALL_WITH_PATTERN)rW  s    r   is_sql_select_statementr[    s3    +11#6dB 	E177<Dr   pathis_localc                      |rdgnt         }t               r S |rt        dk(  r j                  dd        j	                         j                  dd       t         fd|D              s	|d       d  dS )	a|  
    Get a normalized path of a local file or remote stage location for PUT/GET commands.
    If there are any special characters including spaces in the path, it needs to be
    quoted with single quote. For example, 'file:///tmp/load data' for a path containing
    a directory named "load data". Therefore, if `path` is already wrapped by single quotes,
    we do nothing.
    file://Windows\r0   rB  rO  c              3   @   K   | ]  }j                  |        y wr  rC  ).0prefixr\  s     r   	<genexpr>z!normalize_path.<locals>.<genexpr>  s     >6tv&>   r   )SNOWFLAKE_PATH_PREFIXES_FOR_GETrE  r!   rP  r   any)r\  r]  prefixess   `  r   normalize_pathrk    s     '	{,KH$	1||D#&::<U+D>X>>1+tf%tfA;r   c                     | j                  d      xsJ | j                  d      xs7 | j                  d      xs$ | j                  d      xs | j                  d      S )Nzs3://z
s3china://zs3gov://zazure://zgcs://rc  r\  s    r   is_cloud_pathrn    s[      	%??<(	%??:&	% ??:&	% ??8$r   configc                 f    t        j                         dkD  rt        j                  d|  d       y y )NrN  zQYou might have more than one threads sharing the Session object trying to update z. Updating this while other tasks are running can potentially cause unexpected behavior. Please update the session configuration before starting the threads.)	threadingactive_count_loggerwarning)ro  s    r   0warn_session_config_update_in_multithreaded_moderu    s8    !#_h hh	
 $r   c                     t        | d      S )NFr]  rk  r  s    r   normalize_remote_file_or_dirry    s    $//r   filec                     t        | d      S )NTrw  rx  )rz  s    r   normalize_local_filer|    s    $..r   c                 >    t        |       } | j                  dd      S )z/Split a file path into directory and file name.r0   rN  )maxsplit)rS  rsplitrm  s    r   
split_pathr    s    t$D;;sQ;''r   c                 b    t        |       t        fdt        D              rS t          S )Nc              3   @   K   | ]  }j                  |        y wr  rc  )rd  re  rR  s     r   rf  z5unwrap_stage_location_single_quote.<locals>.<genexpr>  s     
U68v&
Urg  )rS  ri  rh  STAGE_PREFIXrQ  s    @r   "unwrap_stage_location_single_quoter    s0    "4(H

U5T
UU^H:&&r   c                 r    | j                         }t        |      r|dd }|j                  d      r|dd  S |S )NrN  r  r_     )r   rE  rC  )rz  	trim_files     r   get_local_file_pathr    s@    

I	"aO	I&}r   udf_namec                     t        j                  d|       r| S dj                  t        j                  dd|       t	        t        |                   S )z0Get the valid stage prefix when uploading a UDF.z[\w]+$z{}_{}z\W )rer  formatsubabshash)r  s    r   get_udf_upload_prefixr    s<    	xx	8$~~bffUB93tH~;NOOr   c                  .    t        j                  dd      S )zGet a random unsigned integer.r   l        )randomrandintr   r   r   random_numberr    s    >>!U##r   Fleading_pathadd_init_pyignore_generated_py_filec           
   #     K   t         j                  j                  |       st        |  d      |r!| j	                  |      st        | d|        |r|nt         j                  j                  | d      }t        j                         }t        j                  |dt        j                        5 }t         j                  j                  |       }t         j                  j                  |      t         j                  j                  |      k7  r|j                  t         j                  j                  ||       dd       t         j                  j                  |      }t         j                  j                  |      t         j                  j                  |      k7  rt         j                  j!                  |       rt        j"                  |       D ]  \  }}	}
|rd|v r|j%                  |t         j                  j                  ||             |
D ]j  }|r|j'                  t(              rt         j                  j                  ||      }|j%                  |t         j                  j                  ||             l  n0|j%                  | t         j                  j                  | |             d	d	d	       | |j+                          y	# 1 sw Y   xY ww)
av  Compresses the file or directory as a zip file to a binary stream.
    Args:
        path: The absolute path to a file or directory.
        leading_path: This argument is used to determine where directory should
            start in the zip file. Basically, this argument works as the role
            of `start` argument in os.path.relpath(path, start), i.e.,
            absolute path = [leading path]/[relative path]. For example,
            when the path is "/tmp/dir1/dir2/test.py", and the leading path
            is "/tmp/dir1", the generated filesystem structure in the zip file
            will be "dir2/test.py". The leading path will compose a namespace package
            that is used for zipimport on the server side.
        ignore_generated_py_file: Whether to ignore some generated python files
            in the directory.

    Returns:
        A byte stream.
     is not foundz doesn't lead to z..r   )modecompressionr0   r  __pycache__N)osr\  existsFileNotFoundErrorrC  r	  r%  ioBytesIOzipfileZipFileZIP_DEFLATEDdirnamerealpathwritestrrelpathisdirwalkwriterD  GENERATED_PY_FILE_EXTclose)r\  r  r  r  
start_pathinput_streamzfcur_pathr  _filesrz  filenames                r   zip_file_or_directory_to_streamr    s"    0 77>>$4& 677DOOL9L>):4&ABB ".277<<d3KJ::<L	3G,@,@
 >	77??4(ggx(BGG,<,<Z,HHKK277??8Z@ACRHwwx0H ggx(BGG,<,<Z,HH
 77==%'WWT] N!E+0H"''//':"FG! ND/DMM-5 !!ww||GT:HHHXrwwx'LMNN HHT277??4<=3>6 9> >s&   B/K1C0K"DK6KKKinputsc                  |    t        |       dk(  r+t        | d   t        t        t        f      rg | d   S | d   gS g | S )z+Convert the positional arguments to a list.rN  r   len
isinstancelisttuplesetr  s    r   parse_positional_args_to_listr  /  sM    
6{a&vay42DELfQiL	
LRSTI;	
 yr   c                  x    t        |       dk(  r't        | d   t        t        t        f      r	g | d   dfS g | dfS )zmConvert the positional arguments to a list, indicating whether to treat the argument list as a variadic list.rN  r   FTr  r  s    r   &parse_positional_args_to_list_variadicr  9  sD    
6{aJvay42DE&)e$$&	4  r   	hash_algozhashlib._hashlib.HASH
chunk_sizewhole_file_hashc                     t        |d      5 }|j                  |      }| j                  |       |r)|r'|j                  |      }| j                  |       |r|r'ddd       y# 1 sw Y   yxY w)ad  
    Reads from a file and updates the given hash algorithm with the read text.

    Args:
        hash_algo: The hash algorithm to updated.
        path: The path to the file to be read.
        chunk_size: How much of the file to read at a time.
        whole_file_hash: When True the whole file is hashed rather than stopping after the first chunk.
    rbN)openreadupdate)r  r\  r  r  fdatas         r   
_hash_filer  A  si     
dD	 #Qvvj!66*%DT" # # #s   AA$$A-additional_info	algorithmc                    t         j                  j                  |       st        |  d      t	        j
                  |      }t         j                  j                  |       rt        || ||       nUt         j                  j                  |       r'd}t        j                  |       D ]  \  }}	}
|rd|v rt        |	      D ]*  }|r|dk(  r|j                  |j                  d             , t        |
      D ]  }|r|j                  t              r|j                  |j                  d             t         j                  j                  ||      }t         j                  j!                  |      }|rt        ||||       ||z  }||k  st#        |||z
        }||z  }t        |||d         nt%        | d      |r |j                  |j                  d             |j'                         S )a  Calculates the checksum of a file or a directory.

    Args:
        path: the path to a local file or directory.
            If it points to a file, we read a small chunk from the file and
            calculate the checksum based on it.
            If it points to a directory, the names of all files and subdirectories
            in this directory will also be included for checksum computation.
        chunk_size: The size in byte we will read from the file/directory for
            checksum computation.
        ignore_generated_py_file: Whether to ignore some generated python files
            in the directory.
        additional_info: Any additional information we might want to include
            for checksum computation.
        algorithm: the hash algorithm.
        whole_file_hash: When set to True the files will be completely read while hashing.

    Returns:
        The result checksum.
    r  r   r  utf8Fz/ can only be calculated for a file or directory)r  r\  r  r  hashlibnewisfiler  r  r  sortedr  encoderD  r  r%  getsizer   r	  	hexdigest)r\  r  r  r  r  r  r  current_sizer  dirsr  dirrz  r  	file_size	read_sizes                   r   calculate_checksumr  X  s   8 77>>$4& 677I&I	ww~~d9dJ@	t	$&GGDM 	F GT5'MW,Dd| 5+}0D  F!345 u F+>S0T  V!4577<<6GGOOH5	"y(JP I-L!J. #IzL/H II I-Ly(IuE!F	F6 I;&UVWW//78  r   value
enum_class
except_strc                     	  ||       S # t         $ r> t        | ddj                  |D cg c]  }|j                   nc c}w c}             w xY w)Nz must be one of , )r	  r%  r  )r  r  r  es       r   str_to_enumr    sY    
%   
l*499z5R!agg5R5R+S*TU
 	

s   
  A>Askip_levelsc                 v    t        j                  t        | z         }dj                  | r
|d |         S |      S )N)limitr  )	tracebackformat_stackQUERY_TAG_TRACEBACK_LIMITr%  )r  stacks     r   create_statement_query_tagr    s:    "")B[)PQE77;5;,'BBEBBr   statement_paramsexists_session_query_tagcollect_stacktracec                 \    |s| rt         | v s|s| S | xs i }t        |dz         |t         <   |S NrN  )QUERY_TAG_STRINGr  )r  r  r  r  rets        r   0create_or_update_statement_params_with_query_tagr    s?     	!!15E!E!

 bC6{QGCJr   )return_full_stage_namer  c                p   t        |       }|j                  d      s| d}|j                  t         d      rd|dd  fS d}t	        |      D ]f  \  }}|dk(  r| }|dk(  s|r|d | }||dz   d  }|r|j                  d      |fc S t        j                  t        |      }|s y
|d   d	   }	|	|fc S  y
)Nr0   ~r1   F"rN  r/   r  r   NN)	r  rD  rC  r  	enumerateremoveprefixr  findallSNOWFLAKE_STAGE_NAME_PATTERN)
r  r  
normalized	is_quotedicfull_stage_namer\  res
stage_names
             r   get_stage_partsr    s     4NCJs#"|1%
 ~Q/0JqrN""I*% $18%I#Xi )!nOa!eg&D%&33C8$>> **9?KC  RJ t##'$* r   c                     t        |       \  }}|dk(  rt        |      S |rE|j                  d      rt        |      S t        |      t        |j                  d            z   dz   S t	        d|        )Nr  %r  rN  zInvalid stage )r  r  rC  r   r	  )r  r  r\  s      r   get_stage_file_prefix_lengthr	    s    &~6JS4y $$S) I	
 TS!1!1#!677!;	
 ~n%56
77r   c                      t         dk(  S )NXP)r"   r   r   r   is_in_stored_procedurer    s    tr   object_typec                 \    t          | j                   dt               j                          S )Nr  )TEMP_OBJECT_NAME_PREFIXr  generate_random_alphanumericupper)r  s    r   random_name_for_temp_objectr    s-    %&{'8'8&9;W;Y;_;_;a:bccr   r  c                 D    dj                  d t        |       D              S )Nr  c              3   V   K   | ]!  }t               j                  t               # y wr  )r   choiceALPHANUMERIC)rd  r  s     r   rf  z/generate_random_alphanumeric.<locals>.<genexpr>  s     HQ68??<0Hs   '))r%  range)r  s    r   r  r    s    77H%-HHHr   c                 b    t        | t        j                  j                        ryt	        |       S )a  A replacement to bool(col_) to check if ``col_`` is None or Empty.

    ``Column.__bool__` raises an exception to remind users to use &, |, ~ instead of and, or, not for logical operations.
    The side-effect is the implicit call like ``if col_`` also raises an exception.
    Our internal code sometimes needs to check an input column is None, "", or []. So this method will help it by writeint ``if column_to_bool(col_): ...``
    T)r  	snowflakesnowparkColumnbool)col_s    r   column_to_boolr     s'     $	**112:r   result_metar.   c                    ddl m} | syg }g }| D ]j  }|j                  |j                          |       r5t        |j
                     dk(  r|j                  |j                  d        Z|j                  d       l ||fS )a  
    Takes a list of result metadata objects and returns a list containing the names of all fields as
    well as a list of functions that wrap specific columns.

    A column type may need to be wrapped if the connector is unable to provide the columns data in
    an expected format. For example StructType columns are returned as dict objects, but are better
    represented as Row objects.
    r   )%_should_use_structured_type_semanticsr  OBJECTNc                     t        di | S )Nr   r'   )xs    r   <lambda>z$_parse_result_meta.<locals>.<lambda>$  s    chAh r   )snowflake.snowpark.contextr!  appendr  r   	type_codefields)r  r!  	col_nameswrapperscols        r   _parse_result_metar-    s     QIH 	""13 /8;

&OO./OOD!	" hr   
result_setcase_sensitivec                 d   t        |xs g       \  }}g }t        }|r9t        j                  j                  | j	                  |      j                         }| D ]O  }|r(t        ||      D 	cg c]  \  }}	|r ||	      n|	 }}}	|t        d       || }
|j                  |
       Q |S c c}	}w Nz-Result returned from Python connector is None)	r-  r(   _builderbuildset_case_sensitiveto_rowzipr	  r'  )r.  r  r/  r*  r+  rows
row_structr  wrapr   rows              r   result_set_to_rowsr;  *  s    
 -[->B?IxDJLL	*==nMTTV 	  :=h:MNwtQtDG*NDN<LMM$C K Os   ,B,c              #   D  K   t        |      \  }}t        }|r9t        j                  j                  | j	                  |      j                         }| D ]B  }|t        d      |r(t        ||      D cg c]  \  }}|r ||      n| }}} || }	|	 D y c c}}w wr1  )r-  r(   r2  r3  r4  r5  r	  r6  )
r.  r  r/  r*  r+  r8  r  r9  r   r:  s
             r   result_set_to_iterr=  A  s     
 -[9IxJLL	*==nMTTV 	  <LMM:=h:MNwtQtDG*NDN$	 Os   A3B 5BB c                   "     e Zd ZdZ fdZ xZS )PythonObjJSONEncoderz<Converts common Python objects to json serializable objects.c                    t        |t        t        f      r|j                         S t        |t        j
                        rt        |      S t        |t        j                  t        j                  t        j                  f      r|j                         S t        |t        j                        r|j                         S t        | 9  |      S r  )r  bytes	bytearrayhexdecimalDecimalr   datetimedatetime	isoformatr   tolistsuperdefault)selfr  	__class__s     r   rL  zPythonObjJSONEncoder.defaultX  s    eeY/099;w/<x}}h>O>OPQ??$$u{{+<<>!7?5))r   )r   r   r   __doc__rL  __classcell__rN  s   @r   r?  r?  U  s    F
* 
*r   r?  c                   ,    e Zd ZdeddfdZdeddfdZy)WarningHelperwarning_timesr  Nc                      || _         d| _        y Nr   )rT  r	   )rM  rT  s     r   __init__zWarningHelper.__init__f  s    *
r   textc                     | j                   | j                  k  rt        j                  |       | xj                   dz  c_         y r  )r	   rT  rs  rt  )rM  rX  s     r   rt  zWarningHelper.warningj  s-    ::***OOD!

a
r   )r   r   r   r   rW  r'  rt  r   r   r   rS  rS  e  s(    c d C D r   rS  warning_dictrX  rT  c                 h    | t         vrt        |      t         | <   t         |    j                  |       y r  )rZ  rS  rt  )r  rX  rT  s      r   rt  rt  s  s,    <*=9Tt$r   c                   (    e Zd ZdZd Zd Zd Zd Zy)
DummyRLockzbThis is a dummy lock that is used in place of threading.Rlock when multithreading is
    disabled.c                      y r  r   rM  s    r   	__enter__zDummyRLock.__enter__~      r   c                      y r  r   )rM  exc_typeexc_valexc_tbs       r   __exit__zDummyRLock.__exit__  ra  r   c                      y r  r   rM  argskwargss      r   acquirezDummyRLock.acquire  ra  r   c                      y r  r   rh  s      r   releasezDummyRLock.release  ra  r   N)r   r   r   rO  r`  rf  rk  rm  r   r   r   r]  r]  z  s    r   r]  c                       e Zd ZdZy)DummyThreadLocalzpThis is a dummy thread local class that is used in place of threading.local when
    multithreading is disabled.N)r   r   r   rO  r   r   r   ro  ro    s    # 	r   ro  thread_safe_session_enabledc                 B    | rt        j                         S t               S r  )rq  localro  rp  s    r   create_thread_localrt    s     #  r   c                 B    | rt        j                         S t               S r  )rq  RLockr]  rs  s    r   create_rlockrw    s     #  <r   c                       e Zd ZdZdZdZdZy)AstModezp
    Describes the ast modes that instruct the client to send sql and/or dataframe AST to snowflake server.
    r   rN  r   N)r   r   r   rO  SQL_ONLYSQL_AND_ASTAST_ONLYr   r   r   ry  ry    s     HKHr   ry  c                   N    e Zd ZdZ e       Z	  e       Z	  e       Z	  e       Zy)AstFlagSourcez
    Describes the source of the AST feature flag value. This is not just an annotation!
    The enum value determines the precedence of the value.
    N)	r   r   r   rO  r   LOCALSERVERUSERTESTr   r   r   r~  r~    s3    
 FEuVF#6DI6Dr   r~  c                   ^    e Zd ZdZ e       Z	  e       Z	  e       Z	  e       Z	  e       Z	y)_AstFlagStatez<
    Describes the state of the AST feature flag value.
    N)
r   r   r   rO  r   NEW	TENTATIVE
SERVER_SETUSER_SET	FINALIZEDr   r   r   r  r    s;     &CYInJ*vH(I=r   r  c                   B    e Zd ZdZd	dZedefd       ZdededdfdZ	y)
	_AstStatea  
    Tracks the state of the ast_enabled feature flag. This class is thread-safe. The most important role of this
    class is to prevent the flag from flip-flopping. In particular, once the feature is disabled (for any reason),
    nothing can re-enable it.
    r  Nc                 n    t        j                         | _        d| _        t        j
                  | _        y)z!Creates an instance of _AstState.TN)rq  Lock_mutex_ast_enabledr  r  _stater_  s    r   rW  z_AstState.__init__  s'    nn& !#''r   c                    | j                   5  | j                  t        j                  k(  r5t        j                  d| j                         t        j                  | _        | j                  cddd       S # 1 sw Y   yxY w)/Gets the value of the ast_enabled feature flag.zFAST state has not been set explicitly. Defaulting to ast_enabled = %s.N)r  r  r  r  rs  infor  r  r_  s    r   enabledz_AstState.enabled  sd     [[ 		%{{m/// \%% ,55$$		% 		% 		%s   AA55A>sourceenablec                 
   | j                   5  t        j                  d| j                  | j                  ||       |t
        j                  k(  r&t        j                  | _        || _        	 ddd       y| j                  t        j                  k(  r:| j                  |k7  r+t        j                  d| j                  |       	 ddd       y|t
        j                  k(  r&|| _        t        j                  | _        	 ddd       y| j                  t        j                  k(  xr | j                   xr | }|t
        j                  k(  r5|r|| _        nt        j                  d       t        j                  | _        ns|t
        j                  k(  r5|r|| _        nt        j                  d       t        j                  | _        n+t!        d| j                   d| j                   d| d	|       ddd       y# 1 sw Y   yxY w)
a  
        Sets the value of the ast_enabled feature flag. The method may ignore the change request if the requested
        transition is unsafe, or if the flag was already set at a precedence level not greater than the precedence
        level of "source".

        Flip-flopping the flag (enabled -> disabled -> enabled) is unsafe.

        The AST feature can be disabled only once, and stays disabled no matter what happens afterward. The feature can
        be enabled transiently, and once something (server setting or test configuration) makes a final decision, that
        decision is permanent for the life of the process.

        Args:
            source: The source of the request. Using SERVER or TEST will finalize the flag.
            enable: The new value of the flag.
        zbSetting AST state. Current state: ast_enabled = %s, state = %s. Request: source = %s, enable = %s.Nz`Cannot change AST state after it has been finalized. Frozen ast_enabled = %s. Ignoring value %s.zQServer cannot enable AST after treating it as disabled locally. Ignoring request.zVCannot enable AST by local preference after treating it as disabled. Ignoring request.z3Unhandled transition. Current state: ast_enabled = z
, state = z. Request: source = z, enable = )r  rs  debugr  r  r~  r  r  r  rt  r  r  r  r  r  r  NotImplementedError)rM  r  r  safe_transitions       r   	set_statez_AstState.set_state  s     [[ :	MMt!! +++ ,55$*!:	 :	 {{m555$:K:Kv:Uv%%
 ):	 :	2 +++ %+!+44=:	 :	F }666 )))%O
 ---"(.D%OOk ,66=..."(.D%OOp ,55)I$J[J[I\\fgkgrgrfs  tH  IO  HP  P[  \b  [c  d q:	 :	 :	s    AG94AG90G9C,G99Hr  N)
r   r   r   rO  rW  propertyr  r  r~  r  r   r   r   r  r    sE    ( % % %J Jt J Jr   r  
_ast_statec                  "    t         j                  S )r  )r  r  r   r   r   is_ast_enabledr  H  s     r   r  r  c                 .    t         j                  | |      S )zl
    Sets the value of the ast_enabled feature flag.

    See _AstState.set_state for more information.
    )r  r  )r  r  s     r   set_ast_stater  N  s     00r   	CallableT)boundfuncc                 v     d j                   j                  v t        j                          fd       }|S )z=decorator to safeguard public APIs with global feature flags.	_emit_astc                  Z    s | i |S d|v r | i |S t               |d<    | i |S )Nr  )r  )ri  rj  r  has_emit_asts     r   call_wrapperzpublicapi.<locals>.call_wrapperl  sO     (((& (((,.{ T$V$$r   )__code__co_varnames	functoolsr   )r  r  r  s   ` @r   	publicapir  f  s<     %(A(AAL__T% %" r   decorator_type)
deprecatedexperimentalin private previewversionextra_warning_textextra_doc_stringc                      fd}|S )Nc                       j                    d d ddv rdnd  d d d d} j                  xs d d	d
 | d _        t        j                          fd       }|S )Nz() is  since . r  r  Do not use it in production. r  zThis function or method is z 

z

z        
c                  @    t        j                          | i |S r  )rt  r   )ri  rj  r  warning_texts     r   func_call_wrapperz:func_decorator.<locals>.wrapper.<locals>.func_call_wrapper  s#    D%%|4(((r   )r   rO  r  r   )r  doc_string_textr  r  r  r  r  r  s   `  @r   wrapperzfunc_decorator.<locals>.wrapper  s      !'7wwir2@Dj2j.prs!"$ 	
 87GwwiWYZjYkkpq,,,"-T%8IL			) 
	) ! r   r   )r  r  r  r  r  s   ```` r   func_decoratorr    s    !  Nr   c                      fd}|S )Nc           	           d j                    d d ddv rdnd t        j                          fd       }|S )	Nz
Parameter z is r  r  r  r  r  c                  @    t        j                          | i |S r  )rt  r   )ri  rj  param_setter_functionr  s     r   r  z;param_decorator.<locals>.wrapper.<locals>.func_call_wrapper  s$    )22LA($9&99r   )r   r  r   )r  r  r  r  r  s   ` @r   r  z param_decorator.<locals>.wrapper  sg    .778^<LGT[S\\^2@Dj2j.prsu 	
 
.	/	: 
0	: ! r   r   )r  r  r  s   `` r   param_decoratorr    s    
! Nr   r  )r  r  c                      t        d| ||      S )Nr  r  r  r  r  r  s      r   r  r    s     -)	 r   c                      t        d| ||      S )Nr  r  r  r  s      r   r  r    s     -)	 r   c                     t        d|       S )Nr  r  )r  r  s    r   experimental_parameterr    s     r   c                      t        d| ||      S )Nr  r  r  r  s      r   private_previewr    s     -)	 r   use_scoped_temp_objectsis_generatedc                 "    | r|rt         S t        S r  )SCOPED_TEMPORARY_STRINGTEMPORARY_STRING)r  r  s     r   get_temp_type_for_objectr    s     #| 	  r   importsc                 j    | 1t        | t              rt        d | D              st        | d      yy)zPCheck that import parameter adheres to type hint given, if not raises TypeError.Nc              3      K   | ]`  }t        |t              xsJ t        |t              xr8 t        |      d k(  xr( t        |d   t              xr t        |d   t               b yw)r   r   rN  N)r  r'  r  r  )rd  imps     r   rf  z%check_imports_type.<locals>.<genexpr>  sm      	  3$ sE* 0CA0"3q63/0 #3q63/	s   A&A(za import can only be a file path (str) or a tuple of the file path (str) and the import path (str))r  r  all	TypeError)r  r  s     r   check_imports_typer    sN    
 	w% 	 #	 	 fuv
 	
	 	r   output_schema
StructTypePandasDataFrameTypec                     ddl m} t        rddl m} nt        }t        | |      s<t        rt        | |      s)t        | t              st        dt        |        d      yyy)z=Helper function to ensure output_schema adheres to type hint.r   )r  )r  zs'output_schema' must be a list of column names or StructType or PandasDataFrameType instance to create a UDTF. Got r$  N)	snowflake.snowpark.typesr  installed_pandasr  r   r  r   r	  type)r  r  r  s      r   check_output_schema_typer    s     4@! 	=*-M;N!OmX. B  CG  HU  CV  BW  WX  Y
 	
 / "P 	.r   optionsallowed_optionsc                     | j                  di       }| j                  di       }| j                         D ]  \  }}||v r|||<   |t        vs|||<    ||fS )zyHelper method that extracts common logic for getting options for
    COPY INTO TABLE and COPY INTO LOCATION command.
    rw   rr   )getitemsNON_FORMAT_TYPE_OPTIONS)r  r  file_format_type_optionscopy_optionskvs         r   _get_optionsr    sq      '{{+@"E;;~r2L ,1LO--*+$Q'	,
 $\11r   c                 "    t        | t              S )zqMethod that extracts options for COPY INTO TABLE command into file
    format type options and copy options.
    )r  COPY_INTO_TABLE_COPY_OPTIONSr  s    r   get_copy_into_table_optionsr  !  s     !=>>r   c                 "    t        | t              S )ztMethod that extracts options for COPY INTO LOCATION command into file
    format type options and copy options.
    )r  COPY_INTO_LOCATION_COPY_OPTIONSr  s    r   get_copy_into_location_optionsr  *  s     !@AAr   key	alias_mapc                     | j                         j                         }|j                  ||      }||k7  rt        j	                  d|  d| d       |S )zMethod that takes a key and an option alias map as arguments and returns
    the aliased key if the key is present in the alias map. Also raise a warning
    if alias key is applied.
    zOption 'z' is aliased to 'z`'. You may see unexpected behavior. Please refer to format specific options for more information)r   r  r  rs  rt  )r  r  	upper_keyaliased_keys       r   get_aliased_option_namer  3  s^     		!!#I--	95Kise,[M :L L	

 r   
table_namec                     | rt        |       dk  r| S | j                  dd      } | d   | d   cxk(  rdk(  rn n| dd S | S )z
    this function is used by method _table_exists to handle double quotes in table name when calling
    SHOW TABLES LIKE
    r   z""r  r   r  rN  )r  rP  )r  s    r   3strip_double_quotes_in_like_statement_in_table_namer   F  sT    
 Z1,
 ##D#.J  *!}
2E#E:aU:Ur   c                     t        |        t        |       }g }d}d}d}||k  rV| |   }|dk(  r!|r||dz
  k  r| |dz      dk(  r|dz  }n&d}n#d}n |dk(  r|s|j                  | ||        |dz   }|dz  }||k  rV|j                  | ||        |S )u{  
    This function implements the algorithm to parse a table name.

    We parse the table name according to the following rules:
    https://docs.snowflake.com/en/sql-reference/identifiers-syntax

    - Unquoted object identifiers:
        - Start with a letter (A-Z, a-z) or an underscore (“_”).
        - Contain only letters, underscores, decimal digits (0-9), and dollar signs (“$”).
        - Are stored and resolved as uppercase characters (e.g. id is stored and resolved as ID).

    - If you put double quotes around an identifier (e.g. “My identifier with blanks and punctuation.”),
        the following rules apply:
        - The case of the identifier is preserved when storing and resolving the identifier (e.g. "id" is
            stored and resolved as id).
        - The identifier can contain and start with ASCII, extended ASCII, and non-ASCII characters.
    Fr   r  rN  Tr$  )r  r  r'  )r  str_lenr  in_double_quotesr  cur_word_start_idxcur_chars          r   parse_table_namer  W  s    $ $*oG
C	A
g+a=s? w{?z!a%'8C'? FA (-$ $( _# 

:&8;<%&U" 	
Q7 g+: JJz,Q/0Jr   r  z^(".+")$z^([_A-Za-z]+[_A-Za-z0-9$]*)$	keep_casec                     t         j                  |       rt        |       S t        j                  |       r)|s't        t        | j                               z   t        z   S t        t        |       z   t        z   S r  )ALREADY_QUOTEDr  validate_quoted_nameUNQUOTED_CASE_INSENSITIVEDOUBLE_QUOTEescape_quotesr  )r  r  s     r   
quote_namer    s[    D!#D))	"	(	(	.ymDJJL99LHHmD11L@@r   c                     t         | dd j                  t         t         z   t              v rt        j                  |       | S )NrN  r  )r  rP  EMPTY_STRINGr&    PLAN_ANALYZER_INVALID_IDENTIFIERr  s    r   r
  r
    s8    tAbz)),*E|TT-NNtTTr   	unescapedc                 D    | j                  t        t        t        z         S r  )rP  r  )r  s    r   r  r    s    \<,+FGGr   r   c                 N    t        j                  d      j                  |       }|S )a  
    Splits the Snowflake identifier by dots that are not within double-quoted parts.
    Tokens that appear quoted in the input remain unchanged (quotes are kept).
    See details in https://docs.snowflake.com/en/sql-reference/identifiers-syntax.

    Examples:
      'foo.bar."hello.world".baz'
          -> ['foo', 'bar', '"hello.world"', 'baz']
      '"a.b".c."d.e.f".g'
          -> ['"a.b"', 'c', '"d.e.f"', 'g']
    z"(?:[^"]|"")*"|[^.]+)r  compiler  )r   partss     r   #split_snowflake_identifier_with_dotr    s#     JJ./77:ELr   zj[\u1100-\u115F\u2E80-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]c                 `    | yt        t        j                  |             }t        |       |z   S )z
    Calculate the half-width of a string by adding 1 for each character
    and adding an extra 1 for each full-width character.

    :param s: The input string
    :return: The calculated width
    r   )r  full_width_regexr  )r   full_width_counts     r   string_half_widthr    s3     	y+33A67q6$$$r   dfzsnowflake.snowpark.DataFramedf_name	pivot_colz4snowflake.snowpark._internal.type_utils.ColumnOrNamevaluesz3snowflake.snowpark._internal.type_utils.LiteralTypedefault_on_nullc                    ddl m} ||st        d      | j                  | d|      }ddlm}m} ddlm}	 t        |t              r.|D 
cg c]"  }
t        |
|	      r|
j                  n ||
      $ }}
nYt        ||      r ||j                        }nd}t        | j                  j                  dg             dkD  r| j!                         } | t        ||	      r|j                  n ||      }| |||fS c c}
w )	a  
    Prepare dataframe pivot arguments to use in the underlying pivot call.  This includes issuing any applicable
    warnings, ensuring column types and valid arguments.
    Returns:
        DateFrame, pivot column, pivot_values and default_on_null value.
    r   r   Nzvalues cannot be emptyz())r   ScalarSubqueryr  post_actions)snowflake.snowpark.dataframer   r	  _convert_cols_to_exprs0snowflake.snowpark._internal.analyzer.expressionr   r"  snowflake.snowpark.columnr  r  r   _expression_planr  queriesr  cache_result)r  r  r  r  r   r   pcr   r"  r  r  pivot_valuess               r   prepare_pivot_argumentsr/    s    $ 7&122		"	"gYb>9	=BX0&(#LR
GHZ62AMM
B
 
 fi()&,,7LLrzz~~nb12Q6"B" /62 '') 	 r<00'
s   'C8r  c                 ^    t        | t              r| j                         dvrt        d      y )N)r"  ARRAYBOTHz/mode must be one of ('OBJECT', 'ARRAY', 'BOTH'))r  r'  r  r	  )r  s    r   check_flatten_moder3    s,    dC DJJL8S$SJKK %Tr   colsc                  R   d}t        |       dk(  r>| d   } t        | t        t        f      s#t	        |j                  t        |                   t        |       dz  dk(  s#t	        |j                  t        |                   t        |       dk(  xr t        | t        t        f      S )z@Helper function to check parameter cols for create_map function.z[The 'create_map' function requires an even number of parameters but the actual number is {}rN  r   r   )r  r  r  r  r	  r  )r4  error_messages     r   check_create_map_parameterr7    s     rM 4yA~Aw$.]11#d)<==t9q=A--c$i899t9>=jt}==r   r  c                     ddl m} t        |       dk(  xr* t        | d   |t        f      xr t        | d   t              S )Nr   r#  r   rN  )snowflake.snowparkr  r  r  r'  )r  r  s     r   is_valid_tuple_for_aggr:  "  s8    )q6Q;T:adVSM:Tz!A$PS?TTr   exprszsnowflake.snowpark.Columnzsnowflake.snowpark.ColumnOrNamec                    ddl m} t        |  \  } }t        |       r| g} t	        |       dkD  rqt        | d   t              r^| d   j                         D ]G  \  }}t        |t              rt        |t              r't        dt        |      t        |      f        y| D ];  }t        ||      rt        |t        t        f      rt        |      r2t        d       y)zHHelper function to raise exceptions when invalid exprs have been passed.r   r#  zDictionary passed to DataFrame.agg() or RelationalGroupedDataFrame.agg() should contain only strings: got key-value pair with types zList passed to DataFrame.agg() or RelationalGroupedDataFrame.agg() should contain only Column objects, or pairs of Column object (or column name) and strings.N)r9  r  r  r:  r  r  dictr  r'  r  r  r  r  )r;  r  r  r  r  r  s         r   check_agg_exprsr>  (  s     *5u=HE1 e$
5zA~*U1Xt4!HNN$ 	DAqq#&:a+=RRVWXRY[_`a[bRbQce 	  	A1f%q4-05KA5Nk 	r   c                       e Zd ZdZdZy)MissingModinz8The class is specifically for modin optional dependency.modinN)r   r   r   rO  	_dep_namer   r   r   r@  r@  K  s
    BIr   r@  c                  l    	 t        j                  d      } | dfS # t        $ r t               dfcY S w xY w)zThis function tries importing the following packages: modin.pandas

    If available it returns modin package with a flag of whether it was imported.
    zmodin.pandasTF)r   r   r   r@  )rA  s    r   import_or_missing_modin_pandasrD  Q  s=    
%''7d{ %~u$$%s    33c                   &    e Zd ZddZd ZdefdZy)GlobalCounterr  Nc                 h    t        j                         | _        t        j                         | _        y r  )rq  r  _lock	itertoolsr	   _counterr_  s    r   rW  zGlobalCounter.__init__^  s    ^^%
$-OO$5r   c                 x    | j                   5  t        j                         | _        d d d        y # 1 sw Y   y xY wr  )rH  rI  r	   rJ  r_  s    r   resetzGlobalCounter.resetb  s,    ZZ 	.%OO-DM	. 	. 	.s   09c                 p    | j                   5  t        | j                        cd d d        S # 1 sw Y   y xY wr  )rH  nextrJ  r_  s    r   rN  zGlobalCounter.nextf  s*    ZZ 	'&	' 	' 	's   ,5r  )r   r   r   rW  rL  r   rN  r   r   r   rF  rF  ]  s    6.'c 'r   rF  global_counterc                        e Zd ZdZdeej                  ef   deeee	f   ef   f fdZ
def fdZddef fdZ fdZ fd	Zdee   f fd
Zd ZddZddZddZ xZS )ExprAliasUpdateDicta  
    A specialized dictionary for mapping expressions (UUID keys) to alias names updates tracking.
    This is used to resolve ambiguous column names in join operations.

    This dictionary is designed to store aliases as string values while also tracking whether
    each alias was inherited from child DataFrame plan.
    The values are stored as tuples of the form `(alias: str, updated_from_inherited: bool)`, where:

    - `alias` (str): The alias name for the expression.
    - `updated_from_inheritance` (bool): A flag indicating whether the expr alias was updated
     because it's inherited from child plan (True) or not (False).

    Below is an example for resolving alias mapping:

    data = [25, 30]
    columns = ["age"]
    df1 = session.createDataFrame(data, columns)
    df2 = session.createDataFrame(data, columns)
    df3 = df1.join(df2)
    # in DF3:
    #    df1.age expr_id -> (age_alias_left, False)  # comes from df1 due to being disambiguated in the join condition
    #    df2.age expr_id -> (age_alias_right, False)  # comes from df2 due to being disambiguated in the join condition

    df4 = df3.select(df1.age.alias("age"))

    # in DF4:
    #    df1.age.expr_id -> (age, False)  # comes from df3 explict alias
    #    df2.age.expr_id -> (age_alias_right, False)  # unchanged, inherited from df3
    df5 = df1.join(df4, df1["age"] == df4["age"])

    # in the middle of df1.join(df2) operation, we have the following expr_to_alias mapping:
    #  DF4 intermediate expr_to_alias:
    #    df4.age.expr_id -> (age_alias_right2, False)  # comes from df4 due to being disambiguated in the join condition, note here df4.age is not the same as df1.age, it's a new attribute
    #    df1.age.expr_id -> (age_alias_right2, True)  # comes from df4, updated due to inheritance
    #  DF1 intermediate expr_to_alias:
    #    df1.age.expr_id -> (age_alias_left2, False)  # comes from df1 due to being disambiguated in the join condition

    # when executing merge_multiple_snowflake_plan_expr_to_alias, we drop df1.age.expr_id -> (age_alias_right2, True)

    # in DF5:
    #    df4.age.expr_id -> (age_alias_right2, False)
    #    df1.age.expr_id -> (age_alias_left2, False)
    r  r  c                     t        |t              r|df}t        |t              r4t        |      dk(  r&t        |d   t              rt        |d   t              st        d      t        |   ||       y)zIf a string value is provided, it is automatically stored as `(value, False)`.
        If a tuple `(str, bool)` is provided, it must conform to the expected format.
        Fr   r   rN  z$Value must be a tuple of (str, bool)N)r  r'  r  r  r  r	  rK  __setitem__rM  r  r  rN  s      r   rS  zExprAliasUpdateDict.__setitem__  sd     eS!ENEue$E
a58S)58T*CDDC'r   r  c                 ,    t         |   |      }|d   S )zEReturns only the alias string (`str`), omitting the inheritance flag.r   )rK  __getitem__)rM  itemr  rN  s      r   rV  zExprAliasUpdateDict.__getitem__  s    #D)Qxr   c                 6    t         |   |d       }||d   S |S rV  rK  r  )rM  r  rL  r  rN  s       r   r  zExprAliasUpdateDict.get  s'    C&8Or   c                 4    t         |   |d      }||d   S y)z8Returns whether a key was inherited (`True` or `False`).NrN  FrY  rT  s      r   was_updated_due_to_inheritancez2ExprAliasUpdateDict.was_updated_due_to_inheritance  s%    C&8Or   c                 .    d t         |          D        S )z<Return (key, str) pairs instead of (key, (str, bool)) pairs.c              3   0   K   | ]  \  }}||d    f  ywr   Nr   )rd  r  r  s      r   rf  z,ExprAliasUpdateDict.items.<locals>.<genexpr>  s     BJCeAhBs   )rK  r  rM  rN  s    r   r  zExprAliasUpdateDict.items  s    B%'-/BBr   c                 .    d t         |          D        S )zCReturn only the string parts of the tuple in the dictionary values.c              3   &   K   | ]	  }|d      ywr^  r   )rd  r  s     r   rf  z-ExprAliasUpdateDict.values.<locals>.<genexpr>  s     7Ua7s   )rK  r  r_  s    r   r  zExprAliasUpdateDict.values  s    7egn&677r   c                 h    t        |t              sJ |D ]  }||   |j                  |      f| |<    y r  )r  rQ  r[  )rM  otherr  s      r   r  zExprAliasUpdateDict.update  sA    %!4555 	JAQx!E!Ea!HIDG	Jr   c                 "    | j                         S )zTReturn a shallow copy of the dictionary, preserving the (str, bool) tuple structure.__copy__r_  s    r   copyzExprAliasUpdateDict.copy      }}r   c                 <    t               }|j                  |        |S )z+Shallow copy implementation for copy.copy())rQ  r  )rM  new_copys     r   rf  zExprAliasUpdateDict.__copy__  s    &(r   c                 "    | j                         S )z,Deep copy implementation for copy.deepcopy()re  )rM  memos     r   __deepcopy__z ExprAliasUpdateDict.__deepcopy__  rh  r   r  )r  rQ  )r   r   r   rO  r   uuidUUIDr'  r   r  rS  rV  r  r[  r  r   r  r  rg  rf  rm  rP  rQ  s   @r   rQ  rQ  n  s    *X(C((16uS$Y7G7L1M($3 
 C8 8J
r   rQ  snowflake_plansr)   c           
      j   | D cg c]  }|j                    }}t               } t               j                  | }i }|D ]O  }t	        |D ch c]  }||v r||   |j                  |      f c}      }t        |      dk(  r	|d   ||<   K|||<   Q |s|S |D ]	  }t               }	| D ]  }g }
|j                  #|j                  D cg c]  }|j                   }
}|j                   |   |j                   j                  |      }}||
vs|ret        |	      dk(  r2t        t        |	            \  }}||k(  r|xr |}|	j                          |	j                  ||f        t        |	      dk(  r|	j                         ||<   t        j                  d| d||            |S c c}w c c}w c c}w )a  
    Merges expression-to-alias mappings from multiple Snowflake plans, resolving conflicts where possible.
    The conflict resolution strategy is as follows:

    1) If they map to the same alias:
        * Retain the expression in the final expr_to_alias map.
    2) If they map to different aliases:
        a) If one appears in the output attributes of the plan and the other does not:
            * Retain the one present in the output attributes and discard the other. This is because
            I. The one that shows up in the output attribute can be referenced by users to perform dataframe column operations.
            II. The one that does not show up in the output is an intermediate alias mapping and can not be referenced directly by users.
        b) If both appear in the output attributes:
            * Discard both expressions as this constitutes a valid ambiguous case that cannot be resolved.
    3) If neither appears in the output attributes:
        * Discard both expressions since they will no longer be referenced.

    taking our example from the class docstring, the conflicting df1.age in df5:
    #    df1.age -> (age_alias_right2, True)  # comes from df4, updated due to inheritance
    #    df1.age -> (age_alias_left2, False)  # comes from df1 due to being disambiguated in the join condition

    we are going to:
    DROP: df1.age -> (age_alias_right2, True) because it's not directly in the output and can not be referenced
    KEEP: df1.age -> (age_alias_left2, False) is going to be kept because it's directly in the output and can be referenced

    Args:
        snowflake_plans (List[SnowflakePlan]): List of SnowflakePlan objects.

    Returns:
        Dict[Any, str]: Merged expression-to-alias mapping.
    rN  r   zExpression 'zz' is associated with multiple aliases across different plans. Unable to determine which alias to use. Conflicting values: )expr_to_aliasrQ  r  unionr  r[  r  schema_queryoutputr  rN  iterpopaddrs  r  )rp  planall_expr_to_alias_dictsmerged_dictall_expr_idsconflicted_expr_idsexpr_idr   r  expr_id_alias_candidatesoutput_columnsr:   tmp_alias_nametmp_updated_due_to_inheritancecandidate_name$candidate_updated_due_to_inheritances                   r   +merge_multiple_snowflake_plan_expr_to_aliasr    s(   F ?NNdt11NN &'K 35;; 78L 2 1a< 7Q==gFG
 v;!#)!9K +1(2 & &#&5 # 	DN  ,8<!D$))!D!D=A=O=O>!!@@I ;N ^37U +,1GK12HD D "^3
 = ;: 3 -002$((!?@3	: '(A-#;#?#?#AK  MMwi (OObcjOkNlnG&P G O( "Es   F&!F+
F0c                 @    t        t        j                  d|             S )zSReturn True if ver contains alphabet, e.g., 1a1; otherwise, return False, e.g., 112z[a-zA-Z])r  r  search)vers    r   str_contains_alphabetr  D  s    		*c*++r   c                 D    t        d | j                  d      D              S )zGenerate a key to sort versions. Note if a version component is not a number, e.g., "1a1", we will treat it as -1. E.g., 1.11.1a1 will be treated as 1.11.-1c              3   L   K   | ]  }t        |      rd n
t        |        yw)r  N)r  r   )rd  nums     r   rf  z-get_sorted_key_for_version.<locals>.<genexpr>K  s&      ;>#C(c#h6s   "$r$  )r  r  )version_strs    r   get_sorted_key_for_versionr  I  s(     BMBSBSTWBX  r   ttl_secondsc                       fd}|S )a  
    A decorator that caches function results with a time-to-live (TTL) expiration.
    The decorator expects the first argument to be the ttl_key which should be hashable.

    Args:
        ttl_seconds (float): Time-to-live in seconds for cached items
    c                      i g t        j                         dt        ffdfd}t                fd       }|_        ||_        |S )Ncurrent_timec                 f    r.d   \  }}|| k\  ryt        j                         |v r|= r-yy)z+Remove expired entries from cache and heap.r   N)heapqheappop)r  expiry_time	cache_keycacheexpiry_heaps      r   _cleanup_expiredz6ttl_cache.<locals>.decorator.<locals>._cleanup_expired^  sB     )4Q&Y,.k*%i( r   c                  t    5   j                          j                          d d d        y # 1 sw Y   y xY wr  )clear)r  
cache_lockr  s   r   _clear_cachez2ttl_cache.<locals>.decorator.<locals>._clear_cachei  s0     $!!#$ $ $s   !.7c                    t        |       }t        j                         }	5   |       |v r|   cd d d        S  | g|i |}||<   |z   }t        j                  
||f       |cd d d        S # 1 sw Y   y xY wr  )r  rH  r  heappush)hashable_ttl_keyri  rj  r  r  resultr  r  r  r  r  r  r  s          r   r  z-ttl_cache.<locals>.decorator.<locals>.wrappern  s    -.I99;L  .% +	  .@@@#)i *[8{[),DE  s   A7/A77B )rq  rv  r   r   _cacheclear_cache)r  r  r  r  r  r  r  r  s   `  @@@@r   	decoratorzttl_cache.<locals>.decoratorY  s]    __&
		)5 		)	$
 
t	 	 
	& *r   r   )r  r  s   ` r   	ttl_cacher  P  s    ,\ r   	sql_queryuuidsc                     ddl m} |D ch c]  }|j                  |d       c}dj                  fd| j	                  d      D              S c c}w )z7Removes comments associated with child uuids in a queryr   analyzer_utilsFwith_new_liner  c              3   4   K   | ]  }|vr	|d k7  r|  yw)r  Nr   )rd  linecomment_placeholderss     r   rf  z"remove_comments.<locals>.<genexpr>  s(      ++
 	s   )%snowflake.snowpark._internal.analyzerr  format_uuidr%  r  )r  r  r  rn  r  s       @r   remove_commentsr    s^    D KPBF""4u"= 99 OOD)  s   Ac                       e Zd ZU dZeed<   dZee   ed<   dZee	   ed<   dZ
ee   ed<   dZee   ed<   dZee   ed<   e	 	 	 	 	 	 ddeed	      dee   dee	   deeeej                   f      deeed
f      dee   ded    fd       ZdefdZy)TimeTravelConfigz)Configuration for time travel operations.time_travel_modeN	statementoffset	timestamptimestamp_typestreamatbeforer-   r  c                     t        d ||||fD              }| |dk(  ryt        d      | j                         dvrt        d|  d      |dk7  rt        d	      d}|Ct        |      j	                         }t        |t        j                        r|j                  |d
}|[t        |d      r,|j                  dk7  r|j                  j                         nd}n|j                         }|dvrt        d| d      t        | |||||      S )u  
        Validates and normalizes time travel parameters.

        timestamp_type handling:
            - datetime with timezone + timestamp_type NOT provided → auto-sets to 'TZ'
            - datetime with timezone + timestamp_type explicitly provided → uses provided timestamp_type
            - datetime without timezone (naive) + timestamp_type NOT provided → no casting, raw string (timestamp_type=None)
            - datetime without timezone (naive) + timestamp_type explicitly provided → uses provided timestamp_type
            - string timestamps + timestamp_type NOT provided → no casting, raw string (timestamp_type=None, Snowflake native handling)
            - string timestamps + timestamp_type explicitly provided → uses TO_TIMESTAMP_XXX casting

        This behavior preserves timezone information for datetime objects, provides sensible defaults
        for naive datetime objects, and lets Snowflake handle string timestamp formats natively unless
        explicit casting is requested.

        Returns:
            TimeTravelConfig if time travel is specified, None otherwise.
        Raises:
            ValueError: If parameters are invalid.
        c              3   $   K   | ]  }|d u 
 y wr  r   )rd  args     r   rf  zATimeTravelConfig.validate_and_normalize_params.<locals>.<genexpr>  s      $
 #CtO$
s   Nr   z^Must specify time travel mode 'at' or 'before' if any other time travel parameter is provided.r  zInvalid time travel mode: z. Must be 'at' or 'before'.rN  zPExactly one of 'statement', 'offset', 'timestamp', or 'stream' must be provided.TZr  rL  NTZ)r  LTZr  z'timestamp_type' value z. must be None or one of 'NTZ', 'LTZ', or 'TZ'.)r  r  r  r  r  r  )sumr	  r  r'  r   r  rF  tzinfor2  r  r  r  )r  r  r  r  r  r  time_travel_arg_countnormalized_timestamps           r   validate_and_normalize_paramsz.TimeTravelConfig.validate_and_normalize_params  sl   : !$ $
(169f'M$
 !

 #$) t  !!#+;;,-=,>>YZ 
 !A%b 
  $ #&y>#7#7#9 )X%6%67##/N4J%)N %~w/ &++y8 #((..0  "0!5!5!7%99 -n-==kl   -*)
 	
r   c                    d| j                   j                          d}| j                  |d| j                   dz  }|S | j                  |d| j                   dz  }|S | j                  |d| j                   dz  }|S | j
                  k| j                  L| j                  j                         }|dk(  rd}n|d	k(  rd
}n
|dk(  rd}nd}|d| d| j
                   dz  }|S |d| j
                   dz  }|S )z
        Generates the time travel SQL clause.
        Args:
            config: Time travel configuration.
        Returns:
            SQL clause like " AT (TIMESTAMP => TO_TIMESTAMP_NTZ('...'))"
        r  z(STATEMENT => 'z')z(OFFSET => r4   z(STREAM => 'r  TO_TIMESTAMP_NTZr  TO_TIMESTAMP_LTZr  TO_TIMESTAMP_TZTO_TIMESTAMPz(TIMESTAMP => z('z'))z(TIMESTAMP => ')r  r  r  r  r  r  r  )rM  clauser  	func_names       r   generate_sql_clausez$TimeTravelConfig.generate_sql_clause  s;    T**002315>>%'7r::F( ' [[$DKK=22F$ # [[$T[[M44F   ^^'"".!%!4!4!:!:!<!U* 2I#u, 2I#t+ 1I .IN9+R7GsKK  ODNN+;2>>r   )NNNNNN)r   r   r   rO  r'  __annotations__r  r   r  r   r  r  r  staticmethodr   r   rF  r  r  r   r   r   r  r    s   3#Ix}# FHSM #Ix}#$(NHSM( FHSM >B#' $=ADH $S
"7>#:;S
C=S
 S
 E#x'8'8"89:	S

 !s,?'?!@AS
 S
 
$	%S
 S
jS r   r  commented_sql_querychild_uuidsparent_uuidr*   c                 2   ddl m} ddlm} | j	                  d      }|D ci c]  }|j                  |d      | }}d}g }	d}
d}d}|D ]C  }||v r2|r#|r!|	j                   ||
|d	z
  |             d}d},|r/d
}|}
||   }9|dk7  s?|d	z  }E d}g }|	D ]W  }||j                  k  r&|j                   |||j                  d	z
  |             |j                  |       |j                  d	z   }Y ||k  r|j                   |||d	z
  |             |S c c}w )aa  
        Helper function to get line numbers associated with child uuids in a query
        The commented_sql_query is a sql query with comments associated with child uuids. For example, it may look like:
        ```
        SELECT col1
        FROM
    -- child-uuid-1:
    table1
    -- child-uuid-1:
    WHERE col1 > 0
    -- child-uuid-2:
    ORDER BY col1
    -- child-uuid-2:
        ```
        For this query, we want to return a list of QueryLineInterval objects with the following intervals:
        - (0, 1, "parent-uuid")
        - (2, 2, "child-uuid-1")
        - (3, 3, "parent-uuid")
        - (4, 4, "child-uuid-2")

        To do so, we split the commented_sql_query into lines and check for comments associated with child uuids. We find all
        intervals associated with child uuids and associate the remaining lines with the parent uuid.
    r   )r*   r  r  Fr  r  NrN  Tr  )	4snowflake.snowpark._internal.analyzer.snowflake_planr*   r  r  r  r  r'  startend)r  r  r  r*   r  	sql_linesrn  r  idxchild_intervalschild_startfound_startcurrent_child_uuidr  current_posnew_intervalsintervals                    r   get_line_numbersr    sx   8 WD#))$/I   	""4u"=tC 
 COKK ''1&&%k37<NO $%)" "!%9$%?"RZ1HC KM# ''  !+x~~/A;O 	X&llQ&' S.{C!G[QRQs   Dtemplateplaceholder_to_columnr  c                    ddl m} t        t              rt	        t        j                  d|             }t	        j                               }||z
  }|rt        d|       g i dddt        ffd}t        j                  d||       }D 	cg c]  }	|	   	 }
}	 ||g|
d	|iS t        t              rt        j                  d
|       }t        t	        |            }t              }|dk(  r4dj                  t        |      D cg c]  }d| d
 c}      }|  d| } n;||k7  r6t        d| d| ddj                  t        t	        |                   d       || gd	|iS t!        d      c c}	w c c}w )a  
    Creates a prompt Column object from a template string with placeholders.

    Args:
        template: A string containing placeholders (either named like {name} or positional like {0})
        placeholder_to_column: Either:
            - A dict mapping placeholder names to Column objects
            - A list of Column objects for positional placeholders
        _emit_ast: Whether to emit AST

    Returns:
        A prompt Column object
    r   )promptz\{([^{}]+)\}zNThe following column placeholders were provided but not used in the template: r  zre.Match[str]r  c           	          | j                  d      }|vr(t        d| dt        j                                      |vrt	              |<   j                  |       dt        |         z   dz   S )NrN  zPlaceholder '{zF}' in template not found in provided columns. Available placeholders: {})groupr	  r  keysr  r'  r'  )r  placeholder_nameplaceholder_positionsr  seen_placeholderss     r   replace_placeholderz?create_prompt_column_from_template.<locals>.replace_placeholder  s    ${{1~'<< %&6%7 8//34I4N4N4P/Q.RT   '<<:=>O:P%&67!(()9:23CDEEKKr   r  z	\{(\d+)\}r  r  r  z#Number of positional placeholders (z-) does not match number of columns provided (z). Found placeholders: {r  z^placeholder_to_column must be a list of Columns or a dict mapping placeholder names to Columns)snowflake.snowpark.functionsr  r  r=  r  r  r  r  r	  r'  r  r  r  r%  r  r  r  )r  r  r  r  named_placeholdersprovided_keysunused_columnsr  rewritten_templater  ordered_columnspositional_placeholdersnum_placeholdersnum_columnsr  placeholders_to_addr  r  s    `              @@r   "create_prompt_column_from_templater  e  s   ( 4'. !OX!FG16689&);;`ao`pq 
  "	L 	L3 	L   VVO5H(S DUU406UU (P?PiPP	)4	0 #%**\8"D'(
 /0q "%((k@R+S1b2J+S"T"1%8$9:H,56F5G H//:m <))-6#>U:V3W)X(YY[]  hL!6L)LL l
 	
= V  ,Ts   F F	plan_node)r)   r,   line_numberc                 $   ddl m} d }| |dfg}|r|j                         \  }}}t        ||      r|j	                  d      }|j
                  |j
                  }|j                  d   j                  } |||      }|dk\  rn||   j                  }	|j                  |	k(  r	||_        |S |j                  D ]7  }
|
j                  |	k(  s|j                  |
|||   j                  z
  |f        n nt        d| d	      |rt        d| d	      )
aX  
    Given a parent plan node and a line number, return the plan node that contains the line number.
    Each parent node has a list of disjoint query line intervals, which are sorted by start line number,
    and each interval is associated with a plan node uuid. Each node either knows it is responsible for
    the lines in the interval if its uuid is the same as the interval's uuid, or that one of its descendants
    is responsible otherwise. If we find that the descendant is responsible, then we subtract the offset created
    by the parent before recursively searching the child. For example, if the parent is responsible for lines 0-10 and
    its descendants are responsible for lines 11-20 and we are searching for line 15, we will search the child for line 4.
    We raise ValueError if the line number does not fall within any interval.
    r   r+   c                     dt        |       dz
  }}||k  rJ||z   dz  }| |   j                  | |   j                  }}||cxk  r|k  r|S  ||k  r|dz
  }n|dz   }||k  rJy)Nr   rN  r   r  )r  r  r  )	intervalsr  leftrightmidr  r  s          r   find_interval_containing_linezAget_plan_from_line_numbers.<locals>.find_interval_containing_line  s    Y!+eem%<A%C"3--y~/A/A3E*s*
 +u$aQw em r   NF)skip_schema_queryr  zLine number z" does not fall within any interval)6snowflake.snowpark._internal.analyzer.select_statementr,   rw  r  get_snowflake_plan
df_ast_idsr+  query_line_intervalsrn  children_plan_nodesr'  r  r	  )r  r  r,   r  r  noder	  r
  r  rn  childs              r   get_plan_from_line_numbersr    s=    R d+,E
(-		%k:dJ'**U*CD??&J#||B/DD+,@+N!8',11DyyD ",!55 	EzzT) % +.B3.G.M.M M * 	 {m+MN 3 : |K=0RS
TTr   c               #   L    K   t               x  fd t                yw)zW
    A simple context manager that measures the time taken to execute a code block
    c                       z
  S r  r   end_time
start_times   r   r%  zmeasure_time.<locals>.<lambda>	  s    (Z' r   Nr   r  s   @@r   measure_timer  	  s"     
 )N*J
''~Hs    $)NFT)i    TNsha256F)r   )NNr   F)
   )NT)rN  )r  )F)T(  r   
contextlibrF  rD  r  r  r  r   r  rI  loggingr  r,  r  r  r   r3  rH  rq  r  rn  r  enumr   r   r   r   r   r   r	   jsonr
   r   r   typingr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r9  r  snowflake.connector.constantsr   snowflake.connector.cursorr   r    snowflake.connector.descriptionr!   r"   r   r#   r$   snowflake.connector.versionr%   r9  *snowflake.snowpark._internal.error_messager&   snowflake.snowpark.rowr(   snowflake.snowpark.versionr&  r  r)   r*   r  r,   r  r-   r.   r   	getLoggerrs  r  SNOWURL_PREFIXRELATIVE_PATH_PREFIXSNOWFLAKE_PATH_PREFIXESrh  r  SNOWFLAKE_UNQUOTED_ID_PATTERNSNOWFLAKE_QUOTED_ID_PATTERNSNOWFLAKE_ID_PATTERN,SNOWFLAKE_CASE_INSENSITIVE_QUOTED_ID_PATTERN2SNOWFLAKE_CASE_INSENSITIVE_UNQUOTED_SUFFIX_PATTERNr  r  rG  rK  r  r  digitsascii_lowercaser  
IGNORECASErY  rZ  PACKAGE_NAME_TO_MODULE_NAME_MAPr  MODULE_NAME_TO_PACKAGE_NAME_MAPr  INFER_SCHEMA_FORMAT_TYPESr  r  r  XML_ROW_TAG_STRINGXML_ROW_DATA_COLUMN_NAMEr\  r%  r  __file__XML_READER_FILE_PATHXML_READER_API_SIGNATUREXML_READER_SQL_COMMENTXPATH_HANDLER_MAPXPATH_HANDLERS_FILE_PATHr  SKIP_LEVELS_TWOSKIP_LEVELS_THREEr  r  SUPPORTED_TABLE_TYPESr   r   r  r  r   DATETIME_PART_TO_ALIASESr  r  DATETIME_PARTSr  r  r  r'  r   r  r  r!  r)  r.  r  r7  r:  r=  r@  rE  rI  rL  rS  rV  r[  rk  rn  ru  ry  r|  r  r  r  r  r  contextmanagerrA  r  r  r  r  r  r  r  r  r  r  r	  r  r  r  r  r-  r;  r=  r?  rS  rZ  r  rt  r]  ro  rr  rt  rv  rw  ry  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  DOTALLr	  r  r  r
  r  r  r  r  r  r/  r3  r7  r:  r>  r@  rD  rF  rO  r=  rQ  r  r  r  r   r  r  r  r  r  r  r  )r  r  ls   000r   <module>rB     s           	   	   	  
      , , &        &  : F F S D V & B R:*? '

0
1   #:= # 
   !< 4 %&a(C'DAF  0Q ,5O 2 )bjj	
	}-A,B(K_J``ab  3="**03 / 9C

69 5
 "%%9$:!<  + }}v555 '1bjjr}}' #
 )3

&) %#v#_# V# 	#
 .# =# 2# G# f# .# x# )# &# U# #  w!#" z##$ (,62,5# < 5::<#QAqD#  9 E 
  #  "  % ww||BGGOOH$=O 8 89Q8RRUV  #$&"  77<<(ACVW       , :  
	!&*CDD T $!
D!:! 5! :	!
 
3! 5! =! 7! @! @!  	!* 6+!, H-!. 6/!0 I1!2 <.3!4 o&5!6 ?-/CD-/CD+-@A%u-)51A! F -2245-335 Qq:;AqD  /4467 KC E#s(O Ps P

C 
C 
 IS I I %C % % U U U Js J J S   c  73 74 7W# W$ W  c c )     &  
S 
T 
0s 0s 0/s /s /(S (U38_ ('S 'S 'c c PC PC P$s $
  #'%)	<
<3-< < #	<
 Y< <~3 4 !C !E$*<M !#&#
# # 	#2 %)%)!D!
D!D! #D! c]	D!
 D! D! 	D!N
s 
T
 
 
 
CC C C 26.2$	tCH~.&sm  	
 
#s(^( <A!!48!
38_!H8 8 8 d^ d dI Ic I	tN+T2D-EEF
8DIh 889@ TXS	%^ 4d;M6N NOP  
#Y	2 37$~./  c]	(*; *   *,d3%& +%# %S % %T % "	 	!%
9??,,-!%
9??J&' g   G  * >G > >"m m` "
I # 1- 1$ 14 1* Kx0	I ) 6NO  	
  4NO  	, 022),EH 022),EHs x  022),EHd $ SV  GI
d5eCHo!5678
@C
	
2
hsm%::
 
	
02#s(^2.1#h2
4S>4S>)*2 ?#s(^?
4S>4S>)*?B#s(^B
4S>4S>)*B	CH~ 	&VC VC V"8 8c 8v J		2&BJJ'EF AS AT Ac As s HS HS H3 4 $ 2::	 % % %01&0101 F01 JK*,	
	01 ST01fLS LT L
>c >d >"UeD%K0 UT U #/45S#X	 F, 	%.>.D(E 	%' ' !. /j$ jZf/*ffR,
75 7ts 49  z DHHcH H 

	H` X
X
 S--.5P0QQX

 X
 !X
v>U23>U>U >UB hr5y)  sE  *)*x#ds   ;f= %gg=gg