
    dh                    b    S SK Jr  S SKJrJrJrJr  S SKJr  S SK	J
r
  S SKJr   " S S\
5      rg)	    )annotations)AnyIteratorOptionalSequence)Document)
BaseLoader)MaxComputeAPIWrapperc                  |    \ rS rSrSrSSS.       S
S jjr\SSS.             SS jj5       rSS jrS	r	g)MaxComputeLoader   z+Load from `Alibaba Cloud MaxCompute` table.N)page_content_columnsmetadata_columnsc               4    Xl         X l        X0l        X@l        g)a  Initialize Alibaba Cloud MaxCompute document loader.

Args:
    query: SQL query to execute.
    api_wrapper: MaxCompute API wrapper.
    page_content_columns: The columns to write into the `page_content` of the
        Document. If unspecified, all columns will be written to `page_content`.
    metadata_columns: The columns to write into the `metadata` of the Document.
        If unspecified, all columns not added to `page_content` will be written.
N)queryapi_wrapperr   r   )selfr   r   r   r   s        h/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/document_loaders/max_compute.py__init__MaxComputeLoader.__init__   s    $ 
&$8! 0    	access_idsecret_access_keyc               >    [         R                  " X#XES9nU " X40 UD6$ )a>  Convenience constructor that builds the MaxCompute API wrapper from
    given parameters.

Args:
    query: SQL query to execute.
    endpoint: MaxCompute endpoint.
    project: A project is a basic organizational unit of MaxCompute, which is
        similar to a database.
    access_id: MaxCompute access ID. Should be passed in directly or set as the
        environment variable `MAX_COMPUTE_ACCESS_ID`.
    secret_access_key: MaxCompute secret access key. Should be passed in
        directly or set as the environment variable
        `MAX_COMPUTE_SECRET_ACCESS_KEY`.
r   )r
   from_params)clsr   endpointprojectr   r   kwargsr   s           r   r   MaxComputeLoader.from_params%   s+    2 +66
 5000r   c              #  Z  #    U R                   R                  U R                  5       H  nU R                  (       a5  UR                  5        VVs0 sH  u  p#X R                  ;   d  M  X#_M     nnnOUnSR	                  S UR                  5        5       5      nU R
                  (       a5  UR                  5        VVs0 sH  u  p#X R
                  ;   d  M  X#_M     nnnO*UR                  5        VVs0 sH  u  p#X$;  d  M  X#_M     nnn[        XVS9v   M     g s  snnf s  snnf s  snnf 7f)N
c              3  2   #    U H  u  pU S U 3v   M     g7f)z: N ).0kvs      r   	<genexpr>-MaxComputeLoader.lazy_load.<locals>.<genexpr>K   s     $W=VTQs"QC[=Vs   )page_contentmetadata)r   r   r   itemsjoinr   r   )r   rowr'   r(   page_content_datar+   r,   s          r   	lazy_loadMaxComputeLoader.lazy_loadC   s     ##))$**5C((%(YY[%%0TQA9R9R4RDAD[ " %! %(!99$W=N=T=T=V$WWL$$-0YY[W[TQAAVAV<VDAD[W-0YY[W[TQA<VDAD[WHH 6% XWs=   AD+D'D-AD+=DDD+2
D% D%%D+)r   r   r   r   )r   strr   r
   r   Optional[Sequence[str]]r   r4   )r   r3   r   r3   r   r3   r   Optional[str]r   r5   r    r   returnr   )r6   zIterator[Document])
__name__
__module____qualname____firstlineno____doc__r   classmethodr   r1   __static_attributes__r%   r   r   r   r      s    5 9=4811 *1
 61 21.  $(+/11 1 	1 !1 )1 1 
1 1:Ir   r   N)
__future__r   typingr   r   r   r   langchain_core.documentsr   )langchain_community.document_loaders.baser	   )langchain_community.utilities.max_computer
   r   r%   r   r   <module>rC      s'    " 4 4 - @ JEIz EIr   