§
    Ò! h¯$  ã                  ó¢   — d Z ddlmZ ddlmZmZ ddlZddlmZ ddl	m
Z
 er
ddlZddlmZ d„ Z	 	 	 	 	 	 	 	 	 	 	 	 d-d.d"„Z	 	 	 	 	 	 	 	 	 d/d0d,„ZdS )1z Google BigQuery support é    )Úannotations)ÚTYPE_CHECKINGÚAnyN©Úimport_optional_dependency)Úfind_stack_level)Ú	DataFramec                 ó,   — d} t          d| ¬¦  «        }|S )Nzjpandas-gbq is required to load data from Google BigQuery. See the docs: https://pandas-gbq.readthedocs.io.Ú
pandas_gbq)Úextrar   )Úmsgr   s     úGc:\xampp_lite_8_4\www\timesheet\venv\Lib\site-packages\pandas/io/gbq.pyÚ_try_importr      s&   € ð	;ð õ ,¨LÀÐDÑDÔD€JØÐó    FTÚqueryÚstrÚ
project_idú
str | NoneÚ	index_colÚ	col_orderúlist[str] | NoneÚreauthÚboolÚauth_local_webserverÚdialectÚlocationÚconfigurationúdict[str, Any] | NoneÚcredentialsú*google.auth.credentials.Credentials | NoneÚuse_bqstorage_apiúbool | NoneÚmax_resultsú
int | NoneÚprogress_bar_typeÚreturnr	   c                óÈ   — t          j        dt          t          ¦   «         ¬¦  «         t	          ¦   «         }i }|
�|
|d<   |�||d<   ||d<    |j        | f|||||||||	dœ	|¤ŽS )a�  
    Load data from Google BigQuery.

    .. deprecated:: 2.2.0

       Please use ``pandas_gbq.read_gbq`` instead.

    This function requires the `pandas-gbq package
    <https://pandas-gbq.readthedocs.io>`__.

    See the `How to authenticate with Google BigQuery
    <https://pandas-gbq.readthedocs.io/en/latest/howto/authentication.html>`__
    guide for authentication instructions.

    Parameters
    ----------
    query : str
        SQL-Like Query to return data values.
    project_id : str, optional
        Google BigQuery Account project ID. Optional when available from
        the environment.
    index_col : str, optional
        Name of result column to use for index in results DataFrame.
    col_order : list(str), optional
        List of BigQuery column names in the desired order for results
        DataFrame.
    reauth : bool, default False
        Force Google BigQuery to re-authenticate the user. This is useful
        if multiple accounts are used.
    auth_local_webserver : bool, default True
        Use the `local webserver flow`_ instead of the `console flow`_
        when getting user credentials.

        .. _local webserver flow:
            https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server
        .. _console flow:
            https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console

        *New in version 0.2.0 of pandas-gbq*.

        .. versionchanged:: 1.5.0
           Default value is changed to ``True``. Google has deprecated the
           ``auth_local_webserver = False`` `"out of band" (copy-paste)
           flow
           <https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob>`_.
    dialect : str, default 'legacy'
        Note: The default value is changing to 'standard' in a future version.

        SQL syntax dialect to use. Value can be one of:

        ``'legacy'``
            Use BigQuery's legacy SQL dialect. For more information see
            `BigQuery Legacy SQL Reference
            <https://cloud.google.com/bigquery/docs/reference/legacy-sql>`__.
        ``'standard'``
            Use BigQuery's standard SQL, which is
            compliant with the SQL 2011 standard. For more information
            see `BigQuery Standard SQL Reference
            <https://cloud.google.com/bigquery/docs/reference/standard-sql/>`__.
    location : str, optional
        Location where the query job should run. See the `BigQuery locations
        documentation
        <https://cloud.google.com/bigquery/docs/dataset-locations>`__ for a
        list of available locations. The location must match that of any
        datasets used in the query.

        *New in version 0.5.0 of pandas-gbq*.
    configuration : dict, optional
        Query config parameters for job processing.
        For example:

            configuration = {'query': {'useQueryCache': False}}

        For more information see `BigQuery REST API Reference
        <https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query>`__.
    credentials : google.auth.credentials.Credentials, optional
        Credentials for accessing Google APIs. Use this parameter to override
        default credentials, such as to use Compute Engine
        :class:`google.auth.compute_engine.Credentials` or Service Account
        :class:`google.oauth2.service_account.Credentials` directly.

        *New in version 0.8.0 of pandas-gbq*.
    use_bqstorage_api : bool, default False
        Use the `BigQuery Storage API
        <https://cloud.google.com/bigquery/docs/reference/storage/>`__ to
        download query results quickly, but at an increased cost. To use this
        API, first `enable it in the Cloud Console
        <https://console.cloud.google.com/apis/library/bigquerystorage.googleapis.com>`__.
        You must also have the `bigquery.readsessions.create
        <https://cloud.google.com/bigquery/docs/access-control#roles>`__
        permission on the project you are billing queries to.

        This feature requires version 0.10.0 or later of the ``pandas-gbq``
        package. It also requires the ``google-cloud-bigquery-storage`` and
        ``fastavro`` packages.

    max_results : int, optional
        If set, limit the maximum number of rows to fetch from the query
        results.

    progress_bar_type : Optional, str
        If set, use the `tqdm <https://tqdm.github.io/>`__ library to
        display a progress bar while the data downloads. Install the
        ``tqdm`` package to use this feature.

        Possible values of ``progress_bar_type`` include:

        ``None``
            No progress bar.
        ``'tqdm'``
            Use the :func:`tqdm.tqdm` function to print a progress bar
            to :data:`sys.stderr`.
        ``'tqdm_notebook'``
            Use the :func:`tqdm.tqdm_notebook` function to display a
            progress bar as a Jupyter notebook widget.
        ``'tqdm_gui'``
            Use the :func:`tqdm.tqdm_gui` function to display a
            progress bar as a graphical dialog box.

    Returns
    -------
    df: DataFrame
        DataFrame representing results of query.

    See Also
    --------
    pandas_gbq.read_gbq : This function in the pandas-gbq library.
    DataFrame.to_gbq : Write a DataFrame to Google BigQuery.

    Examples
    --------
    Example taken from `Google BigQuery documentation
    <https://cloud.google.com/bigquery/docs/pandas-gbq-migration>`_

    >>> sql = "SELECT name FROM table_name WHERE state = 'TX' LIMIT 100;"
    >>> df = pd.read_gbq(sql, dialect="standard")  # doctest: +SKIP
    >>> project_id = "your-project-id"  # doctest: +SKIP
    >>> df = pd.read_gbq(sql,
    ...                  project_id=project_id,
    ...                  dialect="standard"
    ...                  )  # doctest: +SKIP
    z°read_gbq is deprecated and will be removed in a future version. Please use pandas_gbq.read_gbq instead: https://pandas-gbq.readthedocs.io/en/latest/api.html#pandas_gbq.read_gbq©Ú
stacklevelNr!   r#   r%   )	r   r   r   r   r   r   r   r   r   )ÚwarningsÚwarnÚFutureWarningr   r   Úread_gbq)r   r   r   r   r   r   r   r   r   r   r!   r#   r%   r   Úkwargss                  r   r-   r-      s»   € õz „Mð	Sõ 	Ý#Ñ%Ô%ðñ ô ð õ ‘”€Jà13€Fð Ð$Ø&7ˆÐ"Ñ#ØÐØ +ˆˆ}Ñà"3€FÐÑð ˆ:ÔØðàØØØØ1ØØØ#Øðð ð ðð ð r   ÚfailÚ	dataframeÚdestination_tableÚ	chunksizeÚ	if_existsÚtable_schemaúlist[dict[str, str]] | NoneÚprogress_barÚNonec                ó²   — t          j        dt          t          ¦   «         ¬¦  «         t	          ¦   «         }|                     | |||||||||	|
¬¦  «         d S )Nzªto_gbq is deprecated and will be removed in a future version. Please use pandas_gbq.to_gbq instead: https://pandas-gbq.readthedocs.io/en/latest/api.html#pandas_gbq.to_gbqr(   )	r   r2   r   r3   r   r4   r   r6   r   )r*   r+   r,   r   r   Úto_gbq)r0   r1   r   r2   r   r3   r   r4   r   r6   r   r   s               r   r9   r9   Þ   s„   € õ „Mð	Qõ 	Ý#Ñ%Ô%ðñ ô ð õ ‘”€JØ×ÒØØØØØØØ1Ø!ØØ!Øð ñ ô ð ð ð r   )NNNFTNNNNNNN)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%   r   r&   r	   )	NNFr/   TNNTN)r0   r	   r1   r   r   r   r2   r$   r   r   r3   r   r   r   r4   r5   r   r   r6   r   r   r    r&   r7   )Ú__doc__Ú
__future__r   Útypingr   r   r*   Úpandas.compat._optionalr   Úpandas.util._exceptionsr   Úgoogle.authÚgoogleÚpandasr	   r   r-   r9   © r   r   ú<module>rC      s.  ðØ Ð Ø "Ð "Ð "Ð "Ð "Ð "ðð ð ð ð ð ð ð ð €€€à >Ð >Ð >Ð >Ð >Ð >Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4àð !ØÐÐÐà Ð Ð Ð Ð Ð ðð ð ð "Ø Ø"&ØØ!%ØØØ+/Ø>BØ%)Ø"Ø$(ð}ð }ð }ð }ð }ðF "Ø ØØØ!%Ø04ØØØ>Bð!ð !ð !ð !ð !ð !ð !r   