Skip to content

Guard code_mode example DAG on SQLToolset import#69677

Merged
gopidesupavan merged 1 commit into
apache:mainfrom
zachliu:fix-code-mode-sqltoolset-guard
Jul 10, 2026
Merged

Guard code_mode example DAG on SQLToolset import#69677
gopidesupavan merged 1 commit into
apache:mainfrom
zachliu:fix-code-mode-sqltoolset-guard

Conversation

@zachliu

@zachliu zachliu commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

The example_agent_operator_code_mode DAG in providers/common/ai fails to parse when the optional [sql] extra (sqlglot) is not installed. It references SQLToolset at the module level without the if SQLToolset is not None: guard, so on a fresh environment SQLToolset is None and DAG parsing raises TypeError: 'NoneType' object is not callable.

This is a regression of the same class of bug fixed in #68497, which wrapped every SQL-dependent example DAG in this provider with the if X is not None: guard. The code-mode example was added afterward in #68407 and reintroduced the problem by omitting the guard.

This restores the established pattern: the DAG definition, its howto markers, and its registration call are all wrapped in if SQLToolset is not None:, so the DAG loads only when the optional dependency is present and no longer errors on a fresh dev environment.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • 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.

@gopidesupavan
gopidesupavan merged commit 30e6372 into apache:main Jul 10, 2026
83 checks passed
@zachliu
zachliu deleted the fix-code-mode-sqltoolset-guard branch July 10, 2026 18:09
joshuabvarghese pushed a commit to joshuabvarghese/airflow that referenced this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants