Drop a database

Terminating a database permanently deletes all of its data, including automatic backups. You cannot undo this action.

Delete a database and erase all data stored in it.

You need an application token with permission to create and configure databases, such as the Organization Administrator role.

For more information, see Get endpoint and token.

Result

  • Python

  • TypeScript

  • Java

  • curl

The method returns None upon successful database deletion.

Returns:

Promise<void> - A promise that resolves when the database is terminated.

Returns:

boolean - Flag indicating if the database was deleted.

Returns:

A successful request returns 202 Accepted and initiates the termination process. The database isn’t instantly deleted, and the termination process can take some time. To monitor the termination process, you can check the database status in the Astra Portal.

Parameters

  • Python

  • TypeScript

  • Java

  • curl

The database deletion is done through an instance of the AstraDBAdmin class.

admin.drop_database("DATABASE_ID")

Parameters:

Name Type Summary

id

str

The ID of the target database.

wait_until_active

bool

If true (default), the method returns only after the database is actually been deleted. If false, it returns immediately after issuing the drop request, and it is the responsibility of the caller to check the database status/availability after that, if desired.

database_admin_timeout_ms

int

A timeout, in milliseconds, for the whole requested operation to complete. This is relevant only if wait_until_active is true, i.e. if the method call must wait and keep querying the DevOps API for the status of the database being deleted.

Note that a timeout event is no guarantee that the deletion request has not reached the API server.

If omitted, the corresponding setting from the admin’s API Options is used.

request_timeout_ms

int

A timeout, in milliseconds, for each underlying DevOps API HTTP request.

If omitted, the corresponding setting from the admin’s API Options is used.

timeout_ms

int

An alias for both the request_timeout_ms and database_admin_timeout_ms timeout parameters. In practice, regardless of wait_until_active, this parameter dictates an overall timeout on this method call.

If omitted, the corresponding setting from the admin’s API Options is used.

The database termination is done through an instance of the AstraAdmin class.

await admin.dropDatabase('DB_ID');

Parameters:

Name Type Summary

db

Db | string

The ID of the target database.

options?

AstraAdminBlockingOptions

Options regarding the termination of the database.

By default, the dropDatabase method blocks until the database is deleted. This entails polling the database status until it is TERMINATED. To disable this behavior, pass { blocking: false } to the options parameter.

The delete database function is available in the AstraDBAdmin class.

// Given 'admin', a AstraDBAdmin object
// Delete an existing database by name
admin.dropDatabase(String name);

// Delete an existing database by ID
admin.dropDatabase(UUID id);

Parameters:

Name Type Summary

id

UUID

The identifier of the database to delete.

name

String

The name of the database to delete.

Use the DevOps API to delete a database. This operation is a POST request with no body.

The application token must have sufficient permissions to perform the requested operations, such as the Organization Administrator role.

Examples

The following examples demonstrate how to drop a database.

  • Python

  • TypeScript

  • Java

  • curl

from astrapy import DataAPIClient
client = DataAPIClient("TOKEN")
admin = client.get_admin()

database_list_pre = list(admin.list_databases())
len(database_list_pre)
# 3
admin.drop_database("01234567-...")
# the 'drop_database' method will take some time ...

database_list_post = list(admin.list_databases())
len(database_list_post)
# 2
import { DataAPIClient } from '@datastax/astra-db-ts'

const admin = new DataAPIClient('TOKEN').admin();

(async function () {
  await admin.dropDatabase('DB_ID');
})();
package com.datastax.astra.client.admin;

import com.datastax.astra.client.DataAPIClient;

import java.util.UUID;

public class DropDatabase {
  public static void main(String[] args) {
    AstraDBAdmin astraDBAdmin = new DataAPIClient("TOKEN").getAdmin();

    // Delete an existing database
    astraDBAdmin.dropDatabase("<database_name>");

    // Delete an existing database by ID
    astraDBAdmin.dropDatabase(UUID.fromString("<database_id>"));

  }
}
curl -sS -L -X POST "https://api.astra.datastax.com/v2/databases/DB_ID/terminate" \
--header "Authorization: Bearer APPLICATION_TOKEN" \
--header "Content-Type: application/json"

Client reference

  • Python

  • TypeScript

  • Java

  • curl

For more information, see the client reference.

For more information, see the client reference.

For more information, see the client reference.

Client reference documentation is not applicable for HTTP.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2025 | Privacy policy | Terms of use Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: Contact IBM