Error "'Proxy object' has no attribute ..." when rendering Airflow variable `prev_execution_date_success`

Viewed 157

During the rendering of a template that uses the Airflow variable prev_execution_date_success, like this:

rendered_and_formatted = "{{ prev_execution_date_success.strftime('%Y%m%d') }}"

... I get the error:

jinja2.exceptions.UndefinedError: 'Proxy object' has no attribute 'strftime'
1 Answers

As prev_execution_date_success variable represents the "execution date from prior successful dag run", your error will happen when no "prior successful dag run" exists yet, for example when it is the first run ever of your DAG.

Related