Direct SELECT FROM queries fail with "NoMethodError: undefined method `time_precision'"
I'm using influxdb-ruby 0.2.2 and can't seem to run queries that aren't wrapped in db.query(...).
$ influxdb-cli -u admin -p admin -d graphite --pretty --time-precision=ms
Connecting to {"host"=>"localhost", "port"=>8086, "username"=>"admin", "password"=>"admin", "database"=>"graphite", "ssl"=>false, "time_precision"=>"ms", "pretty"=>"pretty"}
✔ ready
[1] pry(main)> SELECT * FROM /.*/ LIMIT 1
NoMethodError: undefined method `time_precision' for #<InfluxDB::Client:0x007fda9581a548>
from /Users/grol/.gem/ruby/2.2.0/gems/influxdb-cli-0.1.4/bin/influxdb-cli:71:in `block in <top (required)>'
[1] pry(main)> db.query('SELECT * FROM /.*/ LIMIT 1')
=> [
[ 0] {
"name" => "foo",
"tags" => nil,
"values" => [
[0] {
"time" => "2015-09-09T01:29:44Z",
"value" => 1
}
]
},
...
:pushpin: #14
hi @roldugin
Are you using the latest influxdb-cli?
I'm using the latest influxdb-cli available (0.1.4), not the one from GitHub.
@roldugin great thanks. I'm not actively using influxdb-cli, but I will to check it. Meanwhile, would you be able to submit a PR?
All time_precision references: https://github.com/phstc/influxdb-cli/search?utf8=%E2%9C%93&q=time_precision
I have the same issue:
$ influxdb-cli --host influxapi.local --port 80 -d sensu
WARN: Unresolved specs during Gem::Specification.reset:
unicode-display_width (>= 1.1.1, ~> 1.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Connecting to {"host"=>"influxapi.local", "port"=>"80", "username"=>"root", "password"=>"root", "database"=>"sensu", "ssl"=>false, "time_precision"=>"s"}
✔ ready
[1] pry(main)> SELECT max("elected") FROM "mesos-master" group by "host","mesos-role"
NoMethodError: undefined method `time_precision' for #<InfluxDB::Client:0x007fcdb58be608>
from /usr/local/lib/ruby/gems/2.4.0/gems/influxdb-cli-0.1.4/bin/influxdb-cli:71:in `block in <top (required)>'
Hi @luisdavim
I tried to fix the time_precision error, but it seems like InfluxDB is all changed, it's no longer returning a hash here and write_point in the way I used to use is now failing InfluxDB::Error: {"error":"unable to parse 'tests ': invalid field format"}.
I started #14 to fix it, but since I'm no longer using InfluxDB, I can't provide any ETA for the fix. Any help would be more than appreciated, in case you can take over that PR.