From 8e15561b905d46f0ed9376acaac476b6c149d2c9 Mon Sep 17 00:00:00 2001 From: Nguyen Quang Binh Date: Fri, 29 Sep 2023 20:49:24 +0700 Subject: [PATCH] Change macro drop_table to be different as default macro. --- dev/dags/cosmos_seed_dag.py | 2 +- dev/dags/dbt/jaffle_shop/macros/drop_table.sql | 2 +- dev/dags/dbt/jaffle_shop_python/macros/drop_table.sql | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 dev/dags/dbt/jaffle_shop_python/macros/drop_table.sql diff --git a/dev/dags/cosmos_seed_dag.py b/dev/dags/cosmos_seed_dag.py index 33416b0b3..afdf56c72 100644 --- a/dev/dags/cosmos_seed_dag.py +++ b/dev/dags/cosmos_seed_dag.py @@ -46,7 +46,7 @@ for seed in ["raw_customers", "raw_payments", "raw_orders"]: DbtRunOperationOperator( task_id=f"drop_{seed}_if_exists", - macro_name="drop_table", + macro_name="drop_table_by_name", args={"table_name": seed}, project_dir=DBT_ROOT_PATH / "jaffle_shop", profile_config=profile_config, diff --git a/dev/dags/dbt/jaffle_shop/macros/drop_table.sql b/dev/dags/dbt/jaffle_shop/macros/drop_table.sql index ebd19e2d3..37a8b21d7 100644 --- a/dev/dags/dbt/jaffle_shop/macros/drop_table.sql +++ b/dev/dags/dbt/jaffle_shop/macros/drop_table.sql @@ -1,4 +1,4 @@ -{%- macro drop_table(table_name) -%} +{%- macro drop_table_by_name(table_name) -%} {%- set drop_query -%} DROP TABLE IF EXISTS {{ target.schema }}.{{ table_name }} CASCADE {%- endset -%} diff --git a/dev/dags/dbt/jaffle_shop_python/macros/drop_table.sql b/dev/dags/dbt/jaffle_shop_python/macros/drop_table.sql deleted file mode 100644 index ebd19e2d3..000000000 --- a/dev/dags/dbt/jaffle_shop_python/macros/drop_table.sql +++ /dev/null @@ -1,6 +0,0 @@ -{%- macro drop_table(table_name) -%} - {%- set drop_query -%} - DROP TABLE IF EXISTS {{ target.schema }}.{{ table_name }} CASCADE - {%- endset -%} - {% do run_query(drop_query) %} -{%- endmacro -%}