Skip to content

Commit

Permalink
Fix model_name retrieval; get from dbt_node_config
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajkoti committed Oct 1, 2024
1 parent c3c51cb commit 72c6164
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cosmos/operators/airflow_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_remote_sql(self) -> str:
return fp.read() # type: ignore

def drop_table_sql(self) -> None:
model_name = self.task_id.split(".")[0]
model_name = self.extra_context["dbt_node_config"]["resource_name"]
sql = f"DROP TABLE IF EXISTS {self.gcp_project}.{self.dataset}.{model_name};"
hook = BigQueryHook(
gcp_conn_id=self.gcp_conn_id,
Expand All @@ -117,7 +117,7 @@ def execute(self, context: Context) -> Any | None:
self.drop_table_sql()

sql = self.get_remote_sql()
model_name = self.task_id.split(".")[0]
model_name = self.extra_context["dbt_node_config"]["resource_name"]
# prefix explicit create command to create table
sql = f"CREATE TABLE {self.gcp_project}.{self.dataset}.{model_name} AS {sql}"

Expand Down

0 comments on commit 72c6164

Please sign in to comment.