The Google Cloud BigQuery Data Policies API client library provides programmatic access to manage data policies (e.g., column-level security or data masking) within BigQuery datasets. This library allows users to create, retrieve, update, and delete data policies, enforcing fine-grained access control on BigQuery data. It is currently at version 0.9.0 and is part of the `google-cloud-python` monorepo, receiving updates aligned with the underlying API and shared client library components.
pip install google-cloud-bigquery-datapoliciesVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the BigQuery Data Policies client and lists all data policies within a specified Google Cloud project and location. Remember to authenticate your application (e.g., via `gcloud auth application-default login` or `GOOGLE_APPLICATION_CREDENTIALS`).
Always pin to a specific `0.x.y` version in your `requirements.txt` (e.g., `google-cloud-bigquery-datapolicies==0.9.0`) and review release notes when upgrading.
Ensure that the `location` parameter (e.g., 'us-central1', 'europe-west2') in your API calls is correct and matches the region where your data policies are defined.
Verify that the principal (user or service account) used for authentication has the appropriate IAM roles on the BigQuery project or dataset. For creating/managing policies, 'BigQuery Data Policy Admin' is typically required.