Hi everyone,

I would like to start a discussion about whether Airflow should support limited 
modification of Connection objects from within DAGs, similar to how Variable 
updates are currently allowed.

As I wrote in https://github.com/apache/airflow/discussions/53544, in Airflow 
v2 I have specific DAG which

• requests API to provide access token
• updates connection

This approach was convenient for automatically refreshing temporary access 
tokens and persisting them for subsequent DAG runs.
Trying to migrate to Airflow v3, however, I found out Connection objects are 
effectively read-only for DAG authors — methods like set_extra and updating via 
Session are no longer available.

I fully understand the reasoning behind making Connection immutable in most 
cases — it helps keep the configuration consistent and safe.
However, there are real-world cases where programmatic updates of connection 
metadata (like refreshed credentials, temporary URLs, or OAuth tokens) are both 
safe and practical — especially when done in a controlled way.

I’d like to hear the community’s thoughts:

• Would it make sense to have a documented, limited API for updating connection 
attributes from DAGs?
• Should we instead encourage another pattern and what it could be?


Best regards,
Mikhail

Reply via email to