Skip to content

Fix: allow PATCH /dags to filter by tags/owners without dag_id_pattern#63665

Open
justinpakzad wants to merge 1 commit intoapache:mainfrom
justinpakzad:fix/dags-patch-pause-with-tags
Open

Fix: allow PATCH /dags to filter by tags/owners without dag_id_pattern#63665
justinpakzad wants to merge 1 commit intoapache:mainfrom
justinpakzad:fix/dags-patch-pause-with-tags

Conversation

@justinpakzad
Copy link
Contributor

@justinpakzad justinpakzad commented Mar 15, 2026


Currently the PATCH dags endpoint uses the QueryDagIdPatternSearchWithNone for the dag_id_pattern which has skip_none = False, meaning if we try to pause/unpause via tags or owners it won't work unless a value for dag_id_pattern is passed as well. This seems intentional as we wouldn't want users to accidently unpause or pause all of their dags if they mistakenly don't pass in any filters/query-params but it does pose limitations - one of them being if I try to provide the following params to the request:
params={ "update_mask": ["is_paused"], "tags": ["loader"], "tags_match_mode": "any" }
no dags would be paused even though I have dags tagged with loader. If that is the intended behavior then that's fine we should probably just update the documentation so that's clear.

The changes I'm proposing would still have the "safeguard" in place by checking if the dag_id_pattern, tags, or owners filters were passed and if not it would do something similar to what it does now and just not PATCH any of the dags. With this guard in place, we can use the existing QueryDagIdPatternSearch (which has skip_none=True) instead. This allows patching dags by tags, owners, or dag_id patterns independently.

closes: #50555

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
    Claude Sonnet 4.5 (mainly for generating test dags)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Mar 15, 2026
@justinpakzad justinpakzad marked this pull request as ready for review March 15, 2026 19:19
@justinpakzad justinpakzad force-pushed the fix/dags-patch-pause-with-tags branch from c032f2c to 3b2f945 Compare March 15, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3.0.1 v2 API /dags patch pause non-functional

1 participant