ds_provider_azure_py_lib.linked_service

File: __init__.py Region: ds_provider_azure_py_lib/linked_service

Azure Linked Service

This module implements a linked service for Azure storage.

Example

>>> azure_linked_service = AzureLinkedService(settings=AzureLinkedServiceSettings(
...    account_name="your_account_name",
...    access_key="access key"))
>>> azure_linked_service.connect()

Submodules

Classes

AzureLinkedService

Linked service for connecting to AzureLinkedService.

AzureLinkedServiceSettings

The object containing the Azure linked service settings.

Package Contents

class ds_provider_azure_py_lib.linked_service.AzureLinkedService[source]

Bases: ds_resource_plugin_py_lib.common.resource.linked_service.LinkedService[AzureLinkedServiceSettingsType], Generic[AzureLinkedServiceSettingsType]

Linked service for connecting to AzureLinkedService.

settings: AzureLinkedServiceSettingsType
_blob_service_client: azure.storage.blob.BlobServiceClient | None = None
_table_service_client: azure.data.tables.TableServiceClient | None = None
_credential: azure.core.credentials.AzureNamedKeyCredential | None = None
check_settings_is_set() None[source]

Check if settings are set correctly.

Returns:

None

Raises:

AttributeError – If settings are not set correctly.

property type: ds_provider_azure_py_lib.enums.ResourceType

Get the type of the linked service.

Returns:

ResourceType

property connection: AzureLinkedServiceConnection

Get the connection object for Azure StorageAccount.

Returns:

AzureLinkedServiceConnection

property blob_service_client: azure.storage.blob.BlobServiceClient

Get the BlobServiceClient instance.

Returns:

BlobServiceClient

Raises:

ConnectionError – If blob service client is not connected.

property table_service_client: azure.data.tables.TableServiceClient

Get the TableServiceClient instance.

Returns:

TableServiceClient

Raises:

ConnectionError – If table service client is not connected.

get_blob_service() azure.storage.blob.BlobServiceClient[source]

Connect to Azure Blob StorageAccount.

Returns:

BlobServiceClient

get_table_service() azure.data.tables.TableServiceClient[source]

Connect to Azure Table StorageAccount.

Returns:

TableServiceClient

connect() None[source]

Connect to Azure Storage (Blob and Table), ensuring both service clients are initialized.

Returns:

None

test_connection() tuple[bool, str][source]

Test the connection to Azure Storage (Blob or Table).

Returns:

tuple[bool, str]

close() None[source]

No need to close the linked service. Just to comply with the interface.

Returns:

None

__enter__() AzureLinkedService[AzureLinkedServiceSettingsType][source]

Enter context manager.

Returns:

Returns self for use in with statement.

Return type:

AzureLinkedService

__exit__(exc_type: object, exc_val: object, exc_tb: object) None[source]

Exit context manager and close the connection.

Parameters:
  • exc_type – Exception type if an exception occurred.

  • exc_val – Exception value if an exception occurred.

  • exc_tb – Exception traceback if an exception occurred.

Returns:

None

class ds_provider_azure_py_lib.linked_service.AzureLinkedServiceSettings[source]

Bases: ds_resource_plugin_py_lib.common.resource.linked_service.LinkedServiceSettings

The object containing the Azure linked service settings.

account_name: str
access_key: str