Registry / gcp / google-cloud-bigquery-reservation

google-cloud-bigquery-reservation

JSON →
library1.25.0pypypi✓ verified 84d ago

The `google-cloud-bigquery-reservation` library provides a Python client for the Google Cloud BigQuery Reservation API. This API allows users to manage BigQuery reservations, which are dedicated slots for running queries. The library is currently at version 1.23.0 and is part of the `google-cloud-python` monorepo, receiving frequent updates, often daily, alongside other Google Cloud client libraries.

pip install google-cloud-bigquery-reservation
INSTALL
IMPORT
SIG · GOOGLE-CLOUD-BIGQU
G
google-cloud-bigquery-reservation
gcppythonv1.25.0
Install
5.5s avg
Import
1741ms
Disk
68MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.25.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 2.011s · 69.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 5.5s · import 1.472s · 67MB
68MB installed
● package 68MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ReservationServiceClient
from google.cloud.bigquery_reservation_v1 import ReservationServiceClient
from google.cloud.bigquery_reservation import ReservationServiceClient
Google Cloud client libraries are often versioned (e.g., `_v1`) to distinguish different API versions. Omitting the version suffix will lead to an ImportError.

This quickstart demonstrates how to instantiate the `ReservationServiceClient` and list existing BigQuery reservations within a specified Google Cloud project and location. Ensure your `GOOGLE_APPLICATION_CREDENTIALS` are set or you are authenticated via `gcloud` and have the necessary IAM permissions (e.g., `bigquery.reservations.list`).

import os from google.cloud.bigquery_reservation_v1 import ReservationServiceClient # Instantiate a client. The client will automatically pick up credentials # from GOOGLE_APPLICATION_CREDENTIALS environment variable or gcloud CLI. client = ReservationServiceClient() # Replace with your actual GCP project ID # You can also set this as an environment variable: export GCP_PROJECT_ID='your-project-id' project_id = os.environ.get("GCP_PROJECT_ID", "your-project-id") location = "us-central1" # Example location parent = f"projects/{project_id}/locations/{location}" print(f"Attempting to list reservations in {parent}...") try: # List reservations for a given project and location reservations = client.list_reservations(parent=parent) found_reservations = False for reservation in reservations: print(f"- Reservation found: {reservation.name} (Slots: {reservation.slot_capacity})") found_reservations = True if not found_reservations: print("No reservations found. You might need to create one first.") except Exception as e: print(f"An error occurred: {e}") print("Please ensure you have correct project ID, location, and permissions.")
Debug
Known issues
gotchaGoogle Cloud client libraries require appropriate authentication. If `GOOGLE_APPLICATION_CREDENTIALS` isn't set or `gcloud auth application-default login` hasn't been run, operations will fail with permission errors.
fix
Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of your service account key file, or authenticate via `gcloud auth application-default login` for local development. Ensure the principal has `BigQuery Resource Admin` or equivalent IAM roles for reservation management.
affects: All versions
breakingPython version support changes across the `google-cloud-python` ecosystem. While `google-cloud-bigquery-reservation==1.23.0` requires Python `>=3.9`, other related libraries may drop support for older Python versions (e.g., Python 3.9) in recent releases.
fix
Always check the `requires_python` metadata on PyPI for the specific version of `google-cloud-bigquery-reservation` you intend to use. Upgrade to a supported Python version (e.g., 3.10 or newer) to ensure compatibility across all Google Cloud libraries.
affects: Check PyPI for `requires_python` for specific library versions.
gotchaThe BigQuery Reservation API is regional. Resources like reservations and assignment must be created and accessed within a specific location. Attempting to access a reservation from the wrong location will result in 'Not Found' errors.
fix
Always specify the correct region (e.g., `us-central1`, `eu-west1`) when listing, creating, or managing BigQuery reservation resources. Ensure the `parent` path in your API calls accurately reflects the resource's location.
affects: All versions
Errors
Common errors & fixes
google.api_core.exceptions.PermissionDenied: 403 Permission denied: The caller does not have permission
The authenticated service account or user lacks the necessary IAM permissions to perform the requested operation on BigQuery Reservations.
fix
Grant the appropriate IAM roles (e.g., `BigQuery Resource Admin`, `BigQuery Reservation User`) to the service account or user used for authentication. Verify the `GOOGLE_APPLICATION_CREDENTIALS` environment variable points to the correct key file.
google.api_core.exceptions.NotFound: 404 Not Found: Requested entity was not found
The specified project, location, reservation, or assignment ID does not exist, or the authenticated principal does not have permission to view it.
fix
Double-check the project ID, location, and the name/ID of the reservation or assignment resource in your API call. Ensure the resource actually exists and is accessible from the specified location.
ImportError: cannot import name 'ReservationServiceClient' from 'google.cloud.bigquery_reservation'
Incorrect import path. Google Cloud client libraries often include API versioning in their module structure.
fix
Use the versioned import path: `from google.cloud.bigquery_reservation_v1 import ReservationServiceClient`.
Upgrade
Version history
1.25.0latest on PyPI · released Jun 3, 2026
Audit
Dependencies
google-api-corerequiredCore Google API utilities, authentication, and HTTP/gRPC transport.
proto-plusrequiredProvides Pythonic wrappers for Protocol Buffer messages.
protobufrequiredGoogle's language-neutral, platform-neutral, extensible mechanism for serializing structured data.
Agent activity
25 hits · last 30 days
node
18
OpenAI (training)
2
Resources
google-cloud-bigquery-reservation — pip install google-cloud-bigquery-reservation · libregistry