On this page
Lookup matches (all_lookups_found)¶
Asserts that every source row resolves against a lookup table.
Minimal example¶
Add this entry to the actions list in your flowgroup.
- name: orders_product_lookup
type: test
test_type: all_lookups_found
source: v_orders_clean
lookup_table: main.sales.products
lookup_columns: [product_id]
lookup_result_columns: [id]
Options¶
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Table or view holding the lookup keys. |
|
string |
Yes |
— |
Three-part name ( |
|
list |
Yes |
— |
Key columns in |
|
list |
Yes |
— |
Matching columns in |
|
string |
No |
|
|
Base fields¶
Common to every test action, regardless of test_type.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Action name; unique within the flowgroup. |
|
string |
Yes |
— |
Must be |
|
string |
Yes |
— |
One of the nine supported test types. Any other value is rejected at validation. |
|
string |
No |
|
Name of the generated temporary table. |
|
string |
No |
|
Table comment and function docstring. |
|
list[string] |
No |
— |
Extra upstream table or view references added to the dependency graph. See Dependency analysis reference. |
|
string |
No |
|
|
|
string |
No |
— |
Correlates this test with a test-reporting hook. |
Run lhp validate --env dev --include-tests and
lhp generate --env dev --include-tests to include test actions.
For result delivery, see Test reporting configuration.
A test action always reads its source with batch SQL. Point it at a table or a
batch view: a streaming view fails on Databricks, and lhp validate reports it
as LHP-VAL-070.
Generated output¶
Every test action generates a function decorated with
@dp.table(name="<target>", comment="<description>", temporary=True) that
returns the violation query, plus one expectation decorator per violation
bucket. The on_violation value maps to the decorator as follows:
on_violation |
Decorator |
Behavior |
|---|---|---|
|
|
Pipeline update fails when any row violates. |
|
|
Violations recorded as metrics; rows retained. |
|
|
Violating rows dropped from the output. |
For the seven built-in types the action-level on_violation drives the
decorator. For custom_sql and custom_expectations the decorators are
built from each entry in expectations using that entry’s own
on_violation.