包名按数据源区分,需把 soda-postgres 换成对应数据源包;v4 包名为 soda-{数据源},v3 旧包名为 soda-core-{数据源},混用会装错版本;连接 Soda Cloud 需另行生成配置并获取 API 凭证
soda-core
sodadata活跃维护用 YAML 声明式数据契约来定义和校验数据质量,支持数据剖析、监控与测试,帮数据团队尽早发现数据可靠性问题。
Data Contracts engine for the modern data stack. https://www.soda.io
uv pip install soda-postgres
# 或
pip install soda-postgresREADME 未说明硬件要求,仅要求 Python 3.9~3.12 及 UV 或 pip 21.0+
用 YAML 定义数据契约并自动校验 schema 与数据质量的引擎
用 YAML 声明式数据契约来定义和校验数据质量,支持数据剖析、监控与测试,帮数据团队尽早发现数据可靠性问题。
核心能力
- 用人类可读的 YAML 语法定义数据契约
- 提供 CLI 与 Python API 生成、测试、发布和验证契约
- 内置 50+ 数据质量检查覆盖常见与高级校验
- 可接入 Airflow、Dagster、Prefect 等数据管道
- 支持 PostgreSQL、Snowflake、BigQuery、Databricks、DuckDB 等数据源
容易踩的坑
- v4.30.0最新正式版2026-11-05 · 2026-11-05 12:51 UTC
What's Changed
- Bump to next prerelease version 4.29.1rc0 by @m1n0 in https://github.com/sodadata/soda-core/pull/2960
- feat(sql-dialect): data-plane statement and expression nodes, rendered for Postgres (R-702) by @Niels-b in https://github.com/sodadata/soda-core/pull/2912
- feat(sqlserver): SQL Server rendering of the data-plane statement and expression nodes by @Niels-b in https://github.com/sodadata/soda-core/pull/2914
- feat(snowflake): Snowflake rendering of the data-plane statement and expression nodes by @Niels-b in https://github.com/sodadata/soda-core/pull/2922
- feat(athena): Athena rendering of the data-plane statement and expression nodes by @Niels-b in https://github.com/sodadata/soda-core/pull/2931
- fix(contracts): count invalid_values matches when the list contains null by @RaphaelFakhri in https://github.com/sodadata/soda-core/pull/2943
- feat(logging): redact records carrying group values by @nielsn in https://github.com/sodadata/soda-core/pull/2952
- feat(soda-cloud): read blockGroupByResultsToCloud from datasets configuration by @nielsn in https://github.com/sodadata/soda-core/pull/2953
- feat(logging): add is_redacted to ask the run's redaction policy by @nielsn in https://github.com/sodadata/soda-core/pull/2961
- test(sql-dialect): run the data-plane statements test only against a live database by @Niels-b in https://github.com/sodadata/soda-core/pull/2972
- ci(trino): sweep old trino-s3 CI test schemas weekly by @Niels-b in https://github.com/sodadata/soda-core/pull/2936
- fix: keep distinct rows apart in the combined row key, and test it on every data source by @Niels-b in https://github.com/sodadata/soda-core/pull/2955
- feat(contracts): redact session post-processing per file via a RedactionPolicy (PLATL-1404) by @nielsn in https://github.com/sodadata/soda-core/pull/2966
- feat(sqlserver): workload identity federation authentication (PLATL-1425) by @nielsn in https://github.com/sodadata/soda-core/pull/2974
- feat(sqlserver): diagnostic workload identity errors, no credentials in logs (PLATL-1426) by @nielsn in https://github.com/sodadata/soda-core/pull/2969
- feat(synapse,fabric): workload identity federation authentication (PLATL-1427) by @nielsn in https://github.com/sodadata/soda-core/pull/2970
- fix(deps): raise 4 vulnerable dependencies by @paulteehan in https://github.com/sodadata/soda-core/pull/2983
- docs(deps): say why pyarrow and duckdb are capped by @paulteehan in https://github.com/sodadata/soda-core/pull/2984
- [SKIP-TESTS] [release_20261103_1] soda-core v4.30.0 by @paulteehan in https://github.com/sodadata/soda-core/pull/2985
New Contributors
- @RaphaelFakhri made their first contribution in https://github.com/sodadata/soda-core/pull/2943
Full Changelog: https://github.com/sodadata/soda-core/compare/v4.29.0...v4.30.0
- v4.29.02026-10-27 · 2026-10-27 13:13 UTC
查看更新说明
What's Changed
- fix: yaml - Log a directory path as a directory, not as an unreadable file by @m1n0 in https://github.com/sodadata/soda-core/pull/2937
- fix: yaml - A file that cannot be read or loaded raises one parser error by @m1n0 in https://github.com/sodadata/soda-core/pull/2945
- fix: yaml - A required key that is null or of the wrong type raises by @m1n0 in https://github.com/sodadata/soda-core/pull/2946
- feat: yaml - Data product file type by @m1n0 in https://github.com/sodadata/soda-core/pull/2939
- feat: soda-cloud - Public execute_command and execute_query by @m1n0 in https://github.com/sodadata/soda-core/pull/2951
- fix: postgres - Discover only objects the connecting role can read by @m1n0 in https://github.com/sodadata/soda-core/pull/2954
- chore: review - Run the DE review on Opus 5.5 with claude-code-action v1.0.259 by @Lepo00 in https://github.com/sodadata/soda-core/pull/2956
- fix: cli - Name filters and grants when discover finds nothing (DATENG-60) by @m1n0 in https://github.com/sodadata/soda-core/pull/2957
Full Changelog: https://github.com/sodadata/soda-core/compare/v4.28.0...v4.29.0
- v4.28.02026-10-20 · 2026-10-20 11:51 UTC
查看更新说明
What's Changed
- fix(bigquery): read metadata region views from the project in scope or the storage project by @Lepo00 in https://github.com/sodadata/soda-core/pull/2925
- perf(snowflake): read results one batch at a time under the memory-optimized driver by @Lepo00 in https://github.com/sodadata/soda-core/pull/2924
- test(snowflake): use key-pair auth for CI test helper by @nielsn in https://github.com/sodadata/soda-core/pull/2923
- perf(bigquery): take dataset regions from the dataset listing by @mivds in https://github.com/sodadata/soda-core/pull/2928
- test(contracts): drop the unscoped payload pins by @m1n0 in https://github.com/sodadata/soda-core/pull/2933
- fix(trino): drop test schemas without a trailing semicolon by @mivds in https://github.com/sodadata/soda-core/pull/2935
- fix(cloud): send version 4 on check-collection result uploads by @mivds in https://github.com/sodadata/soda-core/pull/2932
- feat(contracts): log the check filters a verification uses (DET-342) by @m1n0 in https://github.com/sodadata/soda-core/pull/2934
- chore(deps): relock pyjwt, fsspec and databricks-sql-connector off vulnerable versions by @Niels-b in https://github.com/sodadata/soda-core/pull/2938
Full Changelog: https://github.com/sodadata/soda-core/compare/v4.27.0...v4.28.0
- v4.27.02026-10-13 · 2026-10-13 10:27 UTC
查看更新说明
What's Changed
- Bump to next prerelease version 4.26.1rc0 by @m1n0 in https://github.com/sodadata/soda-core/pull/2911
- feat(cloud): allow a historic limit inside a scan-time range by @mivds in https://github.com/sodadata/soda-core/pull/2906
- test(dwh): drop leftover metadata-DWH test schemas in the cleanup script by @Niels-b in https://github.com/sodadata/soda-core/pull/2916
- refactor(cloud): remove get_last_measurement by @mivds in https://github.com/sodadata/soda-core/pull/2909
- test(contracts): pin what Soda Cloud receives for an unscoped contract by @m1n0 in https://github.com/sodadata/soda-core/pull/2879
- fix(contracts): make CheckResult.is_excluded a property by @m1n0 in https://github.com/sodadata/soda-core/pull/2881
- fix(contracts): define has_excluded_checks on the check collection results by @m1n0 in https://github.com/sodadata/soda-core/pull/2882
- fix(contracts): each file in a verify session keeps its own Logs, and every soda command takes each flag once by @m1n0 in https://github.com/sodadata/soda-core/pull/2883
- feat(contracts): parse and validate scopes, and skip checks whose scope is not active by @m1n0 in https://github.com/sodadata/soda-core/pull/2884
- feat(contracts): carry a check's scope into its path, attributes and definition by @m1n0 in https://github.com/sodadata/soda-core/pull/2885
- feat(contracts): let extensions activate declared scopes and route metrics by scope by @m1n0 in https://github.com/sodadata/soda-core/pull/2886
- feat(contracts): filter checks by scope, and exclude matches with key!=value by @m1n0 in https://github.com/sodadata/soda-core/pull/2887
- feat(telemetry): count scopes and scoped checks on verify, test and publish by @m1n0 in https://github.com/sodadata/soda-core/pull/2892
- fix(contracts): soda contract verify -d exits 3 when it cannot fetch the contract by @m1n0 in https://github.com/sodadata/soda-core/pull/2888
- feat(contracts): send check paths and check filters to the runner by @m1n0 in https://github.com/sodadata/soda-core/pull/2891
- feat(cloud): wait and resend when Soda Cloud asks to retry later (429 + Retry-After) by @Lepo00 in https://github.com/sodadata/soda-core/pull/2917
- chore(deps): relock snowflake-connector-python and urllib3 off vulnerable versions (DATENG-7, DATENG-8) by @paulteehan in https://github.com/sodadata/soda-core/pull/2919
- [SKIP-TESTS] [release_20261013_1] soda-core v4.27.0 by @paulteehan in https://github.com/sodadata/soda-core/pull/2920
Full Changelog: https://github.com/sodadata/soda-core/compare/v4.26.0...v4.27.0
- v4.26.02026-10-06 · 2026-10-06 11:38 UTC
查看更新说明
What's Changed
- Bump to next prerelease version 4.25.1rc0 by @paulteehan in https://github.com/sodadata/soda-core/pull/2878
- chore(deps): move ruamel.yaml to >=0.18.17,<0.19 (ADO-338) by @nikosml in https://github.com/sodadata/soda-core/pull/2873
- [SKIP-TESTS] docs(dwh): call useMemoryOptimized a Soda Cloud setting, not a feature flag by @Niels-b in https://github.com/sodadata/soda-core/pull/2880
- chore(ci): pin all external actions to commit SHAs (PLATL-406) by @nielsn in https://github.com/sodadata/soda-core/pull/2623
- feat(review): add the de-review skill and an advisory Claude review workflow by @m1n0 in https://github.com/sodadata/soda-core/pull/2851
- docs: add CONTRIBUTING.md and data-source contribution guides by @m1n0 in https://github.com/sodadata/soda-core/pull/2705
- docs(cloud): the historic limit applies to each identity by @mivds in https://github.com/sodadata/soda-core/pull/2894
- fix(logs): print the check table cells as written by @m1n0 in https://github.com/sodadata/soda-core/pull/2900
- fix(sql-dialect): compute numeric aggregates over a float so averages keep their fraction by @mivds in https://github.com/sodadata/soda-core/pull/2895
- feat(sql-dialect): keep the data type as the metadata spells it by @mivds in https://github.com/sodadata/soda-core/pull/2897
- feat(soda-cloud): send the source's own type spelling in dataset metadata by @mivds in https://github.com/sodadata/soda-core/pull/2901
- feat(discovery): let the dialect split a schema name into DQN segments by @mivds in https://github.com/sodadata/soda-core/pull/2896
- refactor(sql-dialect): move the DQN prefix mapping onto the dialect by @mivds in https://github.com/sodadata/soda-core/pull/2904
- [SKIP-TESTS] [release_20261005_1] soda-core v4.26.0 by @m1n0 in https://github.com/sodadata/soda-core/pull/2907
Full Changelog: https://github.com/sodadata/soda-core/compare/v4.25.0...v4.26.0
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Soda Core is a data quality and data contract verification engine. It lets you define data quality contracts in YAML and automatically validate both schema and data across your data stack.
Soda Core provides the Soda Command-Line Interface (CLI) and Python API, which you can use to generate, test, publish, and verify contracts. These operations can be executed locally during development, embedded programmatically within your data pipelines (Airflow, Dagster, Prefect, etc.), or executed remotely when connected to Soda Cloud.
Highlights
- Define data contracts using a clean, human-readable YAML syntax
- Run checks on PostgreSQL, Snowflake, BigQuery, Databricks, DuckDB, and more
- Use 50+ built-in data quality checks for common and advanced validations
- Integrate with Soda Cloud for centralized management and anomaly detection monitoring
Setup
This repository hosts the open source Soda Core packages which are installable using the Public PyPI installation flow described in Soda's documentation.
Requirements
To use Soda, you must have installed the following on your system.
-
Python 3.9, 3.10, 3.11, or 3.12 To check your existing version, use the CLI command:
python --versionorpython3 --version. If you have not already installed Python, consider usingpyenvto manage multiple versions of Python in your environment. Note: While Python 3.12 is the highest officially supported version, there are no known issues preventing use of Python 3.13+. -
UV (recommended) or Pip 21.0 or greater We recommend using UV for faster and more reliable package management. To install UV, see the UV installation guide. Alternatively, you can use pip (version 21.0+). To check your pip version:
pip --version
Installation
Soda Core v4 open source packages are available on public PyPI and have the form soda-{data source}.
Using UV (recommended)
uv pip install soda-postgres # install latest version 4 package
Using pip
pip install soda-postgres # install latest version 4 package
Replace soda-postgres with the appropriate package for your data source. For a list of supported data sources, packages, and configurations, see the data source reference for Soda Core.
Working with legacy Soda Core v3
Soda package names have changed with the release of version 4. Legacy version 3 open source packages have the form soda-core-{data source}. For example, to install Soda Core v3 for Postgres, pinning the version at 3.5.x:
uv pip install soda-core-postgres~=3.5.0 # install legacy version 3 package (using UV)
# or
pip install soda-core-postgres~=3.5.0 # install legacy version 3 package (using pip)
For a list of supported data sources and other details, see the v3 documentation within this repository. For information about Soda Core v3, see the v3 README file and the Soda v3 online documentation.
Development
Prerequisites
- Python 3.10+
- UV (recommended) or pip 21.0+
Setup (UV — recommended)
Clone the repo and install all workspace packages with dev dependencies:
uv sync --all-packages --group dev
Setup (pip — alternative)
If you don't have UV, you can still set up a dev environment with pip:
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -e soda-core -e soda-tests -e soda-postgres # add other packages as needed
pip install pytest pre-commit pydantic python-dotenv freezegun
Running tests
uv run pytest soda-tests/
# or, if using pip:
pytest soda-tests/
Pre-commit checks
uv run pre-commit run --all-files
# or, if using pip:
pre-commit run --all-files
Quickstart
The examples show minimal configurations. For more detailed examples and explanations, see the Soda Cloud documentation.
To see detailed logs, add --verbose or -v to any of these commands.
Configure a data source
To define a local configuration for your data source and validate the connection, run the following commands.
Create data source config
soda data-source create -f ds_config.yml
| Parameter | Required | Description |
|---|---|---|
-f, --file | Yes | Output file path for the data source YAML configuration file. |
By default, the YAML file generated as ds_config.yml is a template for PostgreSQL connections. To learn how to populate a data source configuration file, see the data source reference for Soda Core.
Test data source config
soda data-source test -ds ds_config.yml
| Parameter | Required | Description |
|---|---|---|
-ds, --data-source | Yes | Path to a data source YAML configuration file. |
Create a contract
Create and populate new contract YAML file. To understand how to write a contract, see the online documentation, or the example below, which is configured to test a table or view with qualified name db.schema.dataset within a data source named postgres_ds. This table is assumed to have columns named id, name, and size. The data source name postgres_ds must match the name property in the data source configuration file.
# contract.yml
dataset: postgres_ds/db/schema/dataset
checks: # dataset level checks
- schema:
- row_count:
columns: # columns block
- name: id
checks: # column level checks
- missing:
- name: name
checks:
- missing:
threshold:
metric: percent
must_be_less_than: 10
- name: size
checks:
- invalid:
valid_values: ['S', 'M', 'L']
Verify a contract locally
To evaluate a contract, run a contract verification scan:
soda contract verify -ds ds_config.yml -c contract.yml
| Parameter | Required | Description |
|---|---|---|
-ds,--data-source | Yes | Path to a data source YAML configuration file. |
-c,--contract | Yes | Path to a data contract YAML configuration file. |
Interact with Soda Cloud
To execute commands remotely, connect Sore Core to Soda Cloud. To learn how configure Soda Cloud, see the documentation about configuring data sources and datasets and working with contracts.
Request a free Soda Cloud account
Request a free account to evaluate Soda Cloud. You’ll get access for up to three datasets.
Connect to Soda Cloud
To connect Soda Core to Soda Cloud, generate a Soda Cloud config file:
soda cloud create -f sc_config.yml
| Parameter | Required | Description |
|---|---|---|
-sc,--soda-cloud | Yes | Output file path for the Soda Cloud YAML configuration file. |
Obtain Soda Cloud credentials and add them to the Soda Cloud config file. To generate credentials, follow this procedure.
To test the connection:
soda cloud test -sc sc_config.yml
| Parameter | Required | Description |
|---|---|---|
-sc,--soda-cloud | Yes | Path to a Soda Cloud YAML configuration file. |
Publish to Soda Cloud
To publish a local contract to Soda Cloud as the source of truth:
soda contract publish -c contract.yml -sc sc_config.yml
| Parameter | Required | Description |
|---|---|---|
-c,--contract | Yes | Path to a contract YAML file. |
-sc,--soda-cloud | Yes | Path to Soda Cloud YAML configuration file. |
To publish local contract verification results to Soda Cloud, add a Soda Cloud YAML configuration file and enable the publish flag:
soda contract verify -ds ds_config.yml -c contract.yml -sc sc_config.yml -p
| Parameter | Required | Description |
|---|---|---|
-ds,--data-source | Yes | Path to a data source YAML configuration file. |
-c,--contract | Yes | Path to a data contract YAML configuration file. |
-sc,--soda-cloud | Yes | Path to a Soda Cloud YAML configuration file. |
-p,--publish | No | Publish results and contract to Soda Cloud. Requires "Manage contract" permission; learn about permissions here. |
Verify a contract remotely using Soda Runner
To verify contracts via Soda Cloud using the Soda Runner (formerly known as the Soda Agent), configure a dataset and contract in Soda Cloud and configure a runner in your environment. To obtain the Soda Cloud dataset identifier, for example postgres_ds/db/schema/dataset, open the contract in Soda Cloud, enable the Toggle Code control, and copy the identifier from the first line of the contract. To launch contract verification:
soda contract verify -sc sc_config.yml -d postgres_ds/db/schema/dataset -r
| Parameter | Required | Description |
|---|---|---|
-r,--use-runner | Yes | Use Soda Runner for execution. The legacy -a/--use-agent flag is still accepted as a deprecated alias. |
-sc,--soda-cloud | with -r | Path to a Soda Cloud YAML configuration file |
-d,--dataset | with -r | Soda Cloud dataset identifier |
-p,--publish | No | Publish results and contract to Soda Cloud. Requires "Manage contract" permission; learn about permissions here. |
To view more examples of interacting with Soda Cloud using Soda Core, see the Soda documentation.