InfluxCommunity/influxdb-ruby

Disable Integer default for values (backward compatibility)

Closed this issue · 3 comments

For databases that have measurentments with float (default) types for number values (for example ingest data with influxdb 0.2.3 version)

dmke commented

I'm sorry, I don't understand.

If you want to store float values in InfluxDB with this Ruby gem, simply ensure your values are not ints:

cli = InfluxDB::Client #...
cli.write_point "sonsors", tags: { sensor: "temp42" }, values: { temperature: 23.0 }

Hi,
I was have influxdb 0.2.3 gem, this insert data in influxdb database with default type (float), when i was migrate to lastes version, at moment on ingest we have error "Type conflict on insert int value in float field", for parcial workarround i change the logig of the gem:

https://github.com/superguillen/influxdb-ruby/blob/master/lib/influxdb/point_value.rb

dmke commented

As stated above, you need to ensure your ingested data fits your schema (value.to_f is a feasible workaround you could apply).

The gems works as intended: it will store the data points with the type you provide.