Wojciech Nowicki
Wojciech Nowicki

Reputation: 11

dbt cloud - commands in script

is there a possibility in dbt cloud to put some dbt commands into a script file and then execute it ?

e.g.

-- dbt run-operation macro_123 -- dbt run-operation macro_123 --vars 'unit_test_name: test_no_1' -- dbt run-operation macro_123 --vars 'unit_test_name: test_no_2'

I want to gather all tests, and then run it always at once.

Upvotes: 1

Views: 126

Answers (1)

tconbeer
tconbeer

Reputation: 5805

I think the best alternative will be to write a macro to wrap your other macros. Then you can have a job with just one dbt run-operation test_runner. That macro could look like:

{% macro test_runner() %}

{% test_names = [
    "test_no_1",
    "test_no_2",
    ...
] %}

{% for t in test_names %}
    {{ macro_123(t) }}
{% endfor %}

{% endmacro %}

Upvotes: 1

Related Questions