add length between test
This commit is contained in:
parent
7aa667f7cf
commit
8f14f5d37d
1 changed files with 16 additions and 0 deletions
16
macros/tests/length_between.sql
Normal file
16
macros/tests/length_between.sql
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
-- Min and max length get included
|
||||||
|
{% test length_between(model, column_name, min_length, max_length) %}
|
||||||
|
|
||||||
|
with
|
||||||
|
invalid_length as (
|
||||||
|
select {{ column_name }}
|
||||||
|
from {{ model }}
|
||||||
|
where
|
||||||
|
length({{ column_name }}) not between {{ min_length }}
|
||||||
|
and {{ max_length }}
|
||||||
|
)
|
||||||
|
|
||||||
|
select *
|
||||||
|
from invalid_length
|
||||||
|
|
||||||
|
{% endtest %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue