From d3f4b30bfa2f541adbe9fe8f0fed77455c6f2ff3 Mon Sep 17 00:00:00 2001 From: Tuykroa Date: Sat, 1 Feb 2020 02:55:36 +0100 Subject: [PATCH 1/4] Update client.py Ajout show tag keys --- influxdb/client.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/influxdb/client.py b/influxdb/client.py index 5e39f490..038d1d83 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -673,6 +673,24 @@ def get_list_measurements(self): """ return list(self.query("SHOW MEASUREMENTS").get_points()) + def get_list_tags(self): + """Get the list of tags in InfluxDB. + + :returns: all tags in InfluxDB + :rtype: list of dictionaries + + :Example: + + :: + + >> dbs = client.get_list_tags() + >> dbs + [{u'name': u'measurements1'}, + {u'name': u'measurements2'}, + {u'name': u'measurements3'}] + """ + return list(self.query("SHOW TAG KEYS").get_points()) + def drop_measurement(self, measurement): """Drop a measurement from InfluxDB. From 7713bbda735643485e636def41c8d17d10e1d615 Mon Sep 17 00:00:00 2001 From: Tuykroa Date: Sat, 1 Feb 2020 03:40:07 +0100 Subject: [PATCH 2/4] Add show tags and fields --- influxdb/client.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/influxdb/client.py b/influxdb/client.py index 038d1d83..1c96c461 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -690,6 +690,24 @@ def get_list_tags(self): {u'name': u'measurements3'}] """ return list(self.query("SHOW TAG KEYS").get_points()) + + def get_list_fields(self): + """Get the list of fields in InfluxDB. + + :returns: all fields in InfluxDB + :rtype: list of dictionaries + + :Example: + + :: + + >> dbs = client.get_list_fields() + >> dbs + [{u'name': u'measurements1'}, + {u'name': u'measurements2'}, + {u'name': u'measurements3'}] + """ + return list(self.query("SHOW FIELD KEYS").get_points()) def drop_measurement(self, measurement): """Drop a measurement from InfluxDB. From 80280c180076b55ef56a26daae15c400cda68ddf Mon Sep 17 00:00:00 2001 From: Tuykroa Date: Sat, 1 Feb 2020 04:00:10 +0100 Subject: [PATCH 3/4] update explanations get_list_tags & fields Controlled and ready to summit --- influxdb/client.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/influxdb/client.py b/influxdb/client.py index 1c96c461..a54a4014 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -685,9 +685,7 @@ def get_list_tags(self): >> dbs = client.get_list_tags() >> dbs - [{u'name': u'measurements1'}, - {u'name': u'measurements2'}, - {u'name': u'measurements3'}] + [{u'tagKey': u'tag1'}, {u'tagKey': u'tag2'}, {u'tagKey': u'tag3'}] """ return list(self.query("SHOW TAG KEYS").get_points()) @@ -703,9 +701,8 @@ def get_list_fields(self): >> dbs = client.get_list_fields() >> dbs - [{u'name': u'measurements1'}, - {u'name': u'measurements2'}, - {u'name': u'measurements3'}] + [{u'fieldKey': u'field1', u'fieldType': u'type1'}, {u'fieldKey': u'field2', u'fieldType': u'type2'}, + {u'fieldKey': u'field3', u'fieldType': u'type3'}] """ return list(self.query("SHOW FIELD KEYS").get_points()) From 8cd5a49b92ee3aaa4f358231eada3fdd5c234a0c Mon Sep 17 00:00:00 2001 From: Tuykroa Date: Sat, 1 Feb 2020 07:05:14 +0100 Subject: [PATCH 4/4] manage spaces in comments --- influxdb/client.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/influxdb/client.py b/influxdb/client.py index a54a4014..510b533c 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -685,10 +685,12 @@ def get_list_tags(self): >> dbs = client.get_list_tags() >> dbs - [{u'tagKey': u'tag1'}, {u'tagKey': u'tag2'}, {u'tagKey': u'tag3'}] + [{u'tagKey': u'tag1'}, + {u'tagKey': u'tag2'}, + {u'tagKey': u'tag3'}] """ return list(self.query("SHOW TAG KEYS").get_points()) - + def get_list_fields(self): """Get the list of fields in InfluxDB. @@ -701,11 +703,12 @@ def get_list_fields(self): >> dbs = client.get_list_fields() >> dbs - [{u'fieldKey': u'field1', u'fieldType': u'type1'}, {u'fieldKey': u'field2', u'fieldType': u'type2'}, + [{u'fieldKey': u'field1', u'fieldType': u'type1'}, + {u'fieldKey': u'field2', u'fieldType': u'type2'}, {u'fieldKey': u'field3', u'fieldType': u'type3'}] """ return list(self.query("SHOW FIELD KEYS").get_points()) - + def drop_measurement(self, measurement): """Drop a measurement from InfluxDB.