DBT运行操作调用具有非字符串参数的宏



说我想放弃ajs模式作为我们的开发数据库上的清理活动,而不是作为常规dbt工作流的一部分

dbt run-operation drop_schema --args '{relation: ajs}'

也许我需要将drop_schema包装到另一个宏drop_schema_str(schema_str)中,其中schema_str是模式的字符串,并且在调用drop_schema()之前用于制作Relation对象?

创建宏

{% macro drop_schema_str(schema) %}
{% set relation = api.Relation.create(database=target.database, schema=schema) %}
{% do drop_schema(relation) %}
{% endmacro %}

然后用

调用它
dbt run-operation drop_schema_str --args '{schema: ajs}'   

最新更新