airflow.providers.microsoft.azure.hooks.adx

This module contains Azure Data Explorer hook

Module Contents

class airflow.providers.microsoft.azure.hooks.adx.AzureDataExplorerHook(azure_data_explorer_conn_id: str = default_conn_name)[source]

Bases: airflow.hooks.base.BaseHook

Interacts with Azure Data Explorer (Kusto).

Extra JSON field contains the following parameters:

{
    "tenant": "<Tenant ID>",
    "auth_method": "<Authentication method>",
    "certificate": "<Application PEM certificate>",
    "thumbprint": "<Application certificate thumbprint>"
}

Cluster:

Azure Data Explorer cluster is specified by a URL, for example: "https://help.kusto.windows.net". The parameter must be provided through Host connection detail.

Tenant ID:

To learn about tenants refer to: https://docs.microsoft.com/en-us/onedrive/find-your-office-365-tenant-id

Authentication methods:

Authentication method must be provided through "auth_method" extra parameter. Available authentication methods are:

  • AAD_APPAuthentication with AAD application certificate. Extra parameters:

    "tenant" is required when using this method. Provide application ID and application key through username and password parameters.

  • AAD_APP_CERT: Authentication with AAD application certificate. Extra parameters:

    "tenant", "certificate" and "thumbprint" are required when using this method.

  • AAD_CREDSAuthentication with AAD username and password. Extra parameters:

    "tenant" is required when using this method. Username and password parameters are used for authentication with AAD.

  • AAD_DEVICEAuthenticate with AAD device code. Please note that if you choose

    this option, you'll need to authenticate for every new instance that is initialized. It is highly recommended to create one instance and use it for all queries.

Parameters

azure_data_explorer_conn_id (str) -- Reference to the Azure Data Explorer connection.

conn_name_attr = azure_data_explorer_conn_id[source]
default_conn_name = azure_data_explorer_default[source]
conn_type = azure_data_explorer[source]
hook_name = Azure Data Explorer[source]
get_conn(self)[source]

Return a KustoClient object.

run_query(self, query: str, database: str, options: Optional[Dict] = None)[source]

Run KQL query using provided configuration, and return azure.kusto.data.response.KustoResponseDataSet instance. If query is unsuccessful AirflowException is raised.

Parameters
Returns

dict

Was this entry helpful?