Thingies
This commit is contained in:
parent
bccbff7205
commit
c2f2739e7e
3 changed files with 19 additions and 1 deletions
10
code_thingies/dbtlearn/macros/no_nulls_in_columns.sql
Normal file
10
code_thingies/dbtlearn/macros/no_nulls_in_columns.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{% macro no_nulls_in_columns(model) %}
|
||||
SELECT *
|
||||
FROM
|
||||
{{ model }}
|
||||
WHERE
|
||||
{% for col in adapter.get_columns_in_relation(model) -%}
|
||||
{{col.column}} IS NULL OR
|
||||
{% endfor %}
|
||||
FALSE
|
||||
{% endmacro %}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{{ no_nulls_in_columns(ref('dim_listings_cleansed')) }}
|
||||
|
|
@ -73,4 +73,11 @@ There are two kinds of tests:
|
|||
- Singular tests: you make any `SELECT` statement you want. If the `SELECT` statement is run and any data is found, the test is considered failed. If the statement is run and no rows are returned, the test is considered passed.
|
||||
- Built-in test: just a bunch of typical stuff: uniqueness, nullability, enum validations and relationship (referential integrity)
|
||||
|
||||
You can also define your own custom generic tests.
|
||||
You can also define your own custom generic tests.
|
||||
|
||||
|
||||
## Macros
|
||||
|
||||
- Macros are jinja templates.
|
||||
- There are many built-in macros in dbt, but you can also use your own macros.
|
||||
- dbt packages exist and you can use them to have more tests and macros that you can use.
|
||||
Loading…
Add table
Add a link
Reference in a new issue