【发布时间】:2023-05-16 22:12:02
【问题描述】:
我有 influxdb 数据库test 测量:
name: mes1
time Amount Buy_order_id Price
---- ------ ------------ -----
1529832177822 0.02294 132868375 130117.83
我想在 Grafana 中制作图表,但所有数据都是 1970 年的。我还有其他测量:
name: cpu_load_short
time Bool_value Float_value Int_value String_value host region
---- ---------- ----------- --------- ------------ ---- ------
1257894000000000000 true 0.64 3 Text server01 us-west
这次效果很好。我发现,测量中的时间cpu_load_short 存储在 ns 中,但测量中的数据 mes1 存储在 ms 中。
我从 websocket 收到mes1 的时间。 cpu_load_short的时间是从python生成的:
datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
所有数据都通过 influxdb-python 发送到 influxdb。我尝试调整mes1 的时间并在数字末尾添加六个零:
'1529832177822' -> '1529832177822000000'
但我收到了:
OverflowError: signed integer is greater than maximum
如何将数据发送到 influxdb 并从中制作图表,以便数据具有正确的格式和正确的日期?也许我遗漏了一些东西,但我不知道为什么我不能在 ns 中将数据发送到我的数据库,但我可以用 datetime 发送它。谁能解释一下,问题出在哪里?
【问题讨论】:
标签: python-3.x influxdb influxdb-python