-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Avoid using extra_dejson method on connection in KiotaRequestAdapterHook to avoid AsyncToSync RuntimeError #55179
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
Merged
potiuk
merged 34 commits into
apache:main
from
dabla:fix/avoid-extra-dejson-in-msgraph-hook
Sep 15, 2025
Merged
Avoid using extra_dejson method on connection in KiotaRequestAdapterHook to avoid AsyncToSync RuntimeError #55179
potiuk
merged 34 commits into
apache:main
from
dabla:fix/avoid-extra-dejson-in-msgraph-hook
Sep 15, 2025
Conversation
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
…therwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop.
…async aget_connection method or not, if not fallback to sync_to_async solution
2 tasks
…or to execute_operator" This reverts commit 7d57de1.
|
Should you be adding a unit test to cover the following scenario?
|
bugraoz93
reviewed
Sep 3, 2025
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/msgraph.py
Outdated
Show resolved
Hide resolved
potiuk
approved these changes
Sep 7, 2025
Member
potiuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit.
Contributor
Author
What need's to be done to have this one merged? |
Contributor
Author
|
All remarks have been fixed, issue number has been added in TODO, all tests have been cleaned and fixed even for PowerBI. |
potiuk
approved these changes
Sep 15, 2025
Member
|
Nice! |
yash1thsa
pushed a commit
to yash1thsa/airflow
that referenced
this pull request
Sep 16, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
2 tasks
suman-himanshu
pushed a commit
to suman-himanshu/airflow
that referenced
this pull request
Sep 17, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
ArthurKretzer
pushed a commit
to ArthurKretzer/airflow
that referenced
this pull request
Sep 17, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
78 tasks
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Sep 30, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 1, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 2, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 3, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 4, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 5, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 5, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 7, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 8, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 9, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 10, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 11, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 12, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 14, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 15, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 17, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
abdulrahman305 bot
pushed a commit
to abdulrahman305/airflow
that referenced
this pull request
Oct 19, 2025
…ook to avoid AsyncToSync RuntimeError (apache#55179) * fix: do not use connection.extra_dejson until it's fixed in Airflow otherwise expect: RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop. * refactor: Refactored get_async_conn to check whether BaseHook has an async aget_connection method or not, if not fallback to sync_to_async solution * refactor: Import Connection from version_compat * refactor: Moved render_template_fields from deferrable_operator to execute_operator * Revert "refactor: Moved render_template_fields from deferrable_operator to execute_operator" This reverts commit 7d57de1. * refactor: Refactored patch_hook_and_request_adapter * refactor: Patch directly on BaseHook class * refactor: Extracted patch_hook from patch_hook_and_request_adapter * refactor: Try fixing static checks * refactor: Fixed test connection * refactor: Added test on get_conn in MSGraphTrigger * refactor: Changed match on test_get_conn in TestKiotaRequestAdapterHook * refactor: fixed static checks * refactor: Inlined connection side effects * fix: Also add method when triggering next page in MSGraphOperator, otherwise it will always fall back to GET and not the currently used * refactor: templated fields don't make sense in MSGraphTrigger * refactor: Removed unused import of Sequence * refactor: Refactored tests for msgraph * refactor: Applied same for powerbi * refactor: Fixed static checks * refactor: Fixed test powerbi list * refactor: cross compat import timezone * refactor: Added issue number in TODO * refactor: Moved Context import out of type checking * refactor: Fixed hook patches TestPowerBITrigger * refactor: Fixed classpath assertion in TestPowerBITrigger
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.
This PR fixes the "You cannot use AsyncToSync in the same thread as an async event loop - just await the async function directly." RuntimeError. The error originates from the Connection.extra_dejson property which now masks the secret.
So to temporarely avoid the issue, I just use:
json.loads(connection.extra)instead of:
connection.extra_dejsonBeside that, this PR will also check if the BaseHook has the new async aget_connection method, if it does it will use it as is, if it doesn't (which will be the case when azure provider is used with older airflow versions), then it will use the sync_to_async fallbaclk mechanism.
^ 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.