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

dbt run-operation to call macros that have non-string arguments

说我想删除 ajs 架构作为我们开发数据库上的清理 activity,而不是作为常规 dbt 工作流程的一部分

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

也许我需要将 drop_schema 包装到另一个宏 drop_schema_str(schema_str) 中,其中 schema_str 是架构的字符串,它用于在调用之前创建一个 Relation 对象drop_schema()?

创建这个宏

{% 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}'