{"id":9781,"library":"google-cloud-bigquery-reservation","title":"Google Cloud BigQuery Reservation","description":"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.","status":"active","version":"1.23.0","language":"en","source_language":"en","source_url":"https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-bigquery-reservation","tags":["google-cloud","gcp","bigquery","reservation","data-warehousing"],"install":[{"cmd":"pip install google-cloud-bigquery-reservation","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core Google API utilities, authentication, and HTTP/gRPC transport.","package":"google-api-core","optional":false},{"reason":"Provides Pythonic wrappers for Protocol Buffer messages.","package":"proto-plus","optional":false},{"reason":"Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.","package":"protobuf","optional":false}],"imports":[{"note":"Google Cloud client libraries are often versioned (e.g., `_v1`) to distinguish different API versions. Omitting the version suffix will lead to an ImportError.","wrong":"from google.cloud.bigquery_reservation import ReservationServiceClient","symbol":"ReservationServiceClient","correct":"from google.cloud.bigquery_reservation_v1 import ReservationServiceClient"}],"quickstart":{"code":"import os\nfrom google.cloud.bigquery_reservation_v1 import ReservationServiceClient\n\n# Instantiate a client. The client will automatically pick up credentials\n# from GOOGLE_APPLICATION_CREDENTIALS environment variable or gcloud CLI.\nclient = ReservationServiceClient()\n\n# Replace with your actual GCP project ID\n# You can also set this as an environment variable: export GCP_PROJECT_ID='your-project-id'\nproject_id = os.environ.get(\"GCP_PROJECT_ID\", \"your-project-id\")\nlocation = \"us-central1\" # Example location\nparent = f\"projects/{project_id}/locations/{location}\"\n\nprint(f\"Attempting to list reservations in {parent}...\")\n\ntry:\n    # List reservations for a given project and location\n    reservations = client.list_reservations(parent=parent)\n    \n    found_reservations = False\n    for reservation in reservations:\n        print(f\"- Reservation found: {reservation.name} (Slots: {reservation.slot_capacity})\")\n        found_reservations = True\n    \n    if not found_reservations:\n        print(\"No reservations found. You might need to create one first.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure you have correct project ID, location, and permissions.\")\n","lang":"python","description":"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`)."},"warnings":[{"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.","message":"Google 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Python 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.","severity":"breaking","affected_versions":"Check PyPI for `requires_python` for specific library versions."},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"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.","cause":"The authenticated service account or user lacks the necessary IAM permissions to perform the requested operation on BigQuery Reservations.","error":"google.api_core.exceptions.PermissionDenied: 403 Permission denied: The caller does not have permission"},{"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.","cause":"The specified project, location, reservation, or assignment ID does not exist, or the authenticated principal does not have permission to view it.","error":"google.api_core.exceptions.NotFound: 404 Not Found: Requested entity was not found"},{"fix":"Use the versioned import path: `from google.cloud.bigquery_reservation_v1 import ReservationServiceClient`.","cause":"Incorrect import path. Google Cloud client libraries often include API versioning in their module structure.","error":"ImportError: cannot import name 'ReservationServiceClient' from 'google.cloud.bigquery_reservation'"}]}