Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug is delete_api. #168

Closed
newskooler opened this issue Nov 16, 2020 · 8 comments · Fixed by #179
Closed

A bug is delete_api. #168

newskooler opened this issue Nov 16, 2020 · 8 comments · Fixed by #179
Milestone

Comments

@newskooler
Copy link

newskooler commented Nov 16, 2020

I don't see a way that I can delete a measurement from a bucket (I can see how to delete a whole bucket).
Can you please show how? I am sure that's possible : )

I tried to follow the advice here:
https://community.influxdata.com/t/delete-measurements-by-name-from-bucket/15060

But I get an error in the form of:

ApiException: (501)
Reason: Not Implemented
HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.14.0 (Ubuntu)', 'Date': 'Tue, 17 Nov 2020 12:04:49 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '54', 'Connection': 'keep-alive', 'X-Platform-Error-Code': 'not implemented'})
HTTP response body: {"code":"not implemented","message":"Not implemented"}
@newskooler
Copy link
Author

I identified the bug. It's mentioned here: https://docs.influxdata.com/influxdb/v2.0/reference/syntax/delete-predicate/

I also tried to add a branch with the fixed issue, but got the following error:

ERROR: Permission to influxdata/influxdb-client-python.git denied to snenkov.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@newskooler newskooler changed the title How to delete measurement from bucket? A bug is delete_api. Nov 17, 2020
@bednar
Copy link
Contributor

bednar commented Nov 18, 2020

Hi @snenkov,

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)

The delete API works only for the Influx Cloud instance.

In InfluxDB OSS 2.0rc, the delete with predicate API (/api/v2/delete) has been disabled and returns a 501 Not implemented message.

Regards

@bednar
Copy link
Contributor

bednar commented Nov 18, 2020

Related issue: influxdata/influxdb#19635

@newskooler
Copy link
Author

Sure, but it's a matter of changing the string as per the docs from

/api/v2/delete

To

/delete

Right?

@bednar
Copy link
Contributor

bednar commented Nov 18, 2020

I think the doc is not clear. As I see in sources the delete is still on /api/v2/delete:

https://github.com/influxdata/influxdb/blob/15b95312736f1ea651d2e14ba8343e483d5cd92a/http/delete_handler.go#L55

We have tests for DeleteAPI... Did you try it with /delete path? I tried it and the /delete doesn't work

ERROR: Permission to influxdata/influxdb-client-python.git denied to snenkov.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You have to fork this repository and create PR from your repo.

@Fahien
Copy link

Fahien commented Nov 30, 2020

Hi, I bumped into this issue while working with InfluxDB OSS Version 2.0.2 and influxdb-client 1.12.0.
I tried the /delete path and I confirm that it still does not work.

@bednar
Copy link
Contributor

bednar commented Dec 1, 2020

@Fahien please vote for influxdata/influxdb#19635

@bednar
Copy link
Contributor

bednar commented Dec 16, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants