# Path: pandas_gbq/exceptions.py
# class GenericGBQException(ValueError):
# class AccessDenied(ValueError):
# class ConversionError(GenericGBQException):
# class InvalidPrivateKeyFormat(ValueError):
# class PerformanceWarning(RuntimeWarning):
# 
# Path: pandas_gbq/features.py
# FEATURES = Features()
# 
# Path: pandas_gbq/load.py
# def encode_chunk(dataframe):
# def split_dataframe(dataframe, chunksize=None):
# def cast_dataframe_for_parquet(
#     dataframe: pandas.DataFrame, schema: Optional[Dict[str, Any]],
# ) -> pandas.DataFrame:
# def load_parquet(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
# def load_csv(
#     dataframe: pandas.DataFrame,
#     chunksize: Optional[int],
#     bq_schema: Optional[List[bigquery.SchemaField]],
#     load_chunk: Callable,
# ):
# def load_csv_from_dataframe(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_csv_from_file(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_chunks(
#     client,
#     dataframe,
#     destination_table_ref,
#     chunksize=None,
#     schema=None,
#     location=None,
#     api_method="load_parquet",
#     billing_project: Optional[str] = None,
# ):


import datetime
import decimal
import textwrap
import db_dtypes
import numpy
import pandas
import pandas.testing
import pytest
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import pyarrow
from io import StringIO
from unittest import mock
from pandas_gbq import exceptions
from pandas_gbq.features import FEATURES
from pandas_gbq import load
            {"name": "col1", "type": "INT64", "policyTags": {"names": ["tag1", "tag2"]}}
        ]
    }

    _ = list(
        load.load_chunks(
            mock_bigquery_client, df, destination, schema=schema, api_method=api_method
        )
    )

    mock_load = load_method(mock_bigquery_client, api_method=api_method)
    assert mock_load.called
    _, kwargs = mock_load.call_args
    assert "job_config" in kwargs
    sent_field = kwargs["job_config"].schema[0].to_api_repr()
    assert "policyTags" not in sent_field


def test_load_chunks_with_invalid_api_method():
    with pytest.raises(ValueError, match="Got unexpected api_method:"):
        load.load_chunks(None, None, None, api_method="not_a_thing")


def test_load_parquet_allows_client_to_generate_schema(mock_bigquery_client):

    df = pandas.DataFrame({"int_col": [1, 2, 3]})
    destination = google.cloud.bigquery.TableReference.from_string(
        "my-project.my_dataset.my_table"
    )


# Path: pandas_gbq/exceptions.py
# class GenericGBQException(ValueError):
# class AccessDenied(ValueError):
# class ConversionError(GenericGBQException):
# class InvalidPrivateKeyFormat(ValueError):
# class PerformanceWarning(RuntimeWarning):
# 
# Path: pandas_gbq/features.py
# FEATURES = Features()
# 
# Path: pandas_gbq/load.py
# def encode_chunk(dataframe):
# def split_dataframe(dataframe, chunksize=None):
# def cast_dataframe_for_parquet(
#     dataframe: pandas.DataFrame, schema: Optional[Dict[str, Any]],
# ) -> pandas.DataFrame:
# def load_parquet(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
# def load_csv(
#     dataframe: pandas.DataFrame,
#     chunksize: Optional[int],
#     bq_schema: Optional[List[bigquery.SchemaField]],
#     load_chunk: Callable,
# ):
# def load_csv_from_dataframe(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_csv_from_file(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_chunks(
#     client,
#     dataframe,
#     destination_table_ref,
#     chunksize=None,
#     schema=None,
#     location=None,
#     api_method="load_parquet",
#     billing_project: Optional[str] = None,
# ):


# Path: tests/unit/test_load.py
import datetime
import decimal
import textwrap
import db_dtypes
import numpy
import pandas
import pandas.testing
import pytest
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import pyarrow
from io import StringIO
from unittest import mock
from pandas_gbq import exceptions
from pandas_gbq.features import FEATURES
from pandas_gbq import load

            {"name": "col1", "type": "INT64", "policyTags": {"names": ["tag1", "tag2"]}}
        ]
    }

    _ = list(
        load.load_chunks(
            mock_bigquery_client, df, destination, schema=schema, api_method=api_method
        )
    )

    mock_load = load_method(mock_bigquery_client, api_method=api_method)
    assert mock_load.called
    _, kwargs = mock_load.call_args
    assert "job_config" in kwargs
    sent_field = kwargs["job_config"].schema[0].to_api_repr()
    assert "policyTags" not in sent_field


def test_load_chunks_with_invalid_api_method():
    with pytest.raises(ValueError, match="Got unexpected api_method:"):
        load.load_chunks(None, None, None, api_method="not_a_thing")


def test_load_parquet_allows_client_to_generate_schema(mock_bigquery_client):

    df = pandas.DataFrame({"int_col": [1, 2, 3]})
    destination = google.cloud.bigquery.TableReference.from_string(
        "my-project.my_dataset.my_table"
    )


    load.load_parquet(mock_bigquery_client, df, destination, None, None)