Skip to content

Commit e6d50ba

Browse files
committed
Second Commit
1 parent 9964165 commit e6d50ba

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

macros/test_had_duplicates.sql

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{% macro test_has_duplicates(model, column_name) %}
2+
3+
with validation as (
4+
5+
select
6+
{{ column_name }} as even_field
7+
8+
from {{ model }}
9+
10+
),
11+
12+
validation_errors as (
13+
14+
select
15+
even_field
16+
17+
from validation
18+
-- if this is true, then even_field is actually odd!
19+
where (even_field % 2) = 1
20+
21+
)
22+
23+
select count(*)
24+
from validation_errors
25+
26+
{% endmacro %}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
3+
models:
4+
- name: stg_customers
5+
columns:
6+
- name: customer_id
7+
tests:
8+
- unique
9+
- not_null
10+
- name: stg_orders
11+
columns:
12+
- name: status
13+
tests:
14+
- accepted_values:
15+
values:
16+
- completed
17+
- shipped
18+
- returned
19+
- placed
20+
- return_pending

tests/schema.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)