You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "itsCodyBo (via GitHub)" <gi...@apache.org> on 2025/04/10 15:46:40 UTC
[I] Add prev_ds and prev_ds_nodash back to the standard macros and do not deprecate them [airflow]
itsCodyBo opened a new issue, #49073:
URL: https://github.com/apache/airflow/issues/49073
### Description
I believe it makes sense to move `prev_ds` and `prev_ds_nodash` macros back into the standard macros list and not to deprecate them. They are extremely useful macros and from what I can tell on the documentation page their is not an obvious way to replicate them (please correct me if I'm wrong!). Especially considering that similar newer macros such as `{{ prev_start_date_success }}` seem to be a more restrictive version of this, it would make sense to keep it I think.
### Use case/motivation
Use to easily get previous execution date of current dag
### Related issues
_No response_
### Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add prev_ds and prev_ds_nodash back to the standard macros and do not deprecate them [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #49073:
URL: https://github.com/apache/airflow/issues/49073#issuecomment-2794309831
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add prev_ds and prev_ds_nodash back to the standard macros and do not deprecate them [airflow]
Posted by "hpaluch-pil (via GitHub)" <gi...@apache.org>.
hpaluch-pil commented on issue #49073:
URL: https://github.com/apache/airflow/issues/49073#issuecomment-4729468840
I use following kludge as replacement (you may need to adjust `macros.ds_add()` offset for your case):
* AirFlow 2.x: `{{ prev_ds }}`
* AirFlow 3.x: `{{ prev_start_date_success | ds if prev_start_date_success is not none else macros.ds_add(logical_date | ds , -1) }}`
That `.. if .. else ..` is required because when `prev_start_date_success` is `None` it will crash `ds` converter.
I fully agree with @itsCodyBo view - that there was no sensible reason to drop such useful macros. Note that even 3.x docs still mention them in several places - adding to more confusion (for users that are not aware that `prev_ds` no longer exists) - for example: https://github.com/apache/airflow/blob/main/airflow-core/docs/faq.rst contains:
> Why next_ds or prev_ds might not contain expected values?
Reference commit (note that message does not mention removal of these macros...): https://github.com/apache/airflow/commit/123dadda0e0648ef1412053d1743128333eecb63
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org