Skip to content

batch_delete_table

batch_delete_table(
    database_name: NameString,
    tables_to_delete: BatchDeleteTableNameList,
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    catalog_id: Optional[CatalogIdString] = None,
    transaction_id: Optional[TransactionIdString] = None,
) -> BatchDeleteTableResponse

Deletes multiple tables at once.

After completing this operation, you no longer have access to the table versions and partitions that belong to the deleted table. Glue deletes these "orphaned" resources asynchronously in a timely manner, at the discretion of the service.

To ensure the immediate deletion of all related resources, before calling BatchDeleteTable, use DeleteTableVersion or BatchDeleteTableVersion, and DeletePartition or BatchDeletePartition, to delete any resources that belong to the table.

Parameters:

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

    The ID of the Data Catalog where the table resides. If none is provided, the Amazon Web Services account ID is used by default.

  • database_name (NameString) –

    The name of the catalog database in which the tables to delete reside. For Hive compatibility, this name is entirely lowercase.

  • tables_to_delete (BatchDeleteTableNameList) –

    A list of the table to delete.

  • transaction_id (Optional[TransactionIdString], default: None ) –

    The transaction ID at which to delete the table contents.

Raises:

Source code in docs_src/capo_glue/_services/glue.py
def batch_delete_table(
    self,
    database_name: "capo_glue.types.name_string.NameString",
    tables_to_delete: "capo_glue.types.batch_delete_table_name_list.BatchDeleteTableNameList",
    *,
    config_overrides: Optional[GlueClientConfig] = None,
    catalog_id: Optional[
        "capo_glue.types.catalog_id_string.CatalogIdString"
    ] = None,
    transaction_id: Optional[
        "capo_glue.types.transaction_id_string.TransactionIdString"
    ] = None,
) -> "capo_glue.types.batch_delete_table_response.BatchDeleteTableResponse":
    """<p>Deletes multiple tables at once.</p> <note> <p>After completing this operation, you no longer have access to the table versions and partitions that belong to the deleted table. Glue deletes these "orphaned" resources asynchronously in a timely manner, at the discretion of the service.</p> <p>To ensure the immediate deletion of all related resources, before calling <code>BatchDeleteTable</code>, use <code>DeleteTableVersion</code> or <code>BatchDeleteTableVersion</code>, and <code>DeletePartition</code> or <code>BatchDeletePartition</code>, to delete any resources that belong to the table.</p> </note>

    Args:
        catalog_id: <p>The ID of the Data Catalog where the table resides. If none is provided, the Amazon Web Services account ID is used by default.</p>
        database_name: <p>The name of the catalog database in which the tables to delete reside. For Hive compatibility, this name is entirely lowercase.</p>
        tables_to_delete: <p>A list of the table to delete.</p>
        transaction_id: <p>The transaction ID at which to delete the table contents.</p>

    Raises:
        capo_glue.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Two processes are trying to modify a resource simultaneously.</p>
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.glue_encryption_exception.GlueEncryptionException: <p>An encryption operation failed.</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.resource_not_ready_exception.ResourceNotReadyException: <p>A resource was not ready for a transaction.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_glue.types.batch_delete_table_request.BatchDeleteTableRequest]",
    ) -> OperationResponse[
        "capo_glue.types.batch_delete_table_response.BatchDeleteTableResponse"
    ]:
        import capo_glue._operations.aws_glue.batch_delete_table

        output, http_response = (
            capo_glue._operations.aws_glue.batch_delete_table.batch_delete_table(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchDeleteTable")
    )
    input_: capo_glue.types.batch_delete_table_request.BatchDeleteTableRequest = {
        "database_name": database_name,
        "tables_to_delete": tables_to_delete,
    }
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    if transaction_id is not None:
        input_["transaction_id"] = transaction_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output