gpt4 book ai didi

mysql - 与 SQL 行作斗争

转载 作者:行者123 更新时间:2023-11-29 10:12:01 25 4
gpt4 key购买 nike

我正在努力处理类似 SQL 的行,而且我只是不知道如何修复它。

query = "SELECT P_askbid_midprice1, Label1 FROM 'DCIX_OB' WHERE time >= '2018-02-16T09:00:00Z' and time <= '2018-02-16T16:00:00' "

上一行出现以下错误:

Traceback (most recent call last):
File "graph_influxdb.py", line 53, in <module>
read_data(length='5min')
File "graph_influxdb.py", line 29, in read_data
result = client.query(query)
File "/usr/local/lib/python3.6/dist-packages/influxdb/client.py", line 394, in query
expected_response_code=expected_response_code
File "/usr/local/lib/python3.6/dist-packages/influxdb/client.py", line 271, in request
raise InfluxDBClientError(response.content, response.status_code)
influxdb.exceptions.InfluxDBClientError: 400: {"error":"error parsing query: found DCIX_OB, expected identifier at line 1, char 39"}

如何解决该问题?

最佳答案

Single quote string values (for example, tag values) but do not single quote identifiers (database names, retention policy names, user names, measurement names, tag keys, and field keys).

Double quote identifiers if they start with a digit, contain characters other than [A-z,0-9,_], or if they are an InfluxQL keyword. Double quotes are not required for identifiers if they don’t fall into one of those categories but we recommend double quoting them anyway.

即使用 FROM "DCIX_OB" (FROM DCIX_OB 也是合法的,但不推荐)。

关于mysql - 与 SQL 行作斗争,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50807763/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com