Great Expectations, Soda and dbt tests
Data Quality Automation with Python · 7 questions
Short notes
Key idea
Data quality tools package the same rules (not null, unique, in set, range, reference) with config, standard results and pipeline integration. Great Expectations is Python suites, Soda is YAML checks (SodaCL), and dbt tests live next to dbt models. Each counts failing rows; read what it counts.
Syntax
# Great Expectations 1.x
suite.add_expectation(gx.expectations.ExpectColumnValuesToBeUnique(column="order_id"))
results = batch.validate(suite) # results.success
# Soda
checks for dw_orders:
- duplicate_count(order_id) = 0
# dbt
columns:
- name: order_id
data_tests: [unique, not_null]
dbt singular test: a .sql file in tests/ returning failing rows.
Example
On the shop's dw_orders, GX fails not_null(payment_method) with 1 and unique(order_id) with 4 rows; dbt fails not_null with 1, relationships with 10, unique with 2 values, and the one-current-version singular test with 1.
Traps
- Learning syntax without the rules.
- GX counts rows; dbt unique counts values.
- Set checks usually skip NULLs; add not-null.
- Tests nobody runs: wire them into the pipeline.
Want the full lesson with step-by-step examples, a project and a certificate? Data Quality Automation with Python course, ₹120 →
- Question 1easy
What does a data quality tool give you that hand-written checks usually don't?
- Question 2easy
Which Great Expectations expectation checks that
order_idhas no repeats? - Question 3medium
GX reports unexpected_count for the uniqueness expectation on order_id. This pandas line counts the same thing. What does it print?
print(dw_orders["order_id"].duplicated(keep=False).sum())
- Question 4medium
Which SodaCL line fails when any payment method is missing?
- Question 5hard
A team builds its whole warehouse with dbt, and wants checks to stop bad data before dashboards refresh. What's the most natural first choice?
Great Expectations, Soda and dbt tests
Great Expectations, Soda and dbt tests
Great Expectations, Soda and dbt tests
Great Expectations, Soda and dbt tests
Great Expectations, Soda and dbt tests
2 more questions on this topic, with hints, and tests
Sign up free for 21 days of every question and test.