yu-iskw / dbt-airflow-macros

Dbt package for Apache Airflow inspired macros
https://hub.getdbt.com/yu-iskw/dbt_airflow_macros/latest/
Apache License 2.0
15 stars 3 forks source link

Airflow execution_date is not the same as dbt_airflow_macros.execution_date() #26

Open denironyx opened 2 years ago

denironyx commented 2 years ago

I notice that the dbt_airflow_macros.execution_date() only generates values for when the dbt cloud job is triggered from airflow and not when the dag is ran.

I will like to be able to import the execution_date() of airflow task run to dbt. Do you know any way to do this?

hyesunlee-hayden commented 1 year ago

I have same issue this is my dag info [2023-02-14, 05:35:30 KST] {taskinstance.py:1277} INFO - Marking task as SUCCESS. dag_id=wf_d_dbt_test, task_id=run.tg_area.fact_cust_record_week_adong_prdt_gcode, execution_date=20230205T083000, start_date=20230214T053412, end_date=20230214T053530

and this is dbt log DECLARE EXECUTION_DATE DATE DEFAULT DATE('2023-02-14'); model query DECLARE EXECUTION_DATE DATE DEFAULT DATE('{{dbt_airflow_macros.ds(timezone="Asia/Seoul")}}');

I cleared job at 2/14 that scheduled 2/5 then dbt just get start_date not execution date.