Google Cloud BigQuery BigLake API Client Library

0.7.0 · active · verified Thu Apr 09

The `google-cloud-bigquery-biglake` library is the Python client for the Google Cloud BigLake API. BigLake serves as a unified storage engine, simplifying data access for data warehouses and data lakes. It offers uniform, fine-grained access control across multi-cloud storage solutions like Google Cloud Storage, Amazon S3, and Azure Data Lake Storage, and supports querying open-source table formats such as Apache Iceberg in BigQuery. This library is part of the larger `google-cloud-python` monorepo, suggesting a consistent release and maintenance cadence aligned with other Google Cloud client libraries.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the BigLakeServiceClient and list available BigLake catalogs within a specified Google Cloud project and location. Ensure your `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` environment variables are set or replace the placeholder values. Authentication typically relies on Application Default Credentials.

import os
from google.cloud.bigquery_biglake_v1 import BigLakeServiceClient

# Set your Google Cloud Project ID and a location (e.g., 'us-central1')
project_id = os.environ.get('GOOGLE_CLOUD_PROJECT', 'your-gcp-project-id')
location = os.environ.get('GOOGLE_CLOUD_LOCATION', 'us-central1')

# Ensure you have authenticated to Google Cloud. For local development, use:
# gcloud auth application-default login

def list_biglake_catalogs(project_id: str, location: str):
    """Lists BigLake catalogs in a given project and location."""
    client = BigLakeServiceClient()
    parent = f"projects/{project_id}/locations/{location}"

    print(f"Listing BigLake catalogs in {parent}:")
    try:
        # The list_catalogs method returns an iterable of Catalog objects
        for catalog in client.list_catalogs(parent=parent):
            print(f"  Catalog: {catalog.name}")
    except Exception as e:
        print(f"An error occurred: {e}")
        print("Ensure the BigLake API is enabled for your project and the service account has 'biglake.catalogs.list' permission.")

if __name__ == "__main__":
    list_biglake_catalogs(project_id, location)

view raw JSON →