Skip to content

delete_table async

delete_table(
    database_name: NameString,
    name: NameString,
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    catalog_id: Optional[CatalogIdString] = None,
    transaction_id: Optional[TransactionIdString] = None,
) -> DeleteTableResponse

Removes a table definition from the Data Catalog.

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 DeleteTable, 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 table resides. For Hive compatibility, this name is entirely lowercase.

  • name (NameString) –

    The name of the table to be deleted. For Hive compatibility, this name is entirely lowercase.

  • 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/async_glue.py
async def delete_table(
    self,
    database_name: "capo_glue.types.name_string.NameString",
    name: "capo_glue.types.name_string.NameString",
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = 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.delete_table_response.DeleteTableResponse":
    """<p>Removes a table definition from the Data Catalog.</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>DeleteTable</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 table resides. For Hive compatibility, this name is entirely lowercase.</p>
        name: <p>The name of the table to be deleted. For Hive compatibility, this name is entirely lowercase.</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.federation_source_exception.FederationSourceException: <p>A federation source failed.</p>
        capo_glue.errors.federation_source_retryable_exception.FederationSourceRetryableException: <p>A federation source failed, but the operation may be retried.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_glue.types.delete_table_request.DeleteTableRequest]",
    ) -> AsyncOperationResponse[
        "capo_glue.types.delete_table_response.DeleteTableResponse"
    ]:
        import capo_glue._operations.aws_glue.delete_table

        (
            output,
            http_response,
        ) = await capo_glue._operations.aws_glue.delete_table.async_delete_table(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteTable")
    )
    input_: capo_glue.types.delete_table_request.DeleteTableRequest = {
        "database_name": database_name,
        "name": name,
    }
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    if transaction_id is not None:
        input_["transaction_id"] = transaction_id

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