Query Parse Error with Ruby Client, not in Influx Console


I’m using the Ruby InfluxDB API. This query fails to parse when called via Ruby, but the query works (with or without edit) in the InfluxDB cli tool. Oddly, editing an unrelated part of the query from the parse error causes it to succeed.

The query:

SELECT SUM(call_count) as call_count, SUM(call_time) as total_call_time, MAX(max_call_time) as max_call_time, MEAN(percentile_95th) as percentile_95th
  FROM org_1.dbmetrics.dbmetrics_1
    time >= 1507136400s
    AND time < 1507741200s
    AND (app = '6')
    AND ((model_name = 'Request' AND operation = 'save') OR (model_name = 'Request' AND operation = 'find'))
  GROUP BY model_name,operation,scope


{"error":"error parsing query: found ), expected identifier, string, number, bool at line 7, char 10"}

The odd part:

  1. If I remove scope from the GROUP BY, the query works.
  2. If I run the query directly via Influx console, the query works.

Wrapping scope in double quotes has no impact, and nothing here appears to be a reserved keyword.

I’m running InfluxDB version 1.2.0 on OSX and the influxdb ruby gem is version 0.3.16.