
    dh
                        S SK Jr  S SKJrJrJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJr  \(       a  S SKJr  \" SS	S
S9 " S S\5      5       rg)    )annotations)TYPE_CHECKINGListOptional)
deprecated)Document)
BaseLoader)get_client_info)Credentialsz0.0.32z1.0z)langchain_google_community.BigQueryLoader)sinceremovalalternative_importc                  J    \ rS rSrSr    S         SS jjrS	S jrSrg)
BigQueryLoader   aT  Load from the Google Cloud Platform `BigQuery`.

Each document represents one row of the result. The `page_content_columns`
are written into the `page_content` of the document. The `metadata_columns`
are written into the `metadata` of the document. By default, all columns
are written into the `page_content` and none into the `metadata`.

Nc                @    Xl         X l        X0l        X@l        XPl        g)a  Initialize BigQuery document loader.

Args:
    query: The query to run in BigQuery.
    project: Optional. The project to run the query in.
    page_content_columns: Optional. The columns to write into the `page_content`
        of the document.
    metadata_columns: Optional. The columns to write into the `metadata` of the
        document.
    credentials : google.auth.credentials.Credentials, optional
      Credentials for accessing Google APIs. Use this parameter to override
        default credentials, such as to use Compute Engine
        (`google.auth.compute_engine.Credentials`) or Service Account
        (`google.oauth2.service_account.Credentials`) credentials directly.
N)queryprojectpage_content_columnsmetadata_columnscredentials)selfr   r   r   r   r   s         e/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/document_loaders/bigquery.py__init__BigQueryLoader.__init__   s     . 
$8! 0&    c                  ^  SSK Jn  UR                  U R                  U R
                  [        SS9S9nUR
                  (       d  Sn[        U5      eUR                  U R                  5      R                  5       n/ nU R                  mU R                  nTc%  UR                   Vs/ sH  oR                  PM     snmUc  / nU Hp  n	SR                  U4S	 jU	R                  5        5       5      n
U	R                  5        VVs0 sH  u  pX;   d  M  X_M     nnn[!        XS
9nUR#                  U5        Mr     U$ ! [         a  n[        S5      UeS nAff = fs  snf s  snnf )Nr   )bigqueryzrCould not import google-cloud-bigquery python package. Please install it with `pip install google-cloud-bigquery`.r   )module)r   r   client_infozGCP project for Big Query is not set! Either provide a `project` argument during BigQueryLoader instantiation, or set a default project with `gcloud config set project` command.
c              3  D   >#    U H  u  pUT;   d  M  U S U 3v   M     g7f)z: N ).0kvr   s      r   	<genexpr>&BigQueryLoader.load.<locals>.<genexpr>]   s*      %(3q<P7P1#Rss     )page_contentmetadata)google.cloudr   ImportErrorClientr   r   r
   
ValueErrorr   resultr   r   schemanamejoinitemsr   append)r   r   ex	bq_client
error_descquery_resultdocsr   columnrowr)   r%   r&   r*   docr   s                  @r   loadBigQueryLoader.load;   sh   	- OO((LL'z: $ 
	
     Z(( tzz299;!#8800'>J>Q>Q#R>QFKK>Q#R #!C99 %(+		% L *-N8MHNHCKK   M  	N 	4 $S Os)   D; 'E
EE;
EEE)r   r   r   r   r   )NNNN)
r   strr   zOptional[str]r   Optional[List[str]]r   r@   r   zOptional[Credentials])returnzList[Document])__name__
__module____qualname____firstlineno____doc__r   r=   __static_attributes__r#   r   r   r   r      sO     "&4804-1'' ' 2	'
 .' +':)r   r   N)
__future__r   typingr   r   r   langchain_core._api.deprecationr   langchain_core.documentsr   )langchain_community.document_loaders.baser	   &langchain_community.utilities.vertexair
   google.auth.credentialsr   r   r#   r   r   <module>rO      sL    " 0 0 6 - @ B3 
B
PZ P
Pr   