Reputation: 3779
I have some tag values that were unfortunately sent with quotes in them:
> SELECT count("count") FROM "railswebapp"
WHERE "auth_method" =~ /facebook/ GROUP BY "auth_method"
name: railswebapp
tags: auth_method=\"facebook\"
time count
---- -----
0 4
name: railswebapp
tags: auth_method=facebook
time count
---- -----
0 2632
>
Alas, querying for the "facebook" series is harder than I expect:
> SELECT "count" FROM "railswebapp"
WHERE "auth_method" = '\"facebook\"'
>
This work-around works but surely I can do better. Any suggestions?
> SELECT count("count") FROM "railswebapp"
WHERE "auth_method" =~ /facebook/
AND "auth_method" != 'facebook'
GROUP BY "auth_method"
name: railswebapp
tags: auth_method=\"facebook\"
time count
---- -----
0 4
> SELECT count FROM "railswebapp"
WHERE "auth_method" =~ /facebook/
AND "auth_method" != 'facebook'
GROUP BY "auth_method"
name: railswebapp
tags: auth_method=\"facebook\"
time count
---- -----
152412927875202308 1
152412927882740082 1
1524130761574200511 1
1524134859852346944 1
>
(Note: influx doesn't support line breaks in queries: they just make this question more readable.)
Upvotes: 1
Views: 1887
Reputation: 21
When dealing with single quotes I found this to work;
select * from some_measurement where some_tag =~ /\'foo\'/;
Upvotes: 0
Reputation: 18743
It is mentioned on influxdb documentation to not double or single quote measurement names, tag keys, tag values, and field keys.
Here is how quoting are handled,
It also mentioned ,
For string field values use a backslash character \ to escape:
Example,
Inserting data with tag-value containing double-quote
,
INSERT cpu,host="x" value=10
Querying,
select * from cpu where host = '\"x\"'
Output,
name: cpu
time host value
---- ---- -----
1530754262442056777 "x" 10
Upvotes: 1