Skip to content

Add async hook for Azure Synapse pipelines#62966

Open
SameerMesiah97 wants to merge 1 commit intoapache:mainfrom
SameerMesiah97:AzureSynapsePipelineAsyncHook
Open

Add async hook for Azure Synapse pipelines#62966
SameerMesiah97 wants to merge 1 commit intoapache:mainfrom
SameerMesiah97:AzureSynapsePipelineAsyncHook

Conversation

@SameerMesiah97
Copy link
Contributor

Description

This change introduces an asynchronous hook for Azure Synapse Pipelines (AzureSynapsePipelineAsyncHook).

Previously, only a synchronous hook (AzureSynapsePipelineHook) was available. This update adds an asynchronous counterpart that mirrors the synchronous hook’s credential resolution and client creation logic using azure.synapse.artifacts.aio.AsyncArtifactsClient.

The async hook provides non-blocking methods for retrieving pipeline runs, checking pipeline run status, and cancelling pipeline runs. It supports both client-secret and default credential authentication using their asynchronous Azure identity credential equivalents.

Rationale

This change introduces the asynchronous hook as a prerequisite for implementing deferrable mode for Azure Synapse Pipeline operators.

Within the Azure provider, several services already support or are introducing deferrable execution. The Azure Data Factory (ADF) operator supports deferrable mode, and deferrable support for Azure Container Instances (ACI) is currently being introduced. Azure Synapse Pipelines should provide equivalent deferrable capabilities to maintain consistency across Azure services within the provider.

Deferrable operators require non-blocking SDK interactions within triggers running in the triggerer process. The existing synchronous Synapse hook performs blocking I/O and is therefore unsuitable for use in triggers. Introducing an async hook provides the necessary foundation for implementing deferrable support for Synapse Pipeline operators while maintaining behavioral parity with the synchronous hook.

Tests

Added unit tests verifying that:

  • get_pipeline_run_status() returns the expected status.
  • Client secret authentication uses AsyncClientSecretCredential.
  • Default credential authentication uses AsyncDefaultAzureCredential.
  • A ValueError is raised when tenant ID is missing for client secret authentication.
  • get_async_conn() reuses the cached async client.
  • refresh_conn() recreates the async client.
  • close() properly closes and clears the async client.
  • The async context manager calls close() on exit.

Documentation

A docstring has been added to AzureSynapsePipelineAsyncHook explaining its usage.

Backwards Compatibility

This change does not modify public APIs or alter existing behavior.

@SameerMesiah97 SameerMesiah97 requested a review from dabla as a code owner March 5, 2026 23:15
@SameerMesiah97 SameerMesiah97 force-pushed the AzureSynapsePipelineAsyncHook branch from df4a2ca to 8872774 Compare March 6, 2026 00:43
Introduce AzureSynapsePipelineAsyncHook as an asynchronous counterpart
to the existing AzureSynapsePipelineHook.

The async hook mirrors the synchronous hook’s credential resolution and
client creation logic while using AsyncArtifactsClient for non-blocking
pipeline run retrieval, status checks, and cancellation operations. It
supports both client-secret and default credential authentication using
their asynchronous Azure identity credential equivalents.

Add unit tests covering async client creation, credential selection,
pipeline run status retrieval, client caching, connection refresh, and
proper cleanup via close() and the async context manager.
@SameerMesiah97 SameerMesiah97 force-pushed the AzureSynapsePipelineAsyncHook branch from 8872774 to 7b37279 Compare March 6, 2026 01:36
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.

1 participant