Elementary
Elementary is a dbt package that layers automated test logging, anomaly detection, and schema-change tracking on top of the dbt project. It runs entirely inside dbt — no separate service to deploy — and writes its results into a dedicated ${ENV}__elementary schema in ClickHouse.
What it gives you
Section titled “What it gives you”- A persistent log of every dbt test run (
dbt_test_results,elementary_test_results) - Anomaly tests that flag deviations the static dbt tests would miss
- Schema-change detection that flags column adds, drops, and type changes
- A standalone HTML report (
edr report) for review outside the dbt CLI
Project wiring
Section titled “Project wiring”| Field | Value |
|---|---|
| Package | elementary-data/elementary (in dbt/dependencies.yml) |
| Schema | ${ENV}__elementary (e.g. dev__elementary, main__elementary) |
| Project-specific views | dbt/models/elementary_extensions/ (daily_test_summary, run_results_by_date, test_results_by_date) |
Initialize the schema
Section titled “Initialize the schema”After bumping the package or recreating an environment, build the elementary infrastructure tables:
uv run dbt run --select elementaryElementary intentionally ignores --full-refresh; to recreate its tables from scratch, set the Elementary-owned variable instead:
uv run dbt run --select elementary --vars "elementary_full_refresh: true"Enable tests on a model
Section titled “Enable tests on a model”Add the Elementary tests in the model’s properties.yml alongside the standard dbt tests:
models: - name: matches config: elementary: timestamp_column: event_date tests: - elementary.volume_anomalies: timestamp_column: event_date - elementary.schema_changesAvailable test types:
| Test | Detects |
|---|---|
volume_anomalies | Row-count drops or spikes vs. historical volume |
freshness_anomalies | Tables that haven’t been written to recently |
column_anomalies | Per-column null %, distinct count, min/max drift |
dimension_anomalies | Distribution shifts within categorical columns |
schema_changes | Column additions, removals, type changes |
Where results land
Section titled “Where results land”Test runs write to the ${ENV}__elementary schema:
dbt_test_results— everydbt testexecutionelementary_test_results— Elementary anomaly tests specificallyalerts_*views — failed-test summaries grouped for downstream alerting
The project-specific views in dbt/models/elementary_extensions/ (daily_test_summary, run_results_by_date, test_results_by_date) sit on top of these and are the easiest entry points for ad-hoc queries.
Standalone report
Section titled “Standalone report”Outside the dbt CLI, the edr tool generates an HTML report:
pip install 'elementary-data[clickhouse]'edr report --profile elementaryThe elementary dbt profile lives alongside the main clickhouse profile in the same profiles.yml.
Integrations
Section titled “Integrations”- dbt: Elementary runs as a dbt package — every
dbt buildpopulates its tables - ClickHouse: the only target — Elementary writes to
${ENV}__elementary - Airflow: since Elementary tests run as part of
dbt build, the daily Airflow runs continuously refresh the test history