Skip to content

Bump azure-kusto-data>=4.1.0 #33598

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
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/providers/microsoft/azure/hooks/adx.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import warnings
from typing import Any

from azure.kusto.data import ClientRequestProperties, KustoClient, KustoConnectionStringBuilder
from azure.kusto.data.exceptions import KustoServiceError
from azure.kusto.data.request import ClientRequestProperties, KustoClient, KustoConnectionStringBuilder
from azure.kusto.data.response import KustoResponseDataSetV2

from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/microsoft/azure/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ dependencies:
- azure-synapse-spark
- adal>=1.2.7
- azure-storage-file-datalake>=12.9.1
- azure-kusto-data>=4.1.0
# TODO: upgrade to newer versions of all the below libraries.
# See issue https://github.com/apache/airflow/issues/30199
- azure-mgmt-containerinstance>=1.5.0,<2.0
- azure-mgmt-datafactory>=1.0.0,<2.0
- azure-kusto-data>=0.0.43,<0.1

integrations:
- integration-name: Microsoft Azure Batch
Expand Down
2 changes: 1 addition & 1 deletion generated/provider_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@
"azure-datalake-store>=0.0.45",
"azure-identity>=1.3.1",
"azure-keyvault-secrets>=4.1.0",
"azure-kusto-data>=0.0.43,<0.1",
"azure-kusto-data>=4.1.0",
"azure-mgmt-containerinstance>=1.5.0,<2.0",
"azure-mgmt-datafactory>=1.0.0,<2.0",
"azure-mgmt-datalake-store>=0.5.0",
Expand Down
24 changes: 13 additions & 11 deletions tests/providers/microsoft/azure/hooks/test_adx.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from unittest.mock import patch

import pytest
from azure.kusto.data.request import ClientRequestProperties, KustoClient, KustoConnectionStringBuilder
from azure.kusto.data import ClientRequestProperties, KustoClient, KustoConnectionStringBuilder
from pytest import param

from airflow.exceptions import AirflowException
Expand Down Expand Up @@ -225,21 +225,23 @@ def test_get_ui_field_behaviour_placeholders(self):
param("a://usr:pw@host?tenant=my-tenant&auth_method=AAD_APP", id="no-prefix"),
],
)
@patch("airflow.providers.microsoft.azure.hooks.adx.KustoConnectionStringBuilder")
def test_backcompat_prefix_works(self, mock_client, uri):
mock_with = mock_client.with_aad_application_key_authentication
def test_backcompat_prefix_works(self, uri):
with patch.dict(os.environ, AIRFLOW_CONN_MY_CONN=uri):
AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn") # get_conn is called in init
mock_with.assert_called_once_with("host", "usr", "pw", "my-tenant")
hook = AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn") # get_conn is called in init
assert hook.connection._kcsb.data_source == "host"
assert hook.connection._kcsb.application_client_id == "usr"
assert hook.connection._kcsb.application_key == "pw"
assert hook.connection._kcsb.authority_id == "my-tenant"

@patch("airflow.providers.microsoft.azure.hooks.adx.KustoConnectionStringBuilder")
def test_backcompat_prefix_both_causes_warning(self, mock_client):
mock_with = mock_client.with_aad_application_key_authentication
def test_backcompat_prefix_both_causes_warning(self):
with patch.dict(
in_dict=os.environ,
AIRFLOW_CONN_MY_CONN="a://usr:pw@host?tenant=my-tenant&auth_method=AAD_APP"
"&extra__azure_data_explorer__auth_method=AAD_APP",
):
with pytest.warns(Warning, match="Using value for `auth_method`"):
AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn") # get_conn is called in init
mock_with.assert_called_once_with("host", "usr", "pw", "my-tenant")
hook = AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn")
assert hook.connection._kcsb.data_source == "host"
assert hook.connection._kcsb.application_client_id == "usr"
assert hook.connection._kcsb.application_key == "pw"
assert hook.connection._kcsb.authority_id == "my-tenant"