Registry / testing / soda-core-bigquery

soda-core-bigquery

JSON →
library3.5.6pypypiunverified

Soda Core BigQuery is an extension for Soda Core, an open-source data quality testing tool. It enables users to define, execute, and monitor data quality checks directly against data stored in Google BigQuery. This package provides the necessary connector and SQL dialect definitions to interact with BigQuery, allowing for comprehensive data quality assessments within a Python environment, typically managed through the Soda CLI and YAML configuration files. The current version is 3.5.6, and it follows the release cadence of the broader Soda Core project.

pip install soda-core-bigquery
INSTALL
IMPORT
SIG · SODA-CORE-BIGQUERY
S
soda-core-bigquery
testingpythonv3.5.6
Install
9.8s avg
Import
1774ms
Disk
97MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.5.6 · 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 1.174s · 98MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 9.8s · import 0.955s · 96MB
97MB installed
● package 97MB
Code
Verified usage

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

Scan
from soda.scan import Scan
from soda.scan import Scan

This quickstart demonstrates how to run a Soda Scan programmatically against a BigQuery data source. It configures the BigQuery connection and defines simple data quality checks. For this to run successfully against your data, ensure BigQuery authentication is set up (e.g., `GOOGLE_APPLICATION_CREDENTIALS` environment variable or `gcloud auth application-default login`) and replace placeholder values for `project_id`, `dataset`, and `table` with your actual BigQuery resources.

import os from soda.scan import Scan # Configure your GCP project ID. For local execution, ensure: # 1. 'GOOGLE_APPLICATION_CREDENTIALS' env var points to a service account key JSON, # OR 2. 'gcloud auth application-default login' has been run. # os.environ['BIGQUERY_PROJECT_ID'] = 'your-gcp-project-id' # Initialize a Soda Scan scan = Scan() # Add BigQuery data source configuration via a YAML string # Replace 'my-dummy-project' with your actual GCP project ID scan.add_configuration_yaml_str(f''' data_sources: bigquery_source: type: bigquery project_id: {os.environ.get('BIGQUERY_PROJECT_ID', 'my-dummy-project')} ''') # Define data quality checks via a YAML string # Replace 'my_dataset.my_table' with an actual BigQuery dataset.table for real checks scan.add_checks_yaml_str(''' checks for my_dataset.my_table: - row_count > 0: # Checks if the table has any rows name: 'Table should not be empty' - missing_count(id) = 0: # Checks for missing values in 'id' column name: 'No missing IDs' - duplicate_count(id) = 0: # Checks for duplicate values in 'id' column name: 'No duplicate IDs' ''') print("Running Soda Scan...") scan.execute() if scan.has_failures(): print("\nSoda Scan finished with failures.") else: print("\nSoda Scan finished with no failures.") # You can inspect the scan results for detailed outcomes # print(scan.get_scan_results())
soda --version
Debug
Known issues
breakingSoda Core 3.x introduced significant changes to the CLI commands (e.g., `soda scan` replaced `soda analyze`) and the structure of configuration YAML files compared to 2.x versions. Migrating from older versions requires updating commands and YAML definitions.
fix
Refer to the official Soda Core 3.x migration guide for CLI and YAML syntax updates. Always test configurations in a development environment before deploying to production.
affects: 2.x to 3.x
gotchaProper BigQuery authentication and IAM roles are critical. Common issues include incorrect service account keys, missing `GOOGLE_APPLICATION_CREDENTIALS` environment variable, or insufficient IAM permissions for the service account/user.
fix
Ensure the service account or user account has at least `BigQuery Data Viewer` (to read data) and `BigQuery Job User` (to run queries) roles. For service accounts, verify `GOOGLE_APPLICATION_CREDENTIALS` points to a valid key JSON file. For user credentials, ensure `gcloud auth application-default login` has been executed.
affects: All
gotcha`soda-core-bigquery` is an extension package. While `pip install soda-core-bigquery` typically pulls `soda-core` as a dependency, the core functionalities (CLI, `Scan` object) are provided by `soda-core`. Ensure `soda-core` is available and compatible.
fix
If encountering issues, explicitly check `pip show soda-core` and `pip show soda-core-bigquery` to confirm both are installed and compatible. Rarely, direct `pip install soda-core` might be needed if `soda-core-bigquery`'s dependency resolution fails.
affects: All
gotchaYAML configuration files (`configuration.yml`, `checks.yml`) are highly sensitive to indentation and syntax. Minor errors can lead to failures, unexecuted checks, or incorrect interpretations without clear error messages.
fix
Use a YAML linter or validator. Carefully review the Soda Core documentation for the exact YAML structure and examples. Pay close attention to spacing and nesting, especially for data source definitions and check configurations.
affects: All
Upgrade
Version history
3.5.6latest on PyPI · released Sep 24, 2025
Audit
Dependencies
soda-corerequiredProvides the core Soda CLI, scan execution engine, and base API functionalities; `soda-core-bigquery` is an extension.
Agent activity
39 hits · last 30 days
node
34
OpenAI (training)
1
Resources
soda-core-bigquery — pip install soda-core-bigquery · libregistry