Delete "MEASUREMENTS " from the database

Hello,
I can’t delete a “measurements” from the database.

Unfortunately I created a CQ by assigning a wrong name to the “measurements” and I would like to delete it, but I cannot manage with any command, even deleting the continuous query.

The measure in question is called: “sensor_infinite_dataraw_temperture” and is located in the database “homeassistant”

I tried with the following command:
DROP MEASUREMENT sensor_infinite_dataraw_temperture

but influx responds with “database non found”

Which command should I use?

I use InfluxDB with HomeAssistant

Thanks

Hello @SmartM-ui,
Welcome! What version of InfluxDB are you running?

@Anaisdg
Hi,
I use influxdb 1.8 as an add-on in Home Assistant.
Thanks for answering me, I hope for your help!

Hello @SmartM-ui,
I’ll admit I’m a little confused.
Can you show the output of

  • > SHOW DATABASES
  • USE homeassistant
  • SHOW MEASUREMENTS

Thank you.

@Anaisdg
Thanks for replying, I send the reference screenshots

@Anaisdg
with the command
SHOW MEASUREMENTS ON “homeassistant”
i can see the measurements

the sensor I was talking about in the first post (“sensor_infinite_dataraw_temperture”) I deleted it by deleting the entire “homeassistant” database, but I would like to learn how to delete the “measurements” for the future in case of need, without having to delete the entire DB !

Ahhh I understand the problem now @SmartM-ui,
You have to use the CLI to use the command drop measurements.

Thanks for the reply, but how do I connect to the influx db?
I have installed the add-on in HomeAssistant installed on raspberry as an operating system.

Hello @SmartM-ui,
How did you install influxdb?
In the directory that you installed influxDB you run ./influx to start the CLI.
This might be useful:

Or you could use the API

Thanks, I try to see.
I installed the add-on directly into the HASSOS operating system:

Hello @SmartM-ui,
Looking at the home assistant docs

It looks like the hassio-addons/addon-influxdb “exposes an HTTP API for client interaction” So I would use the InfluxDB API to drop a series or measurement. With default as localhost:8086. So I’d try following the InfluxDB API documentation examples.

Thanks, I try to understand how to do it :slight_smile:

Hello @SmartM-ui,
I haven’t used the 1.x API in a while, so I might be wrong, but you could try:

curl http://localhost:8086/query \
  -d db="homeassistant" \
  -d q='drop measurement "sensor_infinite_dataraw_temperture"'

Hi!
thanks for the information, writing the code from the terminal in home assistant reports an authentication error, as shown in the image.

Writing the code from the terminal on the macbook, it reports the following message:
curl: (7) Failed to connect to localhost port 8086: Connection refused

ah okay you need to add auth according to: InfluxDB API reference | InfluxDB OSS 1.8 Documentation

Thank you very much!

Hi @Anaisdg ,
thanks to the documentation you indicated, my friend Mario (shogunxam (MARIO D'AMICO) · GitHub) was able to process the code that allowed the cancellation of the “measurements”:

curl -u myusername: mypassword -XPOST ‘http: // localhost: 8086 / query? db = mydb’ --data-urlencode ‘q = drop measurement “mymeasurement”’

Have a nice day and thanks again