How to empty InfluxDB Cloud bucket using Python Client

I’ve just started using InfluxDB and right now I’m learning how to interact with it. I would like to know how to perform CRUD operations and, while I understand the CRU part, I haven’t found much on Deleting data.

This is what I’m using:

  • InfluxDB Cloud
  • Python client library - influxdb-client

How to I erase all data from a cloud bucket? Could you post some snippets?
Thanks

Hi @ajcandfield,

thanks for using our client. You could use something like:

start = "1970-01-01T00:00:00Z"
stop = "2021-01-01T00:00:00Z"
delete_api = client.delete_api()
delete_api.delete(start, stop, '_measurement="sensorData"', bucket_id=bucket_id, org_id=organization_id)

Regards

2 Likes