influxdb-python icon indicating copy to clipboard operation
influxdb-python copied to clipboard

[Documentation] get_list_continuous_queries() Python example

Open MrDiba opened this issue 4 years ago • 0 comments

I would love to see a example of the usage of the get_list_continuous_queries() function.

I'm currently building a function where I check if a continuous query exist, and if not I will create one. The documentation is showing that the return will be a list of dictionaries. It would be great if the Python example contains a small example on how to deal with the list of dictonaries.

Example:

>> cqs = client.get_list_cqs()
>> cqs
[
    {
        u'db1': []
    },
    {
        u'db2': [
            {
                u'name': u'vampire',
                u'query': u'CREATE CONTINUOUS QUERY vampire ON '
                           'mydb BEGIN SELECT count(dracula) INTO '
                           'mydb.autogen.all_of_them FROM '
                           'mydb.autogen.one GROUP BY time(5m) END'
            }
        ]
    }
]

How would I get the name of the query in db2 if I do not know the position of db2?

MrDiba avatar Jul 16 '20 19:07 MrDiba