# Path: pandas_gbq/exceptions.py
# class AccessDenied(ValueError):
#     """
#     Raised when invalid credentials are provided, or tokens have expired.
#     """
# 
# class GenericGBQException(ValueError):
#     """
#     Raised when an unrecognized Google API Error occurs.
#     """
# 
# Path: pandas_gbq/features.py
# FEATURES = Features()


import copy
import concurrent.futures
import logging
import re
import time
import typing
import warnings
import numpy as np
    import pandas
import pandas_gbq.schema
import pandas_gbq.timestamp
    import tqdm  # noqa
        import pkg_resources  # noqa
        import db_dtypes  # noqa
        import pydata_google_auth  # noqa
        import google.auth  # noqa
        import google.api_core.client_info
        import pandas
        import pandas
    import db_dtypes
    import db_dtypes
    import pandas.api.types
from datetime import datetime
from typing import Any, Dict, Optional, Sequence, Union
from pandas_gbq.exceptions import (
    AccessDenied,
    GenericGBQException,
)
from pandas_gbq.features import FEATURES
        from google_auth_oauthlib.flow import InstalledAppFlow  # noqa
        from google.cloud import bigquery  # noqa
        from google.api_core.exceptions import GoogleAPIError
        from google.api_core.exceptions import ClientError
        from pandas_gbq import auth
        from google.cloud import bigquery
        from google.cloud import bigquery
        from google.auth.exceptions import RefreshError
        from google.cloud import bigquery
        from pandas_gbq import load
    from google.api_core import exceptions as google_exceptions
    from google.cloud import bigquery
    from pandas_gbq import schema
        from google.cloud.bigquery import DatasetReference
        from google.cloud.bigquery import TableReference
        from google.api_core.exceptions import NotFound
        from google.cloud.bigquery import DatasetReference
        from google.cloud.bigquery import Table
        from google.cloud.bigquery import TableReference
        from google.api_core.exceptions import NotFound
        from google.cloud.bigquery import DatasetReference
        from google.api_core.exceptions import NotFound
        from google.cloud.bigquery import Dataset

    def run_query(self, query, max_results=None, progress_bar_type=None, **kwargs):

        job_config = {
            "query": {
                "useLegacySql": self.dialect
                == "legacy"
                # 'allowLargeResults', 'createDisposition',
                # 'preserveNulls', destinationTable, useQueryCache
            }
        }
        config = kwargs.get("configuration")
        if config is not None:
            job_config.update(config)

        self._start_timer()

        try:
            logger.debug("Requesting query... ")
            query_reply = self.client.query(
                query,
                job_config=bigquery.QueryJobConfig.from_api_repr(job_config),
                location=self.location,
                project=self.project_id,
            )
            logger.debug("Query running...")
        except (RefreshError, ValueError):
            if self.private_key:
                raise AccessDenied("The service account credentials are not valid")
            else:

# Path: pandas_gbq/exceptions.py
# class AccessDenied(ValueError):
#     """
#     Raised when invalid credentials are provided, or tokens have expired.
#     """
# 
# class GenericGBQException(ValueError):
#     """
#     Raised when an unrecognized Google API Error occurs.
#     """
# 
# Path: pandas_gbq/features.py
# FEATURES = Features()


# Path: pandas_gbq/gbq.py
import copy
import concurrent.futures
import logging
import re
import time
import typing
import warnings
import numpy as np
    import pandas
import pandas_gbq.schema
import pandas_gbq.timestamp
    import tqdm  # noqa
        import pkg_resources  # noqa
        import db_dtypes  # noqa
        import pydata_google_auth  # noqa
        import google.auth  # noqa
        import google.api_core.client_info
        import pandas
        import pandas
    import db_dtypes
    import db_dtypes
    import pandas.api.types
from datetime import datetime
from typing import Any, Dict, Optional, Sequence, Union
from pandas_gbq.exceptions import (
    AccessDenied,
    GenericGBQException,
)
from pandas_gbq.features import FEATURES
        from google_auth_oauthlib.flow import InstalledAppFlow  # noqa
        from google.cloud import bigquery  # noqa
        from google.api_core.exceptions import GoogleAPIError
        from google.api_core.exceptions import ClientError
        from pandas_gbq import auth
        from google.cloud import bigquery
        from google.cloud import bigquery
        from google.auth.exceptions import RefreshError
        from google.cloud import bigquery
        from pandas_gbq import load
    from google.api_core import exceptions as google_exceptions
    from google.cloud import bigquery
    from pandas_gbq import schema
        from google.cloud.bigquery import DatasetReference
        from google.cloud.bigquery import TableReference
        from google.api_core.exceptions import NotFound
        from google.cloud.bigquery import DatasetReference
        from google.cloud.bigquery import Table
        from google.cloud.bigquery import TableReference
        from google.api_core.exceptions import NotFound
        from google.cloud.bigquery import DatasetReference
        from google.api_core.exceptions import NotFound
        from google.cloud.bigquery import Dataset


    def run_query(self, query, max_results=None, progress_bar_type=None, **kwargs):

        job_config = {
            "query": {
                "useLegacySql": self.dialect
                == "legacy"
                # 'allowLargeResults', 'createDisposition',
                # 'preserveNulls', destinationTable, useQueryCache
            }
        }
        config = kwargs.get("configuration")
        if config is not None:
            job_config.update(config)

        self._start_timer()

        try:
            logger.debug("Requesting query... ")
            query_reply = self.client.query(
                query,
                job_config=bigquery.QueryJobConfig.from_api_repr(job_config),
                location=self.location,
                project=self.project_id,
            )
            logger.debug("Query running...")
        except (RefreshError, ValueError):
            if self.private_key:
                raise AccessDenied("The service account credentials are not valid")
            else:

                raise AccessDenied(