DeleteDatabaseCommand

Removes a specified database from a Data Catalog.

After completing this operation, you no longer have access to the tables (and all table versions and partitions that might belong to the tables) and the user-defined functions in the deleted database. 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 DeleteDatabase, use DeleteTableVersion or BatchDeleteTableVersion, DeletePartition or BatchDeletePartition, DeleteUserDefinedFunction, and DeleteTable or BatchDeleteTable, to delete any resources that belong to the database.

Example Syntax

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

import { GlueClient, DeleteDatabaseCommand } from "@aws-sdk/client-glue"; // ES Modules import
// const { GlueClient, DeleteDatabaseCommand } = require("@aws-sdk/client-glue"); // CommonJS import
const client = new GlueClient(config);
const input = { // DeleteDatabaseRequest
  CatalogId: "STRING_VALUE",
  Name: "STRING_VALUE", // required
};
const command = new DeleteDatabaseCommand(input);
const response = await client.send(command);
// {};

DeleteDatabaseCommand Input

See DeleteDatabaseCommandInput for more details

Parameter
Type
Description
Name
Required
string | undefined

The name of the database to delete. For Hive compatibility, this must be all lowercase.

CatalogId
string | undefined

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

DeleteDatabaseCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
ConcurrentModificationException
client

Two processes are trying to modify a resource simultaneously.

EntityNotFoundException
client

A specified entity does not exist

FederationSourceException
client

A federation source failed.

FederationSourceRetryableException
client

A federation source failed, but the operation may be retried.

InternalServiceException
server

An internal service error occurred.

InvalidInputException
client

The input provided was not valid.

OperationTimeoutException
client

The operation timed out.

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