挣扎于 SQL 行
Struggling with SQL line
我正在为类似 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"}
我该如何解决这个问题?
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
也是合法的,但不推荐)。
我正在为类似 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"}
我该如何解决这个问题?
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
也是合法的,但不推荐)。