Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cosmos] archboard review item - update batch error description #34473

Merged
merged 7 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,8 @@ async def execute_item_batch(
priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> List[Dict[str, Any]]:
""" Executes the transactional batch for the specified partition key.
""" Executes the transactional batch for the specified partition key. Transactional batches either succeed or
fail in their entirety.

:param batch_operations: The batch of operations to be executed.
:type batch_operations: List[Tuple[Any]]
Expand All @@ -1047,6 +1048,12 @@ async def execute_item_batch(
:returns: A list representing the items after the batch operations went through.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The batch failed to execute.
:raises ~azure.cosmos.exceptions.CosmosBatchOperationError: A transactional batch operation failed in the batch.
CosmosBatchOperationError will have several attributes providing the user more information on the error:
- error_index: the index of the failed operation
- headers: the response headers for the failed operation
- status_code: the status code of the failed operation, since all other operations will fail with a 424
- message: the error message, also including the index of the failed operation
- operation_responses: the list of failed operation responses
simorenoh marked this conversation as resolved.
Show resolved Hide resolved
:rtype: List[Dict[str, Any]]
"""
if pre_trigger_include is not None:
Expand Down
9 changes: 8 additions & 1 deletion sdk/cosmos/azure-cosmos/azure/cosmos/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ def execute_item_batch(
priority: Optional[Literal["High", "Low"]] = None,
**kwargs: Any
) -> List[Dict[str, Any]]:
""" Executes the transactional batch for the specified partition key.
""" Executes the transactional batch for the specified partition key. Transactional batches either succeed or
fail in their entirety.

:param batch_operations: The batch of operations to be executed.
:type batch_operations: List[Tuple[Any]]
Expand All @@ -797,6 +798,12 @@ def execute_item_batch(
:returns: A list representing the item after the batch operations went through.
:raises ~azure.cosmos.exceptions.CosmosHttpResponseError: The batch failed to execute.
:raises ~azure.cosmos.exceptions.CosmosBatchOperationError: A transactional batch operation failed in the batch.
CosmosBatchOperationError will have several attributes providing the user more information on the error:
- error_index: the index of the failed operation
- headers: the response headers for the failed operation
- status_code: the status code of the failed operation, since all other operations will fail with a 424
- message: the error message, also including the index of the failed operation
- operation_responses: the list of failed operation responses
:rtype: List[Dict[str, Any]]
"""
if pre_trigger_include is not None:
Expand Down