Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Replacement for "prev_ds" and other templated variables in airflow

Looking at official documentation here, it seems that the prev_ds and other variables are being deprecated and we need to replace them with other variables. Is there a variable that provides this directly?

We do get ds and ds_nodash that we can subtract from, but was wondering if there was another variable that just gives me the previous date.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can get dag_run with Jinja template and from it to get the prev dag.

for example, for prev_ds you can use :

"{{ dag_run.get_previous_dagrun().execution_date | ds }}"

for prev_ds_nodash

"{{ dag_run.get_previous_dagrun().execution_date | ds_nodash }}"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading