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

Hi, is this still working? I’m trying to do it but not working for me. I can write and read data from a bucket, but not delete it

Hi @Rui_Alves,

which type of the InfluxDB Cloud do you use? The InfluxDB Cloud Serverless doesn’t supports delete data. For more info see - Delete data | InfluxDB Cloud Serverless Documentation.

Regards

Oh yep, that’s why, I couldnt find that documentation somehow. Thank you for your answer! That was exactly the problem ahah