influxDB



In [8]:
from influxdb import InfluxDBClient

host = "localhost"
port = 8086
user = 'restapi'
password = '1234' #Or something more sofisticated
dbname = 'by-administrative-region'

query = 'list series;'


client = InfluxDBClient(host, port, user, password, dbname)


    #print("Queying data: " + query)
result = client.query(query)

In [9]:
result


Out[9]:
[{u'columns': [u'time', u'sequence_number'], u'name': u'test', u'points': []},
 {u'columns': [u'time', u'sequence_number'],
  u'name': u'Sweden/Stockholm/Stockholm/parts/messured_Wp_ratio',
  u'points': []},
 {u'columns': [u'time', u'sequence_number'],
  u'name': u'Sweden/Stockholm/Stockholm/parts/power',
  u'points': []},
 {u'columns': [u'time', u'sequence_number'],
  u'name': u'Sweden/Stockholm/Stockholm/total',
  u'points': []}]

In [10]:
type(result)


Out[10]:
list

In [13]:
result[0]


Out[13]:
{u'columns': [u'time', u'sequence_number'], u'name': u'test', u'points': []}

In [ ]:
client.write_points_with_precision(,"m")

In [12]:
client.query('select time from %s order asc limit 1;' % "h00t")


Out[12]:
[]

In [ ]: