-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Fix sync to async issue when getting connection for SQLExecuteQueryTrigger #55094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…uteQueryTrigger when getting connection
|
@eladkal I've added unit test |
providers/common/sql/src/airflow/providers/common/sql/triggers/sql.py
Outdated
Show resolved
Hide resolved
|
@eladkal Do you prefer using asyncio.to_thread instead of sync_to_async from asgiref? |
I believe it's good - we are using sync_to_async in other places already. |
…exists, if not falls back to sync_to_async
I am away from laptop so cant take a look at the code. As long as we are not forcing installing async packages to the users who use only sync approch that is good enough for me. |
Once providers are used in Airflow 3.1, they wont need the asgiref anymore as they would be able to use the async aget_connection method, thus the module is also only import if needed for fallback, otherwise it's not. As we have to keep providers backward compatible with Airflow 2, we need this fallback functionality. |
|
Looks good. Side comment (as a potential follow-up) - maybe we should add common.compat for aget_connection and use it in all places instead of importing from asgiref.sync import sync_to_async -> that would also help with removing this compat when we have >= 3.1 |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
Do you mean a "compat" module in common provider which is then re-used accross all providers? This would be neat but would tightly couple other providers with common provider? Or do you mean just add it in version_compat of each provider, in this case sql provider? |
Fix sync to async issue when getting connection for SQLExecuteQueryTrigger. This PR fixes the same issue that was addressed for the MSGraphAsyncOperator.
closes: #54350
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.