Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Add functions to SHOW TAG KEYS and SHOW FIELD KEYS #779

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions influxdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,42 @@ 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'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.

:returns: all fields in InfluxDB
:rtype: list of dictionaries

:Example:

::

>> 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'field3', u'fieldType': u'type3'}]
"""
return list(self.query("SHOW FIELD KEYS").get_points())

def drop_measurement(self, measurement):
"""Drop a measurement from InfluxDB.

Expand Down