When you run dbt test, dbt iterates through your YAML files, and constructs a query for each test. Within your YAML file you’ll state the model the tests relate to. Placing the YAML file in the same folder can help to locate the tests easily especially as your model grows.
is there a way to write complex query on sources and compare its result with final data ? is this possible or does this require automation etl test tool?
is there a way to pass additional model parameters into all the tests? and example is shown below. If I want the custom_test to access primary_key of the model, how would I call it in the generic test as a parameter? models: - name: model1 primary_key: column1 columns: - name: column2 tests: -custom_test
I would look at writing a custom generic test which allows you to pass in variable values such as a column name of your primary key. It works much like a dbt macro. More info is here docs.getdbt.com/guides/best-practices/writing-custom-generic-tests
Hey Adam, I am facing one issue like I am not able to access any new table through dbt whatever I am creating in snowflake (after dbt and snowflake connection). I am getting error that object does not exist or not authorized. I am not sure if it is permission issue. Please help to resolve this issue. Thanks
is the yaml file needs to be stored within the same folder with the model, if there are any tests defined for that model
When you run dbt test, dbt iterates through your YAML files, and constructs a query for each test. Within your YAML file you’ll state the model the tests relate to. Placing the YAML file in the same folder can help to locate the tests easily especially as your model grows.
is there a way to write complex query on sources and compare its result with final data ? is this possible or does this require automation etl test tool?
Yep! Check out custom tests in dbt
could we take the generic tests as the embedded test from DBT, and the custom ones are just like self-defined ones
Yep you’ve got it
is there a way to pass additional model parameters into all the tests? and example is shown below. If I want the custom_test to access primary_key of the model, how would I call it in the generic test as a parameter?
models:
- name: model1
primary_key: column1
columns:
- name: column2
tests:
-custom_test
I would look at writing a custom generic test which allows you to pass in variable values such as a column name of your primary key.
It works much like a dbt macro. More info is here docs.getdbt.com/guides/best-practices/writing-custom-generic-tests
Hey Adam,
I am facing one issue like I am not able to access any new table through dbt whatever I am creating in snowflake (after dbt and snowflake connection).
I am getting error that object does not exist or not authorized.
I am not sure if it is permission issue.
Please help to resolve this issue.
Thanks
Hey this will be a permissions issue. You would have created tables in Snowflake using a role/database your dbt role didn’t have access to.
Better to create your tables through dbt
Useful Adam ..thank you !
yakışıklı abim, eline sağlık👍