Skip to content

Commit 3942334

Browse files
authored
Update example for unique data test with concatenation of column names (#995)
1 parent be73fdf commit 3942334

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,14 @@ We generally recommend testing this uniqueness condition by either:
536536

537537
- generating a [surrogate_key](#generate_surrogate_key-source) for your model and testing
538538
the uniqueness of said key, OR
539-
- passing the `unique` test a concatenation of the columns (as discussed [here](https://docs.getdbt.com/docs/building-a-dbt-project/testing-and-documentation/testing/#testing-expressions)).
539+
- passing the `unique` test a concatenation of the columns:
540+
```yaml
541+
models:
542+
- name: revenue_by_product_by_month
543+
tests:
544+
- unique:
545+
column_name: "month || '-' || product"
546+
```
540547

541548
However, these approaches can become non-perfomant on large data sets, in which
542549
case we recommend using this test instead.

0 commit comments

Comments
 (0)