【问题标题】:dbt cloud - commands in scriptdbt cloud - 脚本中的命令
【发布时间】:2023-01-11 08:53:44
【问题描述】:

在 dbt cloud 中是否有可能将一些 dbt 命令放入脚本文件中然后执行它?

例如

-- 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'

我想收集所有测试,然后总是一次运行它。

【问题讨论】:

    标签: unit-testing command dbt


    【解决方案1】:

    我认为最好的选择是编写一个宏来包装您的其他宏。然后你就可以用一个dbt run-operation test_runner找到一份工作。该宏可能如下所示:

    {% macro test_runner() %}
    
    {% test_names = [
        "test_no_1",
        "test_no_2",
        ...
    ] %}
    
    {% for t in test_names %}
        {{ macro_123(t) }}
    {% endfor %}
    
    {% endmacro %}
    

    【讨论】:

      猜你喜欢
      • 2022-09-23
      • 2022-07-12
      • 1970-01-01
      • 1970-01-01
      • 2013-06-24
      • 2013-05-16
      • 2014-11-21
      • 2013-07-09
      • 2015-03-31
      相关资源
      最近更新 更多