BatchDeleteTableCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlueClient, BatchDeleteTableCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, BatchDeleteTableCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // BatchDeleteTableRequest
  CatalogId: "STRING_VALUE",
  DatabaseName: "STRING_VALUE", // required
  TablesToDelete: [ // BatchDeleteTableNameList // required
    "STRING_VALUE",
  ],
  TransactionId: "STRING_VALUE",
};
const command = new BatchDeleteTableCommand(input);
const response = await client.send(command);
// { // BatchDeleteTableResponse
//   Errors: [ // TableErrors
//     { // TableError
//       TableName: "STRING_VALUE",
//       ErrorDetail: { // ErrorDetail
//         ErrorCode: "STRING_VALUE",
//         ErrorMessage: "STRING_VALUE",
//       },
//     },
//   ],
// };

BatchDeleteTableCommand Input

See BatchDeleteTableCommandInput for more details

Parameter
Type
Description
DatabaseName
Required
string | undefined

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

TablesToDelete
Required
string[] | undefined

A list of the table to delete.

CatalogId
string | undefined

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

TransactionId
string | undefined

The transaction ID at which to delete the table contents.

BatchDeleteTableCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
Errors
TableError[] | undefined

A list of errors encountered in attempting to delete the specified tables.

Throws

Name
Fault
Details
EntityNotFoundException
client

A specified entity does not exist

GlueEncryptionException
client

An encryption operation failed.

InternalServiceException
server

An internal service error occurred.

InvalidInputException
client

The input provided was not valid.

OperationTimeoutException
client

The operation timed out.

ResourceNotReadyException
client

A resource was not ready for a transaction.

GlueServiceException
Base exception class for all service exceptions from Glue service.