Skip to content

azure-data-tables==12.1.0 Batch transaction fails if update mode is set for all transactions #20247

@natbprice

Description

@natbprice
  • Package Name: azure-data-tables
  • Package Version: 12.1.0
  • Operating System: Microsoft Windows 10 Enterprise
  • Python Version: 3.9.0

Describe the bug
Batch transaction fails if update mode is set for all transactions.

Traceback (most recent call last):
  File "c:\AzureDevOps\ModelingBatchJobs\run_batch_job\test_batch_insert.py", line 21, in <module>
    table_client.submit_transaction(operations)
  File "C:\AzureDevOps\ModelingBatchJobs\run_batch_job\.venv\lib\site-packages\azure\data\tables\_table_client.py", line 731, in submit_transaction
    return self._batch_send(*batched_requests.requests, **kwargs)  # type: ignore
  File "C:\AzureDevOps\ModelingBatchJobs\run_batch_job\.venv\lib\site-packages\azure\data\tables\_base_client.py", line 295, in _batch_send
    parts = list(response.parts())
  File "C:\AzureDevOps\ModelingBatchJobs\run_batch_job\.venv\lib\site-packages\azure\core\pipeline\transport\_base.py", line 604, in parts
    responses = self._get_raw_parts()
  File "C:\AzureDevOps\ModelingBatchJobs\run_batch_job\.venv\lib\site-packages\azure\core\pipeline\transport\_base.py", line 561, in _get_raw_parts
    return self._decode_parts(message, http_response_type, requests)
  File "C:\AzureDevOps\ModelingBatchJobs\run_batch_job\.venv\lib\site-packages\azure\core\pipeline\transport\_base.py", line 533, in _decode_parts
    changeset_responses = self._decode_parts(raw_reponse, http_response_type, changeset_requests)
  File "C:\AzureDevOps\ModelingBatchJobs\run_batch_job\.venv\lib\site-packages\azure\core\pipeline\transport\_base.py", line 526, in _decode_parts
    requests[index],
IndexError: tuple index out of range

To Reproduce
Steps to reproduce the behavior:

  1. Insert entities with update mode set
from azure.identity import DefaultAzureCredential
from azure.data.tables import TableServiceClient

account = "myaccount"
table = "mytable"

credential = DefaultAzureCredential(exclude_shared_token_cache_credential = True)
table_service = TableServiceClient(endpoint="https://{}.table.core.windows.net/".format(account), credential=credential)

table_client = table_service.create_table_if_not_exists(table_name=table)

entity1 = {"PartitionKey": "pk001", "RowKey": "rk001",
           "Value": 1, "day": "Monday", "float": 1.001}
entity2 = {"PartitionKey": "pk001", "RowKey": "rk002",
           "Value": 2, "day": "Tuesday", "float": 2.002}

operations = [
    ("upsert", entity1, {"mode": "merge"}),
    ("upsert", entity2, {"mode": "replace"})
]
table_client.submit_transaction(operations)

Expected behavior
Transactions are successfully completed without errors

Metadata

Metadata

Assignees

Labels

TablesbugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.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