Skip to content

delete_objects_on_cancel async

delete_objects_on_cancel(
    database_name: NameString,
    table_name: NameString,
    transaction_id: TransactionIdString,
    objects: VirtualObjectList,
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
    catalog_id: Optional[CatalogIdString] = None,
) -> DeleteObjectsOnCancelResponse

For a specific governed table, provides a list of Amazon S3 objects that will be written during the current transaction and that can be automatically deleted if the transaction is canceled. Without this call, no Amazon S3 objects are automatically deleted when a transaction cancels.

The Glue ETL library function write_dynamic_frame.from_catalog() includes an option to automatically call DeleteObjectsOnCancel before writes. For more information, see Rolling Back Amazon S3 Writes.

Parameters:

  • catalog_id (Optional[CatalogIdString], default: None ) –

    The Glue data catalog that contains the governed table. Defaults to the current account ID.

  • database_name (NameString) –

    The database that contains the governed table.

  • table_name (NameString) –

    The name of the governed table.

  • transaction_id (TransactionIdString) –

    ID of the transaction that the writes occur in.

  • objects (VirtualObjectList) –

    A list of VirtualObject structures, which indicates the Amazon S3 objects to be deleted if the transaction cancels.

Raises:

Source code in docs_src/capo_lakeformation/_services/async_lake_formation.py
async def delete_objects_on_cancel(
    self,
    database_name: "capo_lakeformation.types.name_string.NameString",
    table_name: "capo_lakeformation.types.name_string.NameString",
    transaction_id: "capo_lakeformation.types.transaction_id_string.TransactionIdString",
    objects: "capo_lakeformation.types.virtual_object_list.VirtualObjectList",
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
    catalog_id: Optional[
        "capo_lakeformation.types.catalog_id_string.CatalogIdString"
    ] = None,
) -> "capo_lakeformation.types.delete_objects_on_cancel_response.DeleteObjectsOnCancelResponse":
    """<p>For a specific governed table, provides a list of Amazon S3 objects that will be written during the current transaction and that can be automatically deleted if the transaction is canceled. Without this call, no Amazon S3 objects are automatically deleted when a transaction cancels. </p> <p> The Glue ETL library function <code>write_dynamic_frame.from_catalog()</code> includes an option to automatically call <code>DeleteObjectsOnCancel</code> before writes. For more information, see <a href="https://docs.aws.amazon.com/lake-formation/latest/dg/transactions-data-operations.html#rolling-back-writes">Rolling Back Amazon S3 Writes</a>. </p>

    Args:
        catalog_id: <p>The Glue data catalog that contains the governed table. Defaults to the current account ID.</p>
        database_name: <p>The database that contains the governed table.</p>
        table_name: <p>The name of the governed table.</p>
        transaction_id: <p>ID of the transaction that the writes occur in.</p>
        objects: <p>A list of VirtualObject structures, which indicates the Amazon S3 objects to be deleted if the transaction cancels.</p>

    Raises:
        capo_lakeformation.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Two processes are trying to modify a resource simultaneously.</p>
        capo_lakeformation.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist.</p>
        capo_lakeformation.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_lakeformation.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_lakeformation.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_lakeformation.errors.resource_not_ready_exception.ResourceNotReadyException: <p>Contains details about an error related to a resource which is not ready for a transaction.</p>
        capo_lakeformation.errors.transaction_canceled_exception.TransactionCanceledException: <p>Contains details about an error related to a transaction that was cancelled.</p>
        capo_lakeformation.errors.transaction_committed_exception.TransactionCommittedException: <p>Contains details about an error where the specified transaction has already been committed and cannot be used for <code>UpdateTableObjects</code>.</p>
        capo_lakeformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lakeformation.types.delete_objects_on_cancel_request.DeleteObjectsOnCancelRequest]",
    ) -> AsyncOperationResponse[
        "capo_lakeformation.types.delete_objects_on_cancel_response.DeleteObjectsOnCancelResponse"
    ]:
        import capo_lakeformation._operations.aws_lake_formation.delete_objects_on_cancel

        (
            output,
            http_response,
        ) = await capo_lakeformation._operations.aws_lake_formation.delete_objects_on_cancel.async_delete_objects_on_cancel(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteObjectsOnCancel")
    )
    input_: capo_lakeformation.types.delete_objects_on_cancel_request.DeleteObjectsOnCancelRequest = {
        "database_name": database_name,
        "table_name": table_name,
        "transaction_id": transaction_id,
        "objects": objects,
    }
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output