27 lines
993 B
Python
27 lines
993 B
Python
from influxdb_client import InfluxDBClient, Point
|
|
from influxdb_client.client.write_api import SYNCHRONOUS
|
|
|
|
bucket = "wind"
|
|
|
|
client = InfluxDBClient(url="http://influxdb.athene.tech/",
|
|
token="2CEePET3ss2khtjsdGrJap8mVzHhR2dRwuyK3NuFBvDgGtOMSi6Jstsrp2o-OANzD8fxB73PsTyIbqgbnokoXQ==",
|
|
org="UlSTU")
|
|
|
|
write_api = client.write_api(write_options=SYNCHRONOUS)
|
|
query_api = client.query_api()
|
|
|
|
# p = Point("my_measurement").tag("location", "Prague").field("val", 200.0)
|
|
#
|
|
# write_api.write(bucket=bucket, record=p)
|
|
|
|
tables = query_api.query('from(bucket:"wind") |> range(start: -7d)')
|
|
|
|
for table in tables:
|
|
print(table)
|
|
for row in table.records:
|
|
print (row.values)
|
|
print(row.values['_field'])
|
|
print(row.values['_value'])
|
|
|
|
# manger = InfluxManager("wind","http://localhost:8086","IkRV5NlnRp_fTHR5x4mgMzi_coQ31ILQBaQUf5wZfXIJ9iwCZBH9qiHnSREgdu_bdsmAjUisUTmqoMvpXDXUOA==","nikitaOrganization")
|
|
# print(manger.getDataByTime()) |