Пример #1
0
def connect(
    project_id: Optional[str] = None,
    dataset_id: Optional[str] = None,
    credentials: Optional[google.auth.credentials.Credentials] = None,
) -> BigQueryClient:
    """Create a BigQueryClient for use with Ibis.

    Parameters
    ----------
    project_id : str
        A BigQuery project id.
    dataset_id : str
        A dataset id that lives inside of the project indicated by
        `project_id`.
    credentials : google.auth.credentials.Credentials

    Returns
    -------
    BigQueryClient

    """
    if credentials is None:
        credentials_cache = pydata_google_auth.cache.ReadWriteCredentialsCache(
            filename="ibis.json")
        credentials, project_id = pydata_google_auth.default(
            SCOPES,
            client_id=CLIENT_ID,
            client_secret=CLIENT_SECRET,
            credentials_cache=credentials_cache,
        )

    return BigQueryClient(project_id,
                          dataset_id=dataset_id,
                          credentials=credentials)
Пример #2
0
def connect(project_id, dataset_id):
    """Create a BigQueryClient for use with Ibis

    Parameters
    ----------
    project_id: str
    dataset_id: str

    Returns
    -------
    BigQueryClient
    """

    return BigQueryClient(project_id, dataset_id)
Пример #3
0
def connect(project_id, dataset_id, credentials=None):
    """Create a BigQueryClient for use with Ibis

    Parameters
    ----------
    project_id: str
    dataset_id: str
    credentials : google.auth.credentials.Credentials, optional, default None

    Returns
    -------
    BigQueryClient
    """

    return BigQueryClient(project_id, dataset_id, credentials=credentials)