Repository navigation
Fix AsyncToSync error in Databricks deferrable operators on Airflow 3.0 - #74406
Merged
eladkal merged 2 commits intoOct 7, 2026
Merged
Conversation
On Airflow 3.0 the triggerer cannot run the synchronous connection lookup on its event loop, so every deferrable Databricks operator failed as soon as its trigger made the first API call. The connection is now fetched asynchronously once per hook, which also keeps the existing sync helpers usable from the async code path. The hook argument of get_async_connection first shipped in common-compat 1.17.0, hence the raised floor. closes: apache#71525 Co-authored-by: Saiteja Bandaru <saitejabandaru@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
Only release managers may raise provider dependency floors; the "use next version" marker asks them to pin the next common-compat release, which already includes the hook argument of get_async_connection. Co-authored-by: Isaac <no-reply@databricks.com>
moomindani
force-pushed
the
fix-databricks-async-connection-71525
branch
from
October 7, 2026 16:29
fa1a1b4 to
4a2bdd3
Compare
eladkal
approved these changes
Oct 7, 2026
1 task done
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.
On Airflow 3.0.x every deferrable Databricks operator fails in the triggerer with
RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop, because the hook resolves its connection with the syncget_connectionfrom the trigger's event loop.The hook now fills its
databricks_conncache throughget_async_connection(..., hook=self)before the first async API call, so the existing sync helpers read the cached connection. This takes over #71840 (the original author is credited as co-author); the async twins of the sync helpers from that PR are not needed with this approach.The
common-compatdependency is marked# use next versionso the release manager raises its floor: thehook=argument ofget_async_connectionfirst shipped in common-compat 1.17.0.Verified against a real Databricks workspace (deferrable
DatabricksRunNowOperator, DB-backed connection, official images): 3.0.6 fails with provider 7.21.0 and succeeds with this change; 3.1.0 and 3.2.2 also succeed with this change.Not covered here: reading
conn.extra_dejsonfrom async code can still raiseDeadlockImminentErrorwhen another trigger'sasendis in flight. The fix isget_async_extra_dejson(#74147), which is not in a released common-compat yet.closes: #71525
supersedes: #71840
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines
This pull request and its description were written by Claude Code.