great expectations first suite setup
Walks through creating a first Great Expectations suite. Use it when a data agent or operator wants data quality checks on an important table and needs the minimal viable setup: a handful of expectations, a checkpoint, and readable docs. Not for advanced profiling, and not for replacing dbt tests you already have.
TL;DR
Your first GX suite should be tiny: 5 to 8 expectations on your most important table, checking the things that would page you if they broke (keys not null, IDs unique, row counts sane, values in range). Scaffold it with the CLI, add expectations in a notebook or Python script, then run it on a schedule via a checkpoint. A small suite that runs daily beats a 200-expectation suite nobody maintains.
The query
great expectations first suite setupUse this when
- you have one critical table and zero data quality checks on it
- you want failing-data alerts before downstream consumers notice
- a data agent needs a contract to validate its own outputs against
Not for
- replacing dbt tests if your stack is already dbt-native (use dbt tests there)
- full data profiling or one-off exploration (use the profiler for that, then keep only what matters)
- real-time streaming validation (GX checkpoints are batch-oriented)
Steps
- Install and initialize.
pip install great_expectations, thengreat_expectations initin your project directory to create thegx/config folder.
Expected output: gx/great_expectations.yml exists and great_expectations suite list runs without errors.
- Connect your data. Add a datasource for your warehouse or files (the docs have per-backend snippets; Postgres and file-based CSV are the simplest starts).
Expected output: great_expectations datasource list shows your new datasource.
- Create the suite and add expectations that catch real breakage. Start with these five on the key table:
expect_column_values_to_not_be_nullon the primary key,expect_column_values_to_be_uniqueon it,expect_table_row_count_to_be_betweenwith a sane band,expect_column_values_to_be_betweenon the main metric,expect_column_values_to_be_in_seton the status column.
Expected output: suite.json contains your expectations and reads like a plain-English contract.
- Build a checkpoint that runs the suite against the table. A checkpoint is just the runnable wrapper: which suite, which data, where results go.
Expected output: great_expectations checkpoint run my_checkpoint prints a validation result with success true or false.
- Schedule the checkpoint (cron, Airflow, whatever you already run) and point the action list at your alerting channel so failures notify a human.
Expected output: a deliberately broken expectation (e.g. a wrong row-count band) produces a failing validation and an alert, proving the loop works end to end.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_3cmwtUjSZ0zlatYzOq9mlw
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.