Delete a row (Python)

Finds a single row in a table using filter clauses, and then deletes that row.

Deleting rows produces tombstones. Excessive tombstones can impact query performance.

For general information about working with tables and rows, see About tables with the Data API (Python).

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 a row that matches the specified parameters. If no rows match the specified parameters, this method does not delete any rows.

Does not return anything.

Parameters

Use the delete_one method, which belongs to the astrapy.Table class.

Method signature
delete_one(
  filter: Dict[str, Any],
  *,
  general_method_timeout_ms: int,
  request_timeout_ms: int,
  timeout_ms: int,
) -> None
Name Type Summary

filter

dict

Describes the full primary key of the row to delete.

For this method, the filter can only use the $eq operator and columns in the primary key.

general_method_timeout_ms

int

Optional. The maximum time, in milliseconds, that the client should wait for the underlying HTTP request.

This parameter is aliased as request_timeout_ms and timeout_ms for convenience.

Default: The default value for the table. This default is 30 seconds unless you specified a different default when you initialized the Table or DataAPIClient object. For more information, see Timeout options.

Examples

The following examples demonstrate how to delete a row in a table.

Delete a row by primary key

You can filter by primary key to find and delete a row. The filter must describe the full primary key and cannot include any other columns.

from astrapy import DataAPIClient

# Get an existing table
client = DataAPIClient()
database = client.get_database(
    "API_ENDPOINT", token="APPLICATION_TOKEN"
)
table = database.get_table("TABLE_NAME")

# Delete a row
table.delete_one(
    {"title": "Hidden Shadows of the Past", "author": "John Anthony"}
)

Client reference

For more information, see the client reference.

Was this helpful?

Give Feedback

How can we improve the documentation?

© Copyright IBM Corporation 2026 | 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