
    ci                     d    d dl Z d dlmZ d dlmZ d dlZ e j                  e      Z	 G d d      Z
y)    N)bigquery)BaseApiClientc                   @    e Zd ZdZdefdZdeddfdZddd	edd
fdZy
)BigQueryUtilszHandles BigQuery operations.
api_clientc                     || _         t        j                  | j                   j                  | j                   j                        | _        y )N)projectcredentials)r   r   Clientr	   _credentialsbigquery_client)selfr   s     F/tmp/pip-target-z3e9_cxr/lib/python/vertexai/_genai/_bigquery_utils.py__init__zBigQueryUtils.__init__   s4    $'OO++44 
    	table_urireturnzpd.DataFramec                     | j                   j                  |      }| j                   j                  |      j                         S )z2Loads data from a BigQuery table into a DataFrame.)r   	get_table	list_rowsto_dataframe)r   r   tables      r   load_bigquery_to_dataframez(BigQueryUtils.load_bigquery_to_dataframe$   s8    $$..y9##--e4AACCr   dfbq_table_uriNc                     | j                   j                  ||      }|j                          t        j	                  d|        y)z/Uploads a Pandas DataFrame to a BigQuery table.z3DataFrame successfully uploaded to BigQuery table: N)r   load_table_from_dataframeresultloggerinfo)r   r   r   jobs       r   upload_dataframe_to_bigqueryz*BigQueryUtils.upload_dataframe_to_bigquery)   s;     ""<<RN

A,P	
r   )	__name__
__module____qualname____doc__r   r   strr   r"    r   r   r   r      sD    &
= 
DC DN D

 
03
	
r   r   )logginggoogle.cloudr   google.genai._api_clientr   pandaspd	getLoggerr#   r   r   r(   r   r   <module>r/      s1      ! 2  
		8	$
 
r   