soda
БесплатноБез исполняемых скриптовНе проверенSoda Core is an open-source data quality engine that verifies data contracts, YAML files of checks (row count, freshness, missing, duplicate, invalid, schema…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Soda
Overview
Soda Core (v4, current release 4.28.0 on PyPI) verifies data contracts. A contract is a YAML file with a dataset: name, a columns: list and checks; soda contract verify runs the checks against your database and exits non-zero when one fails. Packages are named soda- plus the database (soda-postgres, soda-bigquery, soda-snowflake, soda-duckdb, soda-databricks) and pull in soda-core.
The older Soda Core v3 (soda-core-postgres 3.5.x, soda scan, SodaCL such as checks for orders: and missing_count(x) = 0) is legacy and receives no new releases. Do not mix its syntax with v4 contracts. To stay on it you must pin ~=3.5.0; Soda ships a migration guide (docs.soda.io, "Migrate from v3 to v4") that converts SodaCL to contracts.
Instructions
Step 1: Install and describe the connection
python -m venv .venv && source .venv/bin/activate
pip install soda-postgres # or soda-duckdb, soda-bigquery, soda-snowflake
soda data-source create -f soda/shop_ds.yml -t postgres # writes a template
# soda/shop_ds.yml - secrets come from environment variables
type: postgres
name: shop
connection:
host: ${env.POSTGRES_HOST}
port: 5432
user: ${env.POSTGRES_USER}
password: ${env.POSTGRES_PW}
database: analytics
soda data-source test -ds soda/shop_ds.yml
Use a read-only database user. For DuckDB the connection is database: "shop.duckdb".
Step 2: Write a contract
The dataset name is the data source name, then the prefixes, then the table, separated by slashes; for Postgres the prefixes are database and schema (shop/analytics/public/orders), for DuckDB just the schema (shop/main/orders). Casing must match the database. A contract needs a columns: list even if it is empty (columns: []), and a key such as checks: may appear only once per mapping.
# soda/contracts/orders.yml
dataset: shop/analytics/public/orders
columns:
- name: order_id
checks:
- missing:
- duplicate:
- name: customer_id
checks:
- missing:
- name: status
checks:
- invalid:
valid_values: [pending, processing, shipped, delivered, cancelled, refunded]
- name: total_amount
checks:
- invalid:
name: No negative order amounts
valid_min: 0
- name: shipping_address
checks:
- missing:
name: Under 50 percent of addresses missing
threshold:
metric: percent
must_be_less_than: 50
additional: # second threshold on the same metric
must_be_less_than: 10
level: warn
checks:
- schema: # lists every column that must exist, no extras
- row_count:
threshold:
must_be_between:
greater_than: 0
less_than: 10000
- freshness:
column: created_at
threshold:
unit: hour
must_be_less_than: 24
- failed_rows:
name: Delivered orders must have a delivery date
expression: status = 'delivered' AND delivered_at IS NULL
Rules that trip people up:
- Every check has a default threshold of zero (
missing,duplicate,invalid,failed_rowsmust be 0;row_countmust be above 0). Athresholdcompares the check's own metric (the number or percent of bad rows), never the column values. To limit values usevalid_min,valid_max,valid_valuesorvalid_formatin aninvalidcheck. - The
schemacheck fails on columns in the table that the contract does not list (allow_extra_columns: falseis the default). List all columns, or setallow_extra_columns: true. thresholdtakesmust_be,must_not_be,must_be_greater_than,must_be_less_than,must_be_betweenand similar keys;level: warnmakes a breach a warning instead of a failure.- A dataset-wide
filter: "created_at >= CURRENT_DATE - INTERVAL '1 day'"limits every check to recent rows; a single check can have its ownfilter. Multi-column uniqueness:duplicate: {columns: [customer_id, order_date]}at the dataset level. Custom SQL:metricwithexpression:orquery:, andaggregatewithfunction: avg. ${var.NAME}references a variable declared undervariables:and set with--set NAME=value.
Step 3: Verify
soda contract test -c soda/contracts/orders.yml # syntax only, no database
soda contract verify -c soda/contracts/orders.yml -ds soda/shop_ds.yml
The exit code is 1 when any check fails and 0 otherwise (warnings pass). Useful flags: -v for logs, -cp with a check path to run only some checks, -cf "column=status" to filter checks, -p with -sc soda_cloud.yml to publish results to Soda Cloud.
Step 4: Python and CI
from soda_core.contracts import verify_contract_locally
result = verify_contract_locally(
data_source_file_path="soda/shop_ds.yml",
contract_file_path="soda/contracts/orders.yml",
publish=False,
)
if result.has_error
Установить soda в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл soda?
Soda Core is an open-source data quality engine that verifies data contracts, YAML files of checks (row count, freshness, missing, duplicate, invalid, schema, failed rows), against a warehouse table. Use when a user asks to test data quality, write Soda checks or contracts, validate a table before dashboards or ML use, run "soda contract verify" in CI, check freshness or duplicates, or migrate from SodaCL (soda scan) to Soda v4.
Как установить скилл soda?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл soda запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic