This commit is contained in:
Pablo Martin 2023-11-02 18:13:56 +01:00
parent bccbff7205
commit c2f2739e7e
3 changed files with 19 additions and 1 deletions

View 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 %}

View file

@ -0,0 +1 @@
{{ no_nulls_in_columns(ref('dim_listings_cleansed')) }}

View file

@ -74,3 +74,10 @@ There are two kinds of tests:
- 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.
## 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.