I tested a lot of syntaxes of below query to InfluxDB from bash CLI. But still an error is reported. Seams to be problem with dash (hyphen) in maciej-test statement. Is any workaround or proper syntax to pass such name to CLI InfluxDB? It is strange because everything works file from InfluxDB prompt.
The query:
influx -precision rfc3339 -format csv -database test -execute “select mean(“Hum”) as “Hum” from “autogen”.“maciej-test” GROUP BY time(1s) FILL(none) limit 6 tz(‘Europe/Warsaw’)”
And the error raport:
ERR: error parsing query: found -, expected ; at line 1, char 44
error parsing query: found -, expected ; at line 1, char 44
Any idea what I im doing wrong?
EDIT 1
If I use stdin as input for SELECT command, everything works fine, like below:
influx -database test -format csv -precision rfc3339 << 'EOF'
select mean("Hum") as "Hum" from "autogen"."maciej-test" GROUP BY time(1s) FILL(none) limit 6 tz('Europe/Warsaw')
EOF
Very strange...
The problem is with nested quotes. Either use single quotes around select
influx -precision rfc3339 -format csv -database test -execute 'select mean(“Hum”) as “Hum” from “autogen”.“maciej-test” GROUP BY time(1s) FILL(none) limit 6 tz("Europe/Warsaw")'
or escape nested quotes in select
:
influx -precision rfc3339 -format csv -database test -execute “select mean(\“Hum\”) as \“Hum\” from \“autogen\”.\“maciej-test\” GROUP BY time(1s) FILL(none) limit 6 tz(‘Europe/Warsaw’)”