Influx: Error when querying datastreams with special characters
When querying datastreams with "special" characters (others than 0-9
, a-z
and _
), the systems raises an
HTTP 500 Internal server error
Example:
This is caused by the unescaped usage of the datastream variable in app/gfz/influx.py
in the method get_observations
. Trying it out with the Influx client I can reproduce the error:
First query from the method:
> SELECT SoilTemperature_0.1m FROM heydenhof WHERE time >= '2013-01-29' and time <= '2014-04-14';
ERR: error parsing query: found .1, expected FROM at line 1, char 25
Second query from the method:
> SELECT value AS SoilTemperature_0.1m FROM heydenhof_SoilTemperature_0.1m WHERE time >= '2013-01-29' and time <= '2014-04-14';
ERR: error parsing query: found .1, expected FROM at line 1, char 34
When I put the datastream into quotes, both queries don't return an error and the second query returns data, as expected:
> SELECT value AS "SoilTemperature_0.1m" FROM "heydenhof_SoilTemperature_0.1m" WHERE time >= '2013-01-29' and time <= '2014-04-14' LIMIT 3;
name: heydenhof_SoilTemperature_0.1m
time SoilTemperature_0.1m
---- --------------------
1359417600000000000 0
1359417600000000000 0
1359418500000000000 0
Edited by Marc Hanisch