Google Cloud BigQuery Logging API Client Library for Python
raw JSON → 1.9.0 verified Sat May 09 auth: no python
This library implements the google.cloud.bigquery_logging_v1 protobuf definitions, providing RPC bindings for the BigQuery Logging API. It is used to programmatically manage logging data for BigQuery audit logs. The current stable version is 1.9.0, and releases follow the googleapis-yoshi release cadence. Minimum Python version required is 3.9.
pip install google-cloud-bigquery-logging Common errors
error ModuleNotFoundError: No module named 'google.cloud.bigquery_logging' ↓
cause Importing without the '_v1' version suffix.
fix
Use 'from google.cloud import bigquery_logging_v1' or 'from google.cloud.bigquery_logging_v1 import BigQueryLoggingServiceClient'.
error AttributeError: module 'google.cloud.bigquery_logging_v1' has no attribute 'BigQueryLoggingServiceClient' ↓
cause Trying to access the client class via a wrong submodule path.
fix
The correct import is 'from google.cloud import bigquery_logging_v1' then use bigquery_logging_v1.BigQueryLoggingServiceClient.
Warnings
gotcha The bigquery_logging_v1 client only supports the gRPC transport; the older grpc-experimental fallback is removed. ↓
fix Install grpcio and ensure your environment provides gRPC support.
gotcha The library does not expose a high-level client; it only provides low-level RPC stubs for protobuf services. ↓
fix Use google-cloud-logging or bigquery audit log sinks for typical logging use cases.
breaking The package name changed to google-cloud-bigquery-logging (hyphen) in 2020. The old google-cloud-bigquery-logging (with dot) is deprecated. ↓
fix Use pip install google-cloud-bigquery-logging (hyphen).
Imports
- BigQueryLoggingServiceClient wrong
from google.cloud.bigquery_logging import BigQueryLoggingServiceClientcorrectfrom google.cloud import bigquery_logging_v1
Quickstart
from google.cloud import bigquery_logging_v1
client = bigquery_logging_v1.BigQueryLoggingServiceClient()
# Below is a sample request (empty is valid but will fail auth without credentials)
from google.cloud.bigquery_logging_v1 import AuditData
request = bigquery_logging_v1.ListLogsRequest(parent="projects/your-project")
response = client.list_logs(request=request)
print(response)