Skip to content

azure-data-tables: async list_entities(query_filter=...) leaks kwarg to aiohttp transport causing TypeError #46014

@rgant

Description

@rgant
  • Package Name: azure-data-tables
  • Package Version: 12.7.0
  • Operating System: Linux (Azure Functions) and macOS (local repro)
  • Python Version: 3.13.11 (Azure), 3.14.2 (local)

Describe the bug

The async TableClient.list_entities(query_filter=...) leaks the query_filter keyword argument through the pipeline to aiohttp.ClientSession._request(), which rejects it with TypeError: ClientSession._request() got an unexpected keyword argument 'query_filter'.

The kwargs flow through:

  1. azure.data.tables.aio._base_client_async.py:320return await self._transport.send(request, **kwargs)
  2. azure.core.pipeline.transport._aiohttp.py:346result = await self.session.request(..., **config)
  3. aiohttp/client.pyself._request(method, url, **kwargs) raises TypeError

This affects only the async client (azure.data.tables.aio). The sync client is not affected.

query_entities(filter) works as a workaround because it accepts the filter as a positional argument, so it does not appear in **kwargs.

To Reproduce

import asyncio

from azure.data.tables.aio import TableServiceClient
from azure.identity.aio import DefaultAzureCredential

async def main() -> None:
    endpoint = "https://<your-storage-account>.table.core.windows.net"
    async with (
        DefaultAzureCredential() as cred,
        TableServiceClient(endpoint=endpoint, credential=cred) as svc,
    ):
        table = svc.get_table_client("<your-table-name>")
        async for entity in table.list_entities(query_filter="PartitionKey eq 'mypartition'"):
            print(entity)
            break

asyncio.run(main())

Error:

TypeError: ClientSession._request() got an unexpected keyword argument 'query_filter'

Expected behavior

list_entities(query_filter=...) should filter server-side and return matching entities, the same as it does with the sync client. The query_filter parameter should be consumed by the SDK and not forwarded to the HTTP transport layer.

Additional context

  • azure-core version: 1.39.0
  • aiohttp versions tested: 3.12.15 and 3.13.4 (both fail)
  • Workaround: use table.query_entities("PartitionKey eq 'mypartition'") instead
  • Stack trace from production (Azure Functions on Python 3.13):
File "azure/data/tables/_generated/aio/operations/_operations.py", line 418, in query_entities
    pipeline_response: PipelineResponse = await self._client._pipeline.run(
        request, stream=_stream, **kwargs
    )
File "azure/core/pipeline/_base_async.py", line 111, in send
    await self._sender.send(request.http_request, **request.context.options),
File "azure/data/tables/aio/_base_client_async.py", line 320, in send
    return await self._transport.send(request, **kwargs)
File "azure/core/pipeline/transport/_aiohttp.py", line 346, in send
    result = await self.session.request(
        request.method, ..., **config,
    )
File "aiohttp/client.py", line 482, in request
    return _RequestContextManager(self._request(method, url, **kwargs))
TypeError: ClientSession._request() got an unexpected keyword argument 'query_filter'

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions