You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amit-mittal (via GitHub)" <gi...@apache.org> on 2025/10/02 02:20:32 UTC
[I] Default parameter can create a new version of DAG after every run [airflow]
amit-mittal opened a new issue, #56319:
URL: https://github.com/apache/airflow/issues/56319
### Description
Using below `Param` with default value as today's date as mentioned in the [official doc](https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/params.html#use-params-to-provide-a-trigger-ui-form) will create a new DAG version as part of every run on a different day.
```
Param(f"{datetime.date.today()}", type="string", format="date")
```
The issue gets even worse if you accidentally use `time.time()` as the default parameter.
We should also add a `ruff lint` check to catch this.
### Use case/motivation
- Avoid accidental version creation as `serialized_dag` table can become really heavy
- Official docs recommend this, but I think either it shouldn't create a version or there should be some other best practice for dates
### Related issues
A lot of versions get created for the DAG even though engineer didn't update DAG's code
### Are you willing to submit a PR?
- [ ] 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] Default parameter can create a new version of DAG after every run [airflow]
Posted by "logan-hcg (via GitHub)" <gi...@apache.org>.
logan-hcg commented on issue #56319:
URL: https://github.com/apache/airflow/issues/56319#issuecomment-3542582639
A similar issue appears to be happening when using a python callable for Jinja templated field: https://www.astronomer.io/docs/learn/templating#use-a-python-callable-for-template-fields
--
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] Default parameter can create a new version of DAG after every run [airflow]
Posted by "amit-mittal (via GitHub)" <gi...@apache.org>.
amit-mittal commented on issue #56319:
URL: https://github.com/apache/airflow/issues/56319#issuecomment-3373326382
Also, I tried out this parameter by setting in the DAG and it seems to be different from what I was _expecting_. Even after setting this flag, DAG Processor keeps on creating different versions for this DAG - it's just that the latest version would be used when the DAG is running. It is still an issue because `serialized_dag` table contains so many unnecessary versions of the same DAG and hence the table size is increasing continuously.
--
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] Default parameter can create a new version of DAG after every run [airflow]
Posted by "souradeep07 (via GitHub)" <gi...@apache.org>.
souradeep07 commented on issue #56319:
URL: https://github.com/apache/airflow/issues/56319#issuecomment-6269862018
I've opened #75104 for this: the params docs and the `example_params_ui_tutorial` example Dag now use a fixed date instead of `datetime.date.today()`. The lint check suggested above is now covered by Airflow's Dag version inflation checker, which flags this pattern.
--
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] Default parameter can create a new version of DAG after every run [airflow]
Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
tirkarthi commented on issue #56319:
URL: https://github.com/apache/airflow/issues/56319#issuecomment-3372486690
Related : https://github.com/apache/airflow/issues/54337 . Dag versioning can be disabled on per dag basis by passing `disable_bundle_versioning` to the dag constructor.
https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#disable-bundle-versioning
--
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] Default parameter can create a new version of DAG after every run [airflow]
Posted by "amit-mittal (via GitHub)" <gi...@apache.org>.
amit-mittal commented on issue #56319:
URL: https://github.com/apache/airflow/issues/56319#issuecomment-3372964713
@tirkarthi appreciate the suggestion! Would that be the suggested best practice if a DAG wants to have `date` as one of the parameters and default behavior should be today's date for that parameter?
--
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] Default parameter can create a new version of DAG after every run [airflow]
Posted by "m8719-github (via GitHub)" <gi...@apache.org>.
m8719-github commented on issue #56319:
URL: https://github.com/apache/airflow/issues/56319#issuecomment-3706563177
> A similar issue appears to be happening when using a python callable for Jinja templated field: https://www.astronomer.io/docs/learn/templating#use-a-python-callable-for-template-fields
I opened a dedicated issue [#60064](https://github.com/apache/airflow/issues/60064) and a PR for this case, but this case is a bit different since template field callable serialization was not handled at all (likely an oversight) while `Param` serialization is well defined.
--
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