Repository navigation
Make SQLToolset check_query follow allow_writes like query - #74448
Merged
Lee-W merged 3 commits intoOct 9, 2026
Merged
Conversation
kaxil
approved these changes
Oct 8, 2026
With `allow_writes=True`, `check_query` reported write statements as invalid even though `query` executes them, so an agent that validated before running was told not to run a statement it was permitted to run. `check_query` now applies the same statement and `allowed_tables` rules as `query`.
…` would With `allow_writes=True` and no `allowed_tables`, `query` sends the string to the hook unparsed, but `check_query` parsed it with the single-statement guard and reported `INSERT ...; DELETE ...` as invalid. Only reject multiple statements when an allow-list is set, which is when `query` parses too.
Cover that `check_query` syntax-checks writes while `query` still sends them to the hook unparsed, and that a write to a table outside `allowed_tables` is rejected with that table named.
Lee-W
force-pushed
the
common-ai-sql-check-query-allow-writes
branch
from
October 9, 2026 04:54
bf64784 to
536e848
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
With
allow_writes=True,SQLToolset.queryexecutes write statements, butcheck_querystill reported them as invalid. An agent that validated before running was told not to run a statement it was permitted to run.What
queryandcheck_querynow share_validate_for_execution(sql, *, dialect, require_parse), socheck_queryapplies the same statement andallowed_tablesrules asquery.querypassesrequire_parse=False, so its behavior is unchanged. Withallow_writes=Trueand noallowed_tablesit does not parse, so statements sqlglot cannot parse are still sent to the database.check_querypassesrequire_parse=True: write statements are accepted whenallow_writes=True, and still get a syntax check. Withoutallowed_tablesit also accepts multiple statements, asquerydoes; withallowed_tablesboth reject them.allow_writes=False(the default), both still reject write statements.docs/toolsets/sql.rstdescribes the newcheck_querybehavior.Was generative AI tooling used to co-author this PR?
Generated-by: [Claude] following the guidelines
{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.