如標題
我有一個使用python 的influxdb api取得 bucket內的資料 手動執行可以取得一個列表 裡面有多個dataframe
但是放進crontab取回的是空值
this is my query code
from influxdb_client import InfluxDBClient
import warnings
from influxdb_client.client.warnings import MissingPivotFunction
import pandas as pd
warnings.simplefilter("ignore", MissingPivotFunction)
url="http://10.1.249.34:8888"
token = "gRoCXDtqL2CO9wOkC2titO9OLOTmt4oXIPGqQxxdlAN-w7f-tqnGWhmW9DF6D-api_LHnf46C4OBONpJ1yCAKQ=="
org = "bimap"
bucket = "delta_pdu"
bucket2="delta_pdu_etl"
client = InfluxDBClient(url=url, token=token, org=org)
query_api = client.query_api()
query='''
from(bucket: "delta_pdu")
|> range(start:-1m)
|> filter(fn: (r) => r["_measurement"] == "snmp")
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")'''
result = query_api.query_data_frame_stream(org=org, query=query)
for x in result:
print(x)