Skip to content

connection string no authentication option + (local) test #457

connection string no authentication option + (local) test

connection string no authentication option + (local) test #457

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / Test Results failed Nov 19, 2023 in 0s

10 fail, 2 skipped, 274 pass in 20m 3s

       5 files  +       5         5 suites  +5   20m 3s ⏱️ + 20m 3s
   286 tests +   286     274 ✔️ +   274    2 💤 +  2  10 +10 
1 430 runs  +1 430  1 379 ✔️ +1 379  10 💤 +10  41 +41 

Results for commit b02fec3. ± Comparison against earlier commit 14d6d6d.

Annotations

Check warning on line 0 in azure-kusto-data.tests.test_e2e_data.TestE2E

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 5 runs failed: test_cloud_info (azure-kusto-data.tests.test_e2e_data.TestE2E)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.7)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
AssertionError: assert CloudInfo(log...5f571e91255a') == CloudInfo(log...5f571e91255a')
  
  Omitting 5 identical items, use -vv to show
  Differing attributes:
  ['kusto_client_redirect_uri']
  
  Drill down into differing attribute kusto_client_redirect_uri:
    kusto_client_redirect_uri: 'http://localhost' != 'https://microsoft/kustoclient'
    - https://microsoft/kustoclient
    + http://localhost
self = <tests.test_e2e_data.TestE2E object at 0x7ff76dbd6970>

    def test_cloud_info(self):
        cloud_info = CloudSettings.get_cloud_info_for_cluster(self.engine_cs)
        assert cloud_info is not CloudSettings.DEFAULT_CLOUD
>       assert cloud_info == CloudSettings.DEFAULT_CLOUD
E       AssertionError: assert CloudInfo(log...5f571e91255a') == CloudInfo(log...5f571e91255a')
E         
E         Omitting 5 identical items, use -vv to show
E         Differing attributes:
E         ['kusto_client_redirect_uri']
E         
E         Drill down into differing attribute kusto_client_redirect_uri:
E           kusto_client_redirect_uri: 'http://localhost' != 'https://microsoft/kustoclient'
E           - https://microsoft/kustoclient
E           + http://localhost

azure-kusto-data/tests/test_e2e_data.py:340: AssertionError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_sanity_query (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ebfc280>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'Deft', payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ebfc280>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'Deft', payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '[{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, ..._count\\":11,\\"table_size\\":2444}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: [{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, "TableName": "@ExtendedProperties", "TableKind": "QueryProperties", "Columns": [{"ColumnName": "TableId", "ColumnType": "int"}, {"ColumnName": "Key", "ColumnType": "string"}, {"ColumnName": "Value", "ColumnType": "dynamic"}], "Rows": [[1, "Visualization", "{\"Visualization\":null,\"Title\":null,\"XColumn\":null,\"Series\":null,\"YColumns\":null,\"XTitle\":null,\"YTitle\":null,\"XAxis\":null,\"YAxis\":null,\"Legend\":null,\"YSplit\":null,\"Accumulate\":false,\"IsQuerySorted\":false,\"Kind\":null}"]]}, {"FrameType": "DataTable", "TableId": 1, "TableName": "Deft", "TableKind": "PrimaryResult", "Columns": [{"ColumnName": "rownumber", "ColumnType": "int"}, {"ColumnName": "rowguid", "ColumnType": "string"}, {"ColumnName": "xdouble", "ColumnType": "real"}, {"ColumnName": "xfloat", "ColumnType": "real"}, {"ColumnName": "xbool", "ColumnType": "bool"}, {"ColumnName": "xint16", "ColumnType": "int"}, {"ColumnName": "xint32", "ColumnType": "int"}, {"ColumnName": "xint64", "ColumnType": "long"}, {"ColumnName": "xuint8", "ColumnType": "long"}, {"ColumnName": "xuint16", "ColumnType": "long"}, {"ColumnName": "xuint32", "ColumnType": "long"}, {"ColumnName": "xuint64", "ColumnType": "long"}, {"ColumnName": "xdate", "ColumnType": "datetime"}, {"ColumnName": "xsmalltext", "ColumnType": "string"}, {"ColumnName": "xtext", "ColumnType": "string"}, {"ColumnName": "xnumberAsText", "ColumnType": "string"}, {"ColumnName": "xtime", "ColumnType": "timespan"}, {"ColumnName": "xtextWithNulls", "ColumnType": "string"}, {"ColumnName": "xdynamicWithNulls", "ColumnType": "dynamic"}], "Rows": [[null, "", null, null, null, null, null, null, null, null, null, null, null, "", "", "", null, "", ""], [0, "00000000-0000-0000-0001-020304050607", 0.0, 0.0, false, 0, 0, 0, 0, 0, 0, 0, "2014-01-01T01:01:01.0000000Z", "Zero", "Zero", "0", "00:00:00", "", ""], [1, "00000001-0000-0000-0001-020304050607", 1.0001, 1.01, true, 1, 1, 1, 1, 1, 1, 1, "2015-01-01T01:01:01.0000001Z", "One", "One", "1", "1.00:00:01.0010001", "", {"rowId": 1, "arr": [0, 1]}], [2, "00000002-0000-0000-0001-020304050607", 2.0002, 2.02, false, 2, 2, 2, 2, 2, 2, 2, "2016-01-01T01:01:01.0000002Z", "Two", "Two", "2", "-2.00:00:02.0020002", "", {"rowId": 2, "arr": [0, 2]}], [3, "00000003-0000-0000-0001-020304050607", 3.0003, 3.03, true, 3, 3, 3, 3, 3, 3, 3, "2017-01-01T01:01:01.0000003Z", "Three", "Three", "3", "3.00:00:03.0030003", "", {"rowId": 3, "arr": [0, 3]}], [4, "00000004-0000-0000-0001-020304050607", 4.0004, 4.04, false, 4, 4, 4, 4, 4, 4, 4, "2018-01-01T01:01:01.0000004Z", "Four", "Four", "4", "-4.00:00:04.0040004", "", {"rowId": 4, "arr": [0, 4]}], [5, "00000005-0000-0000-0001-020304050607", 5.0005, 5.05, true, 5, 5, 5, 5, 5, 5, 5, "2019-01-01T01:01:01.0000005Z", "Five", "Five", "5", "5.00:00:05.0050005", "", {"rowId": 5, "arr": [0, 5]}], [6, "00000006-0000-0000-0001-020304050607", 6.0006, 6.06, false, 6, 6, 6, 6, 6, 6, 6, "2020-01-01T01:01:01.0000006Z", "Six", "Six", "6", "-6.00:00:06.0060006", "", {"rowId": 6, "arr": [0, 6]}], [7, "00000007-0000-0000-0001-020304050607", 7.0007, 7.07, true, 7, 7, 7, 7, 7, 7, 7, "2021-01-01T01:01:01.0000007Z", "Seven", "Seven", "7", "7.00:00:07.0070007", "", {"rowId": 7, "arr": [0, 7]}], [8, "00000008-0000-0000-0001-020304050607", 8.0008, 8.08, false, 8, 8, 8, 8, 8, 8, 8, "2022-01-01T01:01:01.0000008Z", "Eight", "Eight", "8", "-8.00:00:08.0080008", "", {"rowId": 8, "arr": [0, 8]}], [9, "00000009-0000-0000-0001-020304050607", 9.0009, 9.09, true, 9, 9, 9, 9, 9, 9, 9, "2023-01-01T01:01:01.0000009Z", "Nine", "Nine", "9", "9.00:00:09.0090009", "", {"rowId": 9, "arr": [0, 9]}]]}, {"FrameType": "DataTable", "TableId": 2, "TableName": "QueryCompletionInformation", "TableKind": "QueryCompletionInformation", "Columns": [{"ColumnName": "Timestamp", "ColumnType": "datetime"}, {"ColumnName": "ClientRequestId", "ColumnType": "string"}, {"ColumnName": "ActivityId", "ColumnType": "guid"}, {"ColumnName": "SubActivityId", "ColumnType": "guid"}, {"ColumnName": "ParentActivityId", "ColumnType": "guid"}, {"ColumnName": "Level", "ColumnType": "int"}, {"ColumnName": "LevelName", "ColumnType": "string"}, {"ColumnName": "StatusCode", "ColumnType": "int"}, {"ColumnName": "StatusCodeName", "ColumnType": "string"}, {"ColumnName": "EventType", "ColumnType": "int"}, {"ColumnName": "EventTypeName", "ColumnType": "string"}, {"ColumnName": "Payload", "ColumnType": "string"}], "Rows": [["2018-04-30T12:25:11.0778067Z", "unspecified;cc5ee2b9-9b77-4509-9a61-84ec8f0159c2", "eeac049e-8a7d-4188-b797-6b5f2c9f9526", "c6fb9714-5183-4092-8a02-825bd7aa1aee", "df0aaeb0-4c8a-4d77-bc77-f714a4484a6b", 4, "Info", 0, "S_OK (0)", 4, "QueryInfo", "{\"Count\":1,\"Text\":\"Query completed successfully\"}"], ["2018-04-30T12:25:11.0778067Z", "unspecified;cc5ee2b9-9b77-4509-9a61-84ec8f0159c2", "eeac049e-8a7d-4188-b797-6b5f2c9f9526", "c6fb9714-5183-4092-8a02-825bd7aa1aee", "df0aaeb0-4c8a-4d77-bc77-f714a4484a6b", 6, "Stats", 0, "S_OK (0)", 0, "QueryResourceConsumption", "{\"ExecutionTime\":0.0156154,\"resource_usage\":{\"cache\":{\"memory\":{\"hits\":40,\"misses\":0,\"total\":40},\"disk\":{\"hits\":0,\"misses\":0,\"total\":0}},\"cpu\":{\"user\":\"00:00:00\",\"kernel\":\"00:00:00\",\"total cpu\":\"00:00:00\"},\"memory\":{\"peak_per_node\":0}},\"dataset_statistics\":[{\"table_row_count\":11,\"table_size\":2444}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f286730>

    @aio_documented_by(KustoClientTestsSync.test_sanity_query)
    @pytest.mark.asyncio
    async def test_sanity_query(self):
        with aioresponses() as aioresponses_mock:
            self._mock_query(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
>               response = await client.execute_query("PythonTest", "Deft")

azure-kusto-data/tests/aio/test_kusto_client.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
    return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_sanity_control_command (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec02550>
endpoint = 'https://somecluster.kusto.windows.net/v1/rest/mgmt'
database = 'NetDefaultDB', query = '.show version', payload = None
timeout = datetime.timedelta(seconds=3660), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v1/rest/mgmt) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec02550>
endpoint = 'https://somecluster.kusto.windows.net/v1/rest/mgmt'
database = 'NetDefaultDB', query = '.show version', payload = None
timeout = datetime.timedelta(seconds=3660), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v1/rest/mgmt', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v1/rest/mgmt) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '{"Tables": [{"TableName": "Table_0", "Columns": [{"ColumnName": "BuildVersion", "DataType": "String"}, {"ColumnName":...", "DataType": "String"}], "Rows": [["1.0.6693.14577", "2018-04-29T08:05:54Z", "Engine", "KustoMain_2018.04.29.5"]]}]}'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: {"Tables": [{"TableName": "Table_0", "Columns": [{"ColumnName": "BuildVersion", "DataType": "String"}, {"ColumnName": "BuildTime", "DataType": "DateTime"}, {"ColumnName": "ServiceType", "DataType": "String"}, {"ColumnName": "ProductVersion", "DataType": "String"}], "Rows": [["1.0.6693.14577", "2018-04-29T08:05:54Z", "Engine", "KustoMain_2018.04.29.5"]]}]}

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f286cd0>

    @aio_documented_by(KustoClientTestsSync.test_sanity_control_command)
    @pytest.mark.asyncio
    async def test_sanity_control_command(self):
        with aioresponses() as aioresponses_mock:
            self._mock_mgmt(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
>               response = await client.execute_mgmt("NetDefaultDB", ".show version")

azure-kusto-data/tests/aio/test_kusto_client.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:66: in execute_mgmt
    return await self._execute(self._mgmt_endpoint, database, query, None, KustoClient._mgmt_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v1/rest/mgmt) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_sanity_data_frame (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75eee7340>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'Deft', payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75eee7340>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'Deft', payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '[{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, ..._count\\":11,\\"table_size\\":2444}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: [{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, "TableName": "@ExtendedProperties", "TableKind": "QueryProperties", "Columns": [{"ColumnName": "TableId", "ColumnType": "int"}, {"ColumnName": "Key", "ColumnType": "string"}, {"ColumnName": "Value", "ColumnType": "dynamic"}], "Rows": [[1, "Visualization", "{\"Visualization\":null,\"Title\":null,\"XColumn\":null,\"Series\":null,\"YColumns\":null,\"XTitle\":null,\"YTitle\":null,\"XAxis\":null,\"YAxis\":null,\"Legend\":null,\"YSplit\":null,\"Accumulate\":false,\"IsQuerySorted\":false,\"Kind\":null}"]]}, {"FrameType": "DataTable", "TableId": 1, "TableName": "Deft", "TableKind": "PrimaryResult", "Columns": [{"ColumnName": "rownumber", "ColumnType": "int"}, {"ColumnName": "rowguid", "ColumnType": "string"}, {"ColumnName": "xdouble", "ColumnType": "real"}, {"ColumnName": "xfloat", "ColumnType": "real"}, {"ColumnName": "xbool", "ColumnType": "bool"}, {"ColumnName": "xint16", "ColumnType": "int"}, {"ColumnName": "xint32", "ColumnType": "int"}, {"ColumnName": "xint64", "ColumnType": "long"}, {"ColumnName": "xuint8", "ColumnType": "long"}, {"ColumnName": "xuint16", "ColumnType": "long"}, {"ColumnName": "xuint32", "ColumnType": "long"}, {"ColumnName": "xuint64", "ColumnType": "long"}, {"ColumnName": "xdate", "ColumnType": "datetime"}, {"ColumnName": "xsmalltext", "ColumnType": "string"}, {"ColumnName": "xtext", "ColumnType": "string"}, {"ColumnName": "xnumberAsText", "ColumnType": "string"}, {"ColumnName": "xtime", "ColumnType": "timespan"}, {"ColumnName": "xtextWithNulls", "ColumnType": "string"}, {"ColumnName": "xdynamicWithNulls", "ColumnType": "dynamic"}], "Rows": [[null, "", null, null, null, null, null, null, null, null, null, null, null, "", "", "", null, "", ""], [0, "00000000-0000-0000-0001-020304050607", 0.0, 0.0, false, 0, 0, 0, 0, 0, 0, 0, "2014-01-01T01:01:01.0000000Z", "Zero", "Zero", "0", "00:00:00", "", ""], [1, "00000001-0000-0000-0001-020304050607", 1.0001, 1.01, true, 1, 1, 1, 1, 1, 1, 1, "2015-01-01T01:01:01.0000001Z", "One", "One", "1", "1.00:00:01.0010001", "", {"rowId": 1, "arr": [0, 1]}], [2, "00000002-0000-0000-0001-020304050607", 2.0002, 2.02, false, 2, 2, 2, 2, 2, 2, 2, "2016-01-01T01:01:01.0000002Z", "Two", "Two", "2", "-2.00:00:02.0020002", "", {"rowId": 2, "arr": [0, 2]}], [3, "00000003-0000-0000-0001-020304050607", 3.0003, 3.03, true, 3, 3, 3, 3, 3, 3, 3, "2017-01-01T01:01:01.0000003Z", "Three", "Three", "3", "3.00:00:03.0030003", "", {"rowId": 3, "arr": [0, 3]}], [4, "00000004-0000-0000-0001-020304050607", 4.0004, 4.04, false, 4, 4, 4, 4, 4, 4, 4, "2018-01-01T01:01:01.0000004Z", "Four", "Four", "4", "-4.00:00:04.0040004", "", {"rowId": 4, "arr": [0, 4]}], [5, "00000005-0000-0000-0001-020304050607", 5.0005, 5.05, true, 5, 5, 5, 5, 5, 5, 5, "2019-01-01T01:01:01.0000005Z", "Five", "Five", "5", "5.00:00:05.0050005", "", {"rowId": 5, "arr": [0, 5]}], [6, "00000006-0000-0000-0001-020304050607", 6.0006, 6.06, false, 6, 6, 6, 6, 6, 6, 6, "2020-01-01T01:01:01.0000006Z", "Six", "Six", "6", "-6.00:00:06.0060006", "", {"rowId": 6, "arr": [0, 6]}], [7, "00000007-0000-0000-0001-020304050607", 7.0007, 7.07, true, 7, 7, 7, 7, 7, 7, 7, "2021-01-01T01:01:01.0000007Z", "Seven", "Seven", "7", "7.00:00:07.0070007", "", {"rowId": 7, "arr": [0, 7]}], [8, "00000008-0000-0000-0001-020304050607", 8.0008, 8.08, false, 8, 8, 8, 8, 8, 8, 8, "2022-01-01T01:01:01.0000008Z", "Eight", "Eight", "8", "-8.00:00:08.0080008", "", {"rowId": 8, "arr": [0, 8]}], [9, "00000009-0000-0000-0001-020304050607", 9.0009, 9.09, true, 9, 9, 9, 9, 9, 9, 9, "2023-01-01T01:01:01.0000009Z", "Nine", "Nine", "9", "9.00:00:09.0090009", "", {"rowId": 9, "arr": [0, 9]}]]}, {"FrameType": "DataTable", "TableId": 2, "TableName": "QueryCompletionInformation", "TableKind": "QueryCompletionInformation", "Columns": [{"ColumnName": "Timestamp", "ColumnType": "datetime"}, {"ColumnName": "ClientRequestId", "ColumnType": "string"}, {"ColumnName": "ActivityId", "ColumnType": "guid"}, {"ColumnName": "SubActivityId", "ColumnType": "guid"}, {"ColumnName": "ParentActivityId", "ColumnType": "guid"}, {"ColumnName": "Level", "ColumnType": "int"}, {"ColumnName": "LevelName", "ColumnType": "string"}, {"ColumnName": "StatusCode", "ColumnType": "int"}, {"ColumnName": "StatusCodeName", "ColumnType": "string"}, {"ColumnName": "EventType", "ColumnType": "int"}, {"ColumnName": "EventTypeName", "ColumnType": "string"}, {"ColumnName": "Payload", "ColumnType": "string"}], "Rows": [["2018-04-30T12:25:11.0778067Z", "unspecified;cc5ee2b9-9b77-4509-9a61-84ec8f0159c2", "eeac049e-8a7d-4188-b797-6b5f2c9f9526", "c6fb9714-5183-4092-8a02-825bd7aa1aee", "df0aaeb0-4c8a-4d77-bc77-f714a4484a6b", 4, "Info", 0, "S_OK (0)", 4, "QueryInfo", "{\"Count\":1,\"Text\":\"Query completed successfully\"}"], ["2018-04-30T12:25:11.0778067Z", "unspecified;cc5ee2b9-9b77-4509-9a61-84ec8f0159c2", "eeac049e-8a7d-4188-b797-6b5f2c9f9526", "c6fb9714-5183-4092-8a02-825bd7aa1aee", "df0aaeb0-4c8a-4d77-bc77-f714a4484a6b", 6, "Stats", 0, "S_OK (0)", 0, "QueryResourceConsumption", "{\"ExecutionTime\":0.0156154,\"resource_usage\":{\"cache\":{\"memory\":{\"hits\":40,\"misses\":0,\"total\":40},\"disk\":{\"hits\":0,\"misses\":0,\"total\":0}},\"cpu\":{\"user\":\"00:00:00\",\"kernel\":\"00:00:00\",\"total cpu\":\"00:00:00\"},\"memory\":{\"peak_per_node\":0}},\"dataset_statistics\":[{\"table_row_count\":11,\"table_size\":2444}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f286ca0>

    @pytest.mark.skipif(not PANDAS, reason="requires pandas")
    @aio_documented_by(KustoClientTestsSync.test_sanity_data_frame)
    @pytest.mark.asyncio
    async def test_sanity_data_frame(self):
        with aioresponses() as aioresponses_mock:
            self._mock_query(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
>               response = await client.execute_query("PythonTest", "Deft")

azure-kusto-data/tests/aio/test_kusto_client.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
    return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_partial_results (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec63c10>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest'
query = 'set truncationmaxrecords = 5;\nrange x from 1 to 10 step 1'
payload = None, timeout = datetime.timedelta(seconds=300)
properties = <azure.kusto.data.client_request_properties.ClientRequestProperties object at 0x7ff75eb79f70>
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec63c10>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest'
query = 'set truncationmaxrecords = 5;\nrange x from 1 to 10 step 1'
payload = None, timeout = datetime.timedelta(seconds=300)
properties = <azure.kusto.data.client_request_properties.ClientRequestProperties object at 0x7ff75eb79f70>
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '[{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, ...72-8846-49e6-b458-460b841ed47d > PO-OWIN-CallContext/a57ec272-8846-49e6-b458-460b841ed47d)"}, "@permanent": false}}]}]'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: [{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, "TableKind": "QueryProperties", "TableName": "@ExtendedProperties", "Columns": [{"ColumnName": "TableId", "ColumnType": "int"}, {"ColumnName": "Key", "ColumnType": "string"}, {"ColumnName": "Value", "ColumnType": "dynamic"}], "Rows": [[1, "Visualization", "{\"Visualization\":null,\"Title\":null,\"XColumn\":null,\"Series\":null,\"YColumns\":null,\"AnomalyColumns\":null,\"XTitle\":null,\"YTitle\":null,\"XAxis\":null,\"YAxis\":null,\"Legend\":null,\"YSplit\":null,\"Accumulate\":false,\"IsQuerySorted\":false,\"Kind\":null}"]]}, {"FrameType": "DataTable", "TableId": 1, "TableKind": "PrimaryResult", "TableName": "PrimaryResult", "Columns": [{"ColumnName": "x", "ColumnType": "long"}], "Rows": [[1], [2], [3], [4], [5], {"OneApiErrors": [{"error": {"code": "LimitsExceeded", "message": "Request is invalid and cannot be executed.", "@type": "Kusto.Data.Exceptions.KustoServicePartialQueryFailureLimitsExceededException", "@message": "Query execution has exceeded the allowed limits (80DA0003): .", "@context": {"timestamp": "2018-12-10T15:10:48.8352222Z", "machineName": "RD0003FFBEDEB9", "processName": "Kusto.Azure.Svc", "processId": 4328, "threadId": 7284, "appDomainName": "RdRuntime", "clientRequestId": "KPC.execute;d3a43e37-0d7f-47a9-b6cd-a889b2aee3d3", "activityId": "a57ec272-8846-49e6-b458-460b841ed47d", "subActivityId": "a57ec272-8846-49e6-b458-460b841ed47d", "activityType": "PO-OWIN-CallContext", "parentActivityId": "a57ec272-8846-49e6-b458-460b841ed47d", "activityStack": "(Activity stack: CRID=KPC.execute;d3a43e37-0d7f-47a9-b6cd-a889b2aee3d3 ARID=a57ec272-8846-49e6-b458-460b841ed47d > PO-OWIN-CallContext/a57ec272-8846-49e6-b458-460b841ed47d)"}, "@permanent": false}}]}]}, {"FrameType": "DataSetCompletion", "HasErrors": true, "Cancelled": false, "OneApiErrors": [{"error": {"code": "LimitsExceeded", "message": "Request is invalid and cannot be executed.", "@type": "Kusto.Data.Exceptions.KustoServicePartialQueryFailureLimitsExceededException", "@message": "Query execution has exceeded the allowed limits (80DA0003): .", "@context": {"timestamp": "2018-12-10T15:10:48.8352222Z", "machineName": "RD0003FFBEDEB9", "processName": "Kusto.Azure.Svc", "processId": 4328, "threadId": 7284, "appDomainName": "RdRuntime", "clientRequestId": "KPC.execute;d3a43e37-0d7f-47a9-b6cd-a889b2aee3d3", "activityId": "a57ec272-8846-49e6-b458-460b841ed47d", "subActivityId": "a57ec272-8846-49e6-b458-460b841ed47d", "activityType": "PO-OWIN-CallContext", "parentActivityId": "a57ec272-8846-49e6-b458-460b841ed47d", "activityStack": "(Activity stack: CRID=KPC.execute;d3a43e37-0d7f-47a9-b6cd-a889b2aee3d3 ARID=a57ec272-8846-49e6-b458-460b841ed47d > PO-OWIN-CallContext/a57ec272-8846-49e6-b458-460b841ed47d)"}, "@permanent": false}}]}]

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f286e80>

        @aio_documented_by(KustoClientTestsSync.test_partial_results)
        @pytest.mark.asyncio
        async def test_partial_results(self):
            async with KustoClient(self.HOST) as client:
                query = """set truncationmaxrecords = 5;
    range x from 1 to 10 step 1"""
                properties = ClientRequestProperties()
                properties.set_option(ClientRequestProperties.results_defer_partial_query_failures_option_name, False)
                with aioresponses() as aioresponses_mock:
                    self._mock_query(aioresponses_mock)
                    with pytest.raises(KustoMultiApiError) as e:
>                       await client.execute_query("PythonTest", query, properties)

azure-kusto-data/tests/aio/test_kusto_client.py:116: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
    return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_admin_then_query (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75eb3b7c0>
endpoint = 'https://somecluster.kusto.windows.net/v1/rest/mgmt'
database = 'PythonTest'
query = '.show tables | project DatabaseName, TableName', payload = None
timeout = datetime.timedelta(seconds=3660), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v1/rest/mgmt) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75eb3b7c0>
endpoint = 'https://somecluster.kusto.windows.net/v1/rest/mgmt'
database = 'PythonTest'
query = '.show tables | project DatabaseName, TableName', payload = None
timeout = datetime.timedelta(seconds=3660), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v1/rest/mgmt', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v1/rest/mgmt) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '{"Tables": [{"TableName": "Table_0", "Columns": [{"ColumnName": "DatabaseName", "DataType": "String"}, {"ColumnName":...a-818e-431f-9147-6b72547cca3d", ""], [2, "QueryStatus", "QueryStatus", "00000000-0000-0000-0000-000000000000", ""]]}]}'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: {"Tables": [{"TableName": "Table_0", "Columns": [{"ColumnName": "DatabaseName", "DataType": "String"}, {"ColumnName": "TableName", "DataType": "String"}], "Rows": [["Kuskus", "KustoLogs"], ["Kuskus", "LiorTmp"]]}, {"TableName": "Table_1", "Columns": [{"ColumnName": "Value", "DataType": "String"}], "Rows": [["{\"Visualization\": null,\"Title\": null,\"XColumn\": null,\"Series\": null,\"YColumns\": null,\"XTitle\": null,\"YTitle\": null,\"XAxis\": null,\"YAxis\": null,\"Legend\": null,\"YSplit\": null,\"Accumulate\": false,\"IsQuerySorted\": false,\"Kind\": null}"]]}, {"TableName": "Table_2", "Columns": [{"ColumnName": "Timestamp", "DataType": "DateTime"}, {"ColumnName": "Severity", "DataType": "Int32"}, {"ColumnName": "SeverityName", "DataType": "String"}, {"ColumnName": "StatusCode", "DataType": "Int32"}, {"ColumnName": "StatusDescription", "DataType": "String"}, {"ColumnName": "Count", "DataType": "Int32"}, {"ColumnName": "RequestId", "DataType": "Guid"}, {"ColumnName": "ActivityId", "DataType": "Guid"}, {"ColumnName": "SubActivityId", "DataType": "Guid"}, {"ColumnName": "ClientActivityId", "DataType": "String"}], "Rows": [["2018-08-12T09:13:19.5200972Z", 4, "Info", 0, "Querycompletedsuccessfully", 1, "b6651693-9325-41c8-a5bf-dcc21202cdf2", "b6651693-9325-41c8-a5bf-dcc21202cdf2", "1cfa59c2-7f29-4e58-aef8-590d4609818f", "KPC.execute;721add30-f61a-44d0-ad89-812d06736260"], ["2018-08-12T09:13:19.5200972Z", 6, "Stats", 0, {"ExecutionTime": 0.0, "resource_usage": {"cache": {"memory": {"hits": 0, "misses": 0, "total": 0}, "disk": {"hits": 0, "misses": 0, "total": 0}}, "cpu": {"user": "00:00:00", "kernel": "00:00:00", "total cpu": "00:00:00"}, "memory": {"peak_per_node": 0}}, "input_dataset_statistics": {"extents": {"total": 0, "scanned": 0}, "rows": {"total": 0, "scanned": 0}}, "dataset_statistics": [{"table_row_count": 2, "table_size": 46}]}, 1, "b6651693-9325-41c8-a5bf-dcc21202cdf2", "b6651693-9325-41c8-a5bf-dcc21202cdf2", "1cfa59c2-7f29-4e58-aef8-590d4609818f", "KPC.execute;721add30-f61a-44d0-ad89-812d06736260"]]}, {"TableName": "Table_3", "Columns": [{"ColumnName": "Ordinal", "DataType": "Int64"}, {"ColumnName": "Kind", "DataType": "String"}, {"ColumnName": "Name", "DataType": "String"}, {"ColumnName": "Id", "DataType": "String"}, {"ColumnName": "PrettyName", "DataType": "String"}], "Rows": [[0, "QueryResult", "PrimaryResult", "d6331ef2-d9f7-4d8c-8268-99f574babc82", ""], [1, "QueryProperties", "@ExtendedProperties", "876ccb1a-818e-431f-9147-6b72547cca3d", ""], [2, "QueryStatus", "QueryStatus", "00000000-0000-0000-0000-000000000000", ""]]}]}

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f286c10>

    @aio_documented_by(KustoClientTestsSync.test_admin_then_query)
    @pytest.mark.asyncio
    async def test_admin_then_query(self):
        with aioresponses() as aioresponses_mock:
            self._mock_mgmt(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
                query = ".show tables | project DatabaseName, TableName"
>               response = await client.execute_mgmt("PythonTest", query)

azure-kusto-data/tests/aio/test_kusto_client.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:66: in execute_mgmt
    return await self._execute(self._mgmt_endpoint, database, query, None, KustoClient._mgmt_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v1/rest/mgmt) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_dynamic (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75e8d47c0>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest'
query = 'print dynamic(123), dynamic("123"), dynamic("test bad json"),'
payload = None, timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75e8d47c0>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest'
query = 'print dynamic(123), dynamic("123"), dynamic("test bad json"),'
payload = None, timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '[{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, ...ow_count\\":1,\\"table_size\\":141}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: [{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, "TableKind": "QueryProperties", "TableName": "@ExtendedProperties", "Columns": [{"ColumnName": "TableId", "ColumnType": "int"}, {"ColumnName": "Key", "ColumnType": "string"}, {"ColumnName": "Value", "ColumnType": "dynamic"}], "Rows": [[1, "Visualization", "{\"Visualization\":null,\"Title\":null,\"XColumn\":null,\"Series\":null,\"YColumns\":null,\"AnomalyColumns\":null,\"XTitle\":null,\"YTitle\":null,\"XAxis\":null,\"YAxis\":null,\"Legend\":null,\"YSplit\":null,\"Accumulate\":false,\"IsQuerySorted\":false,\"Kind\":null,\"Ymin\":\"NaN\",\"Ymax\":\"NaN\"}"]]}, {"FrameType": "DataTable", "TableId": 1, "TableKind": "PrimaryResult", "TableName": "PrimaryResult", "Columns": [{"ColumnName": "print_0", "ColumnType": "dynamic"}, {"ColumnName": "print_1", "ColumnType": "dynamic"}, {"ColumnName": "print_2", "ColumnType": "dynamic"}, {"ColumnName": "print_3", "ColumnType": "dynamic"}, {"ColumnName": "print_4", "ColumnType": "dynamic"}, {"ColumnName": "print_5", "ColumnType": "dynamic"}], "Rows": [[123, "123", "test bad json", null, "{\"rowId\":2,\"arr\":[0,2]}", {"rowId": 2, "arr": [0, 2]}]]}, {"FrameType": "DataTable", "TableId": 2, "TableKind": "QueryCompletionInformation", "TableName": "QueryCompletionInformation", "Columns": [{"ColumnName": "Timestamp", "ColumnType": "datetime"}, {"ColumnName": "ClientRequestId", "ColumnType": "string"}, {"ColumnName": "ActivityId", "ColumnType": "guid"}, {"ColumnName": "SubActivityId", "ColumnType": "guid"}, {"ColumnName": "ParentActivityId", "ColumnType": "guid"}, {"ColumnName": "Level", "ColumnType": "int"}, {"ColumnName": "LevelName", "ColumnType": "string"}, {"ColumnName": "StatusCode", "ColumnType": "int"}, {"ColumnName": "StatusCodeName", "ColumnType": "string"}, {"ColumnName": "EventType", "ColumnType": "int"}, {"ColumnName": "EventTypeName", "ColumnType": "string"}, {"ColumnName": "Payload", "ColumnType": "string"}], "Rows": [["2019-02-10T12:07:01.0562684Z", "KPC.execute;f0131f65-d1ed-4c9d-9110-ddf9879f7ff6", "4400a720-f11d-43b6-9097-63462d35bcd4", "bf1b857c-e857-44f6-8d8c-156081bfb92c", "57e0f58d-398c-490b-b900-9f308c531af7", 4, "Info", 0, "S_OK (0)", 4, "QueryInfo", "{\"Count\":1,\"Text\":\"Query completed successfully\"}"], ["2019-02-10T12:07:01.0562684Z", "KPC.execute;f0131f65-d1ed-4c9d-9110-ddf9879f7ff6", "4400a720-f11d-43b6-9097-63462d35bcd4", "bf1b857c-e857-44f6-8d8c-156081bfb92c", "57e0f58d-398c-490b-b900-9f308c531af7", 6, "Stats", 0, "S_OK (0)", 0, "QueryResourceConsumption", "{\"ExecutionTime\":0.1875076,\"resource_usage\":{\"cache\":{\"memory\":{\"hits\":0,\"misses\":0,\"total\":0},\"disk\":{\"hits\":0,\"misses\":0,\"total\":0},\"shards\":{\"hitbytes\":0,\"missbytes\":0,\"bypassbytes\":0}},\"cpu\":{\"user\":\"00:00:00\",\"kernel\":\"00:00:00\",\"total cpu\":\"00:00:00\"},\"memory\":{\"peak_per_node\":0}},\"input_dataset_statistics\":{\"extents\":{\"total\":0,\"scanned\":0},\"rows\":{\"total\":0,\"scanned\":0},\"rowstores\":{\"scanned_rows\":0,\"scanned_values_size\":0}},\"dataset_statistics\":[{\"table_row_count\":1,\"table_size\":141}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f2861f0>

    @aio_documented_by(KustoClientTestsSync.test_dynamic)
    @pytest.mark.asyncio
    async def test_dynamic(self):
        with aioresponses() as aioresponses_mock:
            self._mock_query(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
                query = """print dynamic(123), dynamic("123"), dynamic("test bad json"),"""
                """ dynamic(null), dynamic('{"rowId":2,"arr":[0,2]}'), dynamic({"rowId":2,"arr":[0,2]})"""
>               response = await client.execute_query("PythonTest", query)

azure-kusto-data/tests/aio/test_kusto_client.py:144: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
    return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_empty_result (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75e9d19a0>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = "print 'a' | take 0", payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75e9d19a0>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = "print 'a' | take 0", payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '[{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, ..._row_count\\":0,\\"table_size\\":0}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: [{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, "TableKind": "QueryProperties", "TableName": "@ExtendedProperties", "Columns": [{"ColumnName": "TableId", "ColumnType": "int"}, {"ColumnName": "Key", "ColumnType": "string"}, {"ColumnName": "Value", "ColumnType": "dynamic"}], "Rows": [[1, "Visualization", "{\"Visualization\":null,\"Title\":null,\"XColumn\":null,\"Series\":null,\"YColumns\":null,\"AnomalyColumns\":null,\"XTitle\":null,\"YTitle\":null,\"XAxis\":null,\"YAxis\":null,\"Legend\":null,\"YSplit\":null,\"Accumulate\":false,\"IsQuerySorted\":false,\"Kind\":null,\"Ymin\":\"NaN\",\"Ymax\":\"NaN\"}"]]}, {"FrameType": "DataTable", "TableId": 1, "TableKind": "PrimaryResult", "TableName": "PrimaryResult", "Columns": [{"ColumnName": "print_0", "ColumnType": "string"}], "Rows": []}, {"FrameType": "DataTable", "TableId": 2, "TableKind": "QueryCompletionInformation", "TableName": "QueryCompletionInformation", "Columns": [{"ColumnName": "Timestamp", "ColumnType": "datetime"}, {"ColumnName": "ClientRequestId", "ColumnType": "string"}, {"ColumnName": "ActivityId", "ColumnType": "guid"}, {"ColumnName": "SubActivityId", "ColumnType": "guid"}, {"ColumnName": "ParentActivityId", "ColumnType": "guid"}, {"ColumnName": "Level", "ColumnType": "int"}, {"ColumnName": "LevelName", "ColumnType": "string"}, {"ColumnName": "StatusCode", "ColumnType": "int"}, {"ColumnName": "StatusCodeName", "ColumnType": "string"}, {"ColumnName": "EventType", "ColumnType": "int"}, {"ColumnName": "EventTypeName", "ColumnType": "string"}, {"ColumnName": "Payload", "ColumnType": "string"}], "Rows": [["2019-02-12T10:23:02.0413963Z", "KPC.execute;57050c90-8a7d-4b29-b8d0-a40688a8185c", "dfbaa865-e29d-46e0-af17-be22c6c113ac", "e2bf7a6c-adf1-48da-b117-667a92874d38", "81409d63-718b-4d06-9711-7eab476b7ceb", 4, "Info", 0, "S_OK (0)", 4, "QueryInfo", "{\"Count\":1,\"Text\":\"Querycompletedsuccessfully\"}"], ["2019-02-12T10:23:02.0413963Z", "KPC.execute;57050c90-8a7d-4b29-b8d0-a40688a8185c", "dfbaa865-e29d-46e0-af17-be22c6c113ac", "e2bf7a6c-adf1-48da-b117-667a92874d38", "81409d63-718b-4d06-9711-7eab476b7ceb", 6, "Stats", 0, "S_OK (0)", 0, "QueryResourceConsumption", "{\"ExecutionTime\":0.0156475,\"resource_usage\":{\"cache\":{\"memory\":{\"hits\":0,\"misses\":0,\"total\":0},\"disk\":{\"hits\":0,\"misses\":0,\"total\":0},\"shards\":{\"hitbytes\":0,\"missbytes\":0,\"bypassbytes\":0}},\"cpu\":{\"user\":\"00: 00: 00\",\"kernel\":\"00: 00: 00\",\"totalcpu\":\"00: 00: 00\"},\"memory\":{\"peak_per_node\":0}},\"input_dataset_statistics\":{\"extents\":{\"total\":0,\"scanned\":0},\"rows\":{\"total\":0,\"scanned\":0},\"rowstores\":{\"scanned_rows\":0,\"scanned_values_size\":0}},\"dataset_statistics\":[{\"table_row_count\":0,\"table_size\":0}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f286550>

    @aio_documented_by(KustoClientTestsSync.test_empty_result)
    @pytest.mark.asyncio
    async def test_empty_result(self):
        with aioresponses() as aioresponses_mock:
            self._mock_query(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
                query = """print 'a' | take 0"""
>               response = await client.execute_query("PythonTest", query)

azure-kusto-data/tests/aio/test_kusto_client.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
    return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_null_values_in_data (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec0af70>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'PrimaryResultName', payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec0af70>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'PrimaryResultName', payload = None
timeout = datetime.timedelta(seconds=300), properties = None
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '[{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, ..._row_count\\":0,\\"table_size\\":0}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: [{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, "TableKind": "QueryProperties", "TableName": "@ExtendedProperties", "Columns": [{"ColumnName": "TableId", "ColumnType": "int"}, {"ColumnName": "Key", "ColumnType": "string"}, {"ColumnName": "Value", "ColumnType": "dynamic"}], "Rows": [[null, null, null]]}, {"FrameType": "DataTable", "TableId": 1, "TableKind": "PrimaryResult", "TableName": "PrimaryResultName", "Columns": [{"ColumnName": "String", "ColumnType": "string"}, {"ColumnName": "Int", "ColumnType": "int"}, {"ColumnName": "Bool", "ColumnType": "bool"}, {"ColumnName": "Datetime", "ColumnType": "datetime"}, {"ColumnName": "Dynamic", "ColumnType": "dynamic"}, {"ColumnName": "Guid", "ColumnType": "guid"}, {"ColumnName": "Long", "ColumnType": "long"}, {"ColumnName": "Real", "ColumnType": "real"}, {"ColumnName": "Timespan", "ColumnType": "timespan"}, {"ColumnName": "Decimal", "ColumnType": "decimal"}], "Rows": [[null, null, null, null, null, null, null, null, null, null]]}, {"FrameType": "DataTable", "TableId": 2, "TableKind": "QueryCompletionInformation", "TableName": "QueryCompletionInformation", "Columns": [{"ColumnName": "Timestamp", "ColumnType": "datetime"}, {"ColumnName": "ClientRequestId", "ColumnType": "string"}, {"ColumnName": "ActivityId", "ColumnType": "guid"}, {"ColumnName": "SubActivityId", "ColumnType": "guid"}, {"ColumnName": "ParentActivityId", "ColumnType": "guid"}, {"ColumnName": "Level", "ColumnType": "int"}, {"ColumnName": "LevelName", "ColumnType": "string"}, {"ColumnName": "StatusCode", "ColumnType": "int"}, {"ColumnName": "StatusCodeName", "ColumnType": "string"}, {"ColumnName": "EventType", "ColumnType": "int"}, {"ColumnName": "EventTypeName", "ColumnType": "string"}, {"ColumnName": "Payload", "ColumnType": "string"}], "Rows": [["2019-02-12T10:23:02.0413963Z", "KPC.execute;57050c90-8a7d-4b29-b8d0-a40688a8185c", "dfbaa865-e29d-46e0-af17-be22c6c113ac", "e2bf7a6c-adf1-48da-b117-667a92874d38", "81409d63-718b-4d06-9711-7eab476b7ceb", 4, "Info", 0, "S_OK (0)", 4, "QueryInfo", "{\"Count\":1,\"Text\":\"Querycompletedsuccessfully\"}"], ["2019-02-12T10:23:02.0413963Z", "KPC.execute;57050c90-8a7d-4b29-b8d0-a40688a8185c", "dfbaa865-e29d-46e0-af17-be22c6c113ac", "e2bf7a6c-adf1-48da-b117-667a92874d38", "81409d63-718b-4d06-9711-7eab476b7ceb", 6, "Stats", 0, "S_OK (0)", 0, "QueryResourceConsumption", "{\"ExecutionTime\":0.0156475,\"resource_usage\":{\"cache\":{\"memory\":{\"hits\":0,\"misses\":0,\"total\":0},\"disk\":{\"hits\":0,\"misses\":0,\"total\":0},\"shards\":{\"hitbytes\":0,\"missbytes\":0,\"bypassbytes\":0}},\"cpu\":{\"user\":\"00: 00: 00\",\"kernel\":\"00: 00: 00\",\"totalcpu\":\"00: 00: 00\"},\"memory\":{\"peak_per_node\":0}},\"input_dataset_statistics\":{\"extents\":{\"total\":0,\"scanned\":0},\"rows\":{\"total\":0,\"scanned\":0},\"rowstores\":{\"scanned_rows\":0,\"scanned_values_size\":0}},\"dataset_statistics\":[{\"table_row_count\":0,\"table_size\":0}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f286460>

    @aio_documented_by(KustoClientTestsSync.test_null_values_in_data)
    @pytest.mark.asyncio
    async def test_null_values_in_data(self):
        with aioresponses() as aioresponses_mock:
            self._mock_query(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
                query = "PrimaryResultName"
>               response = await client.execute_query("PythonTest", query)

azure-kusto-data/tests/aio/test_kusto_client.py:165: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
    return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError

Check warning on line 0 in azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient

See this annotation in the file changed.

@github-actions github-actions / Test Results

4 out of 5 runs failed: test_request_id (azure-kusto-data.tests.aio.test_kusto_client.TestKustoClient)

artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
TypeError: object Mock can't be used in 'await' expression
self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec09fa0>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'Deft', payload = None
timeout = datetime.timedelta(seconds=300)
properties = <azure.kusto.data.client_request_properties.ClientRequestProperties object at 0x7ff75ec09130>
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
>               response_json = await response.json()

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1161: in json
    await self.read()
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1114: in read
    await self._wait_released()  # Underlying connection released
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def _wait_released(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1080: TypeError

The above exception was the direct cause of the following exception:

self = <azure.kusto.data.aio.client.KustoClient object at 0x7ff75ec09fa0>
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query'
database = 'PythonTest', query = 'Deft', payload = None
timeout = datetime.timedelta(seconds=300)
properties = <azure.kusto.data.client_request_properties.ClientRequestProperties object at 0x7ff75ec09130>
stream_response = False

    @aio_documented_by(KustoClientSync._execute)
    async def _execute(
        self,
        endpoint: str,
        database: Optional[str],
        query: Optional[str],
        payload: Optional[io.IOBase],
        timeout: timedelta,
        properties: ClientRequestProperties = None,
        stream_response: bool = False,
    ) -> Union[KustoResponseDataSet, ClientResponse]:
        """Executes given query against this client"""
        if self._is_closed:
            raise KustoClosedError()
        self.validate_endpoint()
        request_params = ExecuteRequestParams(
            database,
            payload,
            properties,
            query,
            timeout,
            self._request_headers,
            self._mgmt_default_timeout,
            self._client_server_delta,
            self.client_details,
        )
        json_payload = request_params.json_payload
        request_headers = request_params.request_headers
        timeout = request_params.timeout
        if self._aad_helper:
            request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
    
        invoker = lambda: self._session.post(
            endpoint, headers=request_headers, json=json_payload, data=payload, timeout=timeout.seconds, proxy=self._proxy_url, allow_redirects=False
        )
    
        try:
            response = await MonitoredActivity.invoke_async(
                invoker, name_of_span="KustoClient.http_post", tracing_attributes=Span.create_http_attributes("POST", endpoint, request_headers)
            )
        except Exception as e:
            raise KustoNetworkError(endpoint, None if properties is None else properties.client_request_id) from e
    
        if stream_response:
            try:
                response.raise_for_status()
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                return response
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
                try:
                    response_json = await response.json()
                except Exception:
                    response_json = None
                raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
    
        async with response:
            response_json = None
            try:
                if 300 <= response.status < 400:
                    raise Exception("Unexpected redirection, got status code: " + str(response.status))
                response_json = await response.json()
                response.raise_for_status()
            except Exception as e:
                try:
                    response_text = await response.text()
                except Exception:
                    response_text = None
>               raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)

../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

exception = TypeError("object Mock can't be used in 'await' expression")
endpoint = 'https://somecluster.kusto.windows.net/v2/rest/query', payload = None
response = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>

status = 200, response_json = None
response_text = '[{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, ..._count\\":11,\\"table_size\\":2444}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]'

    @staticmethod
    def _handle_http_error(
        exception: Exception,
        endpoint: Optional[str],
        payload: Optional[io.IOBase],
        response: "Union[Response, aiohttp.ClientResponse]",
        status: int,
        response_json: Any,
        response_text: Optional[str],
    ) -> NoReturn:
        if status == 404:
            if payload:
                raise KustoServiceError("The ingestion endpoint does not exist. Please enable streaming ingestion on your cluster.", response) from exception
    
            raise KustoServiceError(f"The requested endpoint '{endpoint}' does not exist.", response) from exception
    
        if status == 429:
            raise KustoThrottlingError("The request was throttled by the server.", response) from exception
    
        if payload:
            message = f"An error occurred while trying to ingest: Status: {status}, Reason: {response.reason}, Text: {response_text}."
            if response_json:
                raise KustoApiError(response_json, message, response) from exception
    
            raise KustoServiceError(message, response) from exception
    
        if response_json:
            raise KustoApiError(response_json, http_response=response) from exception
    
        if response_text:
>           raise KustoServiceError(response_text, response) from exception
E           azure.kusto.data.exceptions.KustoServiceError: [{"FrameType": "DataSetHeader", "IsProgressive": false, "Version": "v2.0"}, {"FrameType": "DataTable", "TableId": 0, "TableName": "@ExtendedProperties", "TableKind": "QueryProperties", "Columns": [{"ColumnName": "TableId", "ColumnType": "int"}, {"ColumnName": "Key", "ColumnType": "string"}, {"ColumnName": "Value", "ColumnType": "dynamic"}], "Rows": [[1, "Visualization", "{\"Visualization\":null,\"Title\":null,\"XColumn\":null,\"Series\":null,\"YColumns\":null,\"XTitle\":null,\"YTitle\":null,\"XAxis\":null,\"YAxis\":null,\"Legend\":null,\"YSplit\":null,\"Accumulate\":false,\"IsQuerySorted\":false,\"Kind\":null}"]]}, {"FrameType": "DataTable", "TableId": 1, "TableName": "Deft", "TableKind": "PrimaryResult", "Columns": [{"ColumnName": "rownumber", "ColumnType": "int"}, {"ColumnName": "rowguid", "ColumnType": "string"}, {"ColumnName": "xdouble", "ColumnType": "real"}, {"ColumnName": "xfloat", "ColumnType": "real"}, {"ColumnName": "xbool", "ColumnType": "bool"}, {"ColumnName": "xint16", "ColumnType": "int"}, {"ColumnName": "xint32", "ColumnType": "int"}, {"ColumnName": "xint64", "ColumnType": "long"}, {"ColumnName": "xuint8", "ColumnType": "long"}, {"ColumnName": "xuint16", "ColumnType": "long"}, {"ColumnName": "xuint32", "ColumnType": "long"}, {"ColumnName": "xuint64", "ColumnType": "long"}, {"ColumnName": "xdate", "ColumnType": "datetime"}, {"ColumnName": "xsmalltext", "ColumnType": "string"}, {"ColumnName": "xtext", "ColumnType": "string"}, {"ColumnName": "xnumberAsText", "ColumnType": "string"}, {"ColumnName": "xtime", "ColumnType": "timespan"}, {"ColumnName": "xtextWithNulls", "ColumnType": "string"}, {"ColumnName": "xdynamicWithNulls", "ColumnType": "dynamic"}], "Rows": [[null, "", null, null, null, null, null, null, null, null, null, null, null, "", "", "", null, "", ""], [0, "00000000-0000-0000-0001-020304050607", 0.0, 0.0, false, 0, 0, 0, 0, 0, 0, 0, "2014-01-01T01:01:01.0000000Z", "Zero", "Zero", "0", "00:00:00", "", ""], [1, "00000001-0000-0000-0001-020304050607", 1.0001, 1.01, true, 1, 1, 1, 1, 1, 1, 1, "2015-01-01T01:01:01.0000001Z", "One", "One", "1", "1.00:00:01.0010001", "", {"rowId": 1, "arr": [0, 1]}], [2, "00000002-0000-0000-0001-020304050607", 2.0002, 2.02, false, 2, 2, 2, 2, 2, 2, 2, "2016-01-01T01:01:01.0000002Z", "Two", "Two", "2", "-2.00:00:02.0020002", "", {"rowId": 2, "arr": [0, 2]}], [3, "00000003-0000-0000-0001-020304050607", 3.0003, 3.03, true, 3, 3, 3, 3, 3, 3, 3, "2017-01-01T01:01:01.0000003Z", "Three", "Three", "3", "3.00:00:03.0030003", "", {"rowId": 3, "arr": [0, 3]}], [4, "00000004-0000-0000-0001-020304050607", 4.0004, 4.04, false, 4, 4, 4, 4, 4, 4, 4, "2018-01-01T01:01:01.0000004Z", "Four", "Four", "4", "-4.00:00:04.0040004", "", {"rowId": 4, "arr": [0, 4]}], [5, "00000005-0000-0000-0001-020304050607", 5.0005, 5.05, true, 5, 5, 5, 5, 5, 5, 5, "2019-01-01T01:01:01.0000005Z", "Five", "Five", "5", "5.00:00:05.0050005", "", {"rowId": 5, "arr": [0, 5]}], [6, "00000006-0000-0000-0001-020304050607", 6.0006, 6.06, false, 6, 6, 6, 6, 6, 6, 6, "2020-01-01T01:01:01.0000006Z", "Six", "Six", "6", "-6.00:00:06.0060006", "", {"rowId": 6, "arr": [0, 6]}], [7, "00000007-0000-0000-0001-020304050607", 7.0007, 7.07, true, 7, 7, 7, 7, 7, 7, 7, "2021-01-01T01:01:01.0000007Z", "Seven", "Seven", "7", "7.00:00:07.0070007", "", {"rowId": 7, "arr": [0, 7]}], [8, "00000008-0000-0000-0001-020304050607", 8.0008, 8.08, false, 8, 8, 8, 8, 8, 8, 8, "2022-01-01T01:01:01.0000008Z", "Eight", "Eight", "8", "-8.00:00:08.0080008", "", {"rowId": 8, "arr": [0, 8]}], [9, "00000009-0000-0000-0001-020304050607", 9.0009, 9.09, true, 9, 9, 9, 9, 9, 9, 9, "2023-01-01T01:01:01.0000009Z", "Nine", "Nine", "9", "9.00:00:09.0090009", "", {"rowId": 9, "arr": [0, 9]}]]}, {"FrameType": "DataTable", "TableId": 2, "TableName": "QueryCompletionInformation", "TableKind": "QueryCompletionInformation", "Columns": [{"ColumnName": "Timestamp", "ColumnType": "datetime"}, {"ColumnName": "ClientRequestId", "ColumnType": "string"}, {"ColumnName": "ActivityId", "ColumnType": "guid"}, {"ColumnName": "SubActivityId", "ColumnType": "guid"}, {"ColumnName": "ParentActivityId", "ColumnType": "guid"}, {"ColumnName": "Level", "ColumnType": "int"}, {"ColumnName": "LevelName", "ColumnType": "string"}, {"ColumnName": "StatusCode", "ColumnType": "int"}, {"ColumnName": "StatusCodeName", "ColumnType": "string"}, {"ColumnName": "EventType", "ColumnType": "int"}, {"ColumnName": "EventTypeName", "ColumnType": "string"}, {"ColumnName": "Payload", "ColumnType": "string"}], "Rows": [["2018-04-30T12:25:11.0778067Z", "unspecified;cc5ee2b9-9b77-4509-9a61-84ec8f0159c2", "eeac049e-8a7d-4188-b797-6b5f2c9f9526", "c6fb9714-5183-4092-8a02-825bd7aa1aee", "df0aaeb0-4c8a-4d77-bc77-f714a4484a6b", 4, "Info", 0, "S_OK (0)", 4, "QueryInfo", "{\"Count\":1,\"Text\":\"Query completed successfully\"}"], ["2018-04-30T12:25:11.0778067Z", "unspecified;cc5ee2b9-9b77-4509-9a61-84ec8f0159c2", "eeac049e-8a7d-4188-b797-6b5f2c9f9526", "c6fb9714-5183-4092-8a02-825bd7aa1aee", "df0aaeb0-4c8a-4d77-bc77-f714a4484a6b", 6, "Stats", 0, "S_OK (0)", 0, "QueryResourceConsumption", "{\"ExecutionTime\":0.0156154,\"resource_usage\":{\"cache\":{\"memory\":{\"hits\":40,\"misses\":0,\"total\":40},\"disk\":{\"hits\":0,\"misses\":0,\"total\":0}},\"cpu\":{\"user\":\"00:00:00\",\"kernel\":\"00:00:00\",\"total cpu\":\"00:00:00\"},\"memory\":{\"peak_per_node\":0}},\"dataset_statistics\":[{\"table_row_count\":11,\"table_size\":2444}]}"]]}, {"FrameType": "DataSetCompletion", "HasErrors": false, "Cancelled": false}]

../../../.local/lib/python3.8/site-packages/azure/kusto/data/client_base.py:125: KustoServiceError

During handling of the above exception, another exception occurred:

self = <tests.aio.test_kusto_client.TestKustoClient object at 0x7ff75f244280>

    @aio_documented_by(KustoClientTestsSync.test_sanity_query)
    @pytest.mark.asyncio
    async def test_request_id(self):
        with aioresponses() as aioresponses_mock:
            properties = ClientRequestProperties()
            request_id = "test_request_id"
            properties.client_request_id = request_id
            self._mock_query(aioresponses_mock)
            async with KustoClient(self.HOST) as client:
>               response = await client.execute_query("PythonTest", "Deft", properties=properties)

azure-kusto-data/tests/aio/test_kusto_client.py:177: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.local/lib/python3.8/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
    return await func(*args, **kwargs)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
    return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.8/site-packages/azure/kusto/data/aio/client.py:187: in _execute
    raise self._handle_http_error(e, endpoint, payload, response, response.status, response_json, response_text)
../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1197: in __aexit__
    await self.wait_for_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ClientResponse(https://somecluster.kusto.windows.net/v2/rest/query) [200 None]>
<CIMultiDict('Content-Type': 'application/json')>


    async def wait_for_close(self) -> None:
        if self._writer is not None:
>           await self._writer
E           TypeError: object Mock can't be used in 'await' expression

../../../.local/lib/python3.8/site-packages/aiohttp/client_reqrep.py:1096: TypeError