Drop an index

Tables with the Data API are currently in public preview. Development is ongoing, and the features and functionality are subject to change. Astra DB Serverless, and the use of such, is subject to the DataStax Preview Terms.

Deletes an index from a table in a Serverless (Vector) database.

Ready to write code? See the examples for this method to get started. If you are new to the Data API, check out the quickstart.

Result

Deletes the specified index.

Does not return anything.

Parameters

Use the drop_table_index method, which belongs to the astrapy.Database class.

Method signature
python
drop_table_index(
  name: str,
  *,
  keyspace: str,
  if_exists: bool,
  table_admin_timeout_ms: int,
  request_timeout_ms: int,
  timeout_ms: int,
) -> None
Name Type Summary

name

str

The name of the index to delete.

keyspace

str | None

The keyspace where you created the index. If unspecified, the database’s default keyspace setting is used.

if_exists

bool | None

If True, and an index with the given name doesn’t exist in the keyspace, then the command succeeds and silently does nothing. In this case, no actual index deletion occurs.

If False (default), an error occurs if an index with the specified name does not exist in the keyspace.

table_admin_timeout_ms

int | None

A timeout, in milliseconds, to impose on the underlying API request. If not provided, the Database defaults apply. This parameter is aliased as request_timeout_ms and timeout_ms for convenience.

Examples

The following examples demonstrate how to drop an index from a table.

Drop an index

python
from astrapy import DataAPIClient

# Get a database
client = DataAPIClient("APPLICATION_TOKEN")
database = client.get_database("API_ENDPOINT")

# Drop an index
database.drop_table_index("rating")

Drop an index only if the index exists

Use this option to silently do nothing if an index with the specified name does not exist.

python
from astrapy import DataAPIClient

# Get a database
client = DataAPIClient("APPLICATION_TOKEN")
database = client.get_database("API_ENDPOINT")

# Drop an index
database.drop_table_index("rating", if_exists=True)

Client reference

For more information, see the client reference.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2025 DataStax | 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: +1 (650) 389-6000, info@datastax.com