influxdata / influxdb-client-python

InfluxDB 2.0 python client
https://influxdb-client.readthedocs.io/en/stable/
MIT License
724 stars 187 forks source link

manage retention policies and Continuous queries #604

Closed piwi447 closed 1 year ago

piwi447 commented 1 year ago

Proposal: implement the methods to be able to manage the retention policies and the continuous queries on influx 2.x using Flux rather than InfluxQL

Current behavior: I cannot find any indication of method to do this within this client (the V1 client have these method available) Desired behavior: for retention policies : get_list, create, alter, drop for continuous queries : get_list, create, drop Alternatives considered: Describe other solutions or features you considered.

Use case: With the equivalent tool on V1 library i am able (on 1.8 to create or update this easily when some field are added or new measurment or retore from backup . I plan to migrate to 2.x but without such tool how can I manage my continuous queries ?

I join here the python script I am using with V1 client to give you an idea of what I need. Influx_RP _CQ.txt

gunnaraasen commented 1 year ago

@piwi447 The InfluxDB v2 API has no continuous query feature. The equivalent functionality in InfluxDB 2.x can be accomplished with flux tasks.

We do plan to implement a downsampling feature in the (currently undefined) InfluxDB 3.0 which will be a more direct replacement for continuous queries. The continuous queries as they exist in the v1 API are not carried forward, so I'm closing this request.

piwi447 commented 1 year ago

Thanks for the feedback, so my understanding of your answer is that there are no way to create task for influx 2.x using API trough python influxDB DB client V2. Thanks to confirm.

bednar commented 1 year ago

@piwi447 here is an example how to create the Task by python client - https://github.com/influxdata/influxdb-client-python/blob/master/examples/task_example.py