Skip to content

Conversation

@dabla
Copy link
Contributor

@dabla dabla commented Sep 2, 2025

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_dejson

Beside 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.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

…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
@violet-nspct
Copy link

violet-nspct commented Sep 2, 2025

@dabla

Should you be adding a unit test to cover the following scenario?

  • Test behavior when connection.extra contains Unicode characters

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit.

@dabla
Copy link
Contributor Author

dabla commented Sep 9, 2025

One nit.

What need's to be done to have this one merged?

@dabla
Copy link
Contributor Author

dabla commented Sep 15, 2025

All remarks have been fixed, issue number has been added in TODO, all tests have been cleaned and fixed even for PowerBI.

@potiuk potiuk merged commit 3ed3f2a into apache:main Sep 15, 2025
78 checks passed
@potiuk
Copy link
Member

potiuk commented Sep 15, 2025

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants