influxdb-client 1.10.0.pre.1408 → 1.10.0.pre.1440

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '013876e9eaa68bd87570e052b14006ac79fd316ddaf0cf71173b8db024ea271e'
4
- data.tar.gz: 24c018d6b548cd9d2acd1b6f7b179976862cd01dcf7e8b136fb3f4ef19bcaa74
3
+ metadata.gz: 6d009359fa04212dbe631f97ac9e3c3f20ba29cc287d6c72cf26a3f4990fe209
4
+ data.tar.gz: 78ff8457ef6514388b9577715279ac10e67b0d8cc756a256efb4df092eb7e2ff
5
5
  SHA512:
6
- metadata.gz: c2b4774d72b7b64c6c5cafef67159fd3abb4b1f3d10d3d3c3d51950a12e27776ab216cc62216c4cf190d1718f7a7dabf20fd80db35e4ea01a53306d6331bafe9
7
- data.tar.gz: 8bcced7536d8495664de2e5ed33da09f980934ae08b3a5bc867383c7edf768334c4bc3192ad1b7d8ccf628b662d5fa6c1342d04ab7844fabb66a160f86e9cce8
6
+ metadata.gz: de4272635930542586ab1098e1d2e09b3a5cb9eadac74e38c466d172ab01aa0d7dd733d68fd063bdb46879a908888399e15c217d8cf9d4e32ee4b79943495561
7
+ data.tar.gz: 591184df7c2fc61b5e43b64724106faf8abe00f5876b000f5368715be9dbcb36a94cce0fb636a5ea8976cf35f1db4b7d74a4d0c0b5a8ee1ff86fb4b5a18d2fda
@@ -1,7 +1,10 @@
1
1
  ## 1.10.0 [unreleased]
2
2
 
3
3
  ### Features
4
- 1. [#59](https://github.com/influxdata/influxdb-client-ruby/pull/59): CSV parser is able to parse export from UI
4
+ 1. [#59](https://github.com/influxdata/influxdb-client-ruby/pull/59): CSV parser is able to parse export from UI
5
+
6
+ ### Bug Fixes
7
+ 1. [#61](https://github.com/influxdata/influxdb-client-ruby/pull/61): Query results has precision with nanosecond, e.g. '1970-01-01T00:00:00.000123456+00:00'
5
8
 
6
9
  ## 1.9.0 [2020-10-30]
7
10
 
data/README.md CHANGED
@@ -194,7 +194,7 @@ The data could be written as:
194
194
 
195
195
  1. `String` that is formatted as a InfluxDB's line protocol
196
196
  1. `Hash` with keys: name, tags, fields and time
197
- 1. [Data Point](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb/client/point.rb#L28) structure
197
+ 1. [Data Point](https://github.com/influxdata/influxdb-client-ruby/blob/master/lib/influxdb2/client/point.rb#L28) structure
198
198
  1. `Array` of above items
199
199
 
200
200
  ```ruby
@@ -274,7 +274,7 @@ Server availability can be checked using the `client.health` method. That is equ
274
274
 
275
275
  ### InfluxDB 1.8 API compatibility
276
276
 
277
- [InfluxDB 1.8.0 introduced forward compatibility APIs](https://docs.influxdata.com/influxdb/latest/tools/api/#influxdb-2-0-api-compatibility-endpoints) for InfluxDB 2.0. This allow you to easily move from InfluxDB 1.x to InfluxDB 2.0 Cloud or open source.
277
+ [InfluxDB 1.8.0 introduced forward compatibility APIs](https://docs.influxdata.com/influxdb/v1.8/tools/api/#influxdb-2-0-api-compatibility-endpoints) for InfluxDB 2.0. This allow you to easily move from InfluxDB 1.x to InfluxDB 2.0 Cloud or open source.
278
278
 
279
279
  The following forward compatible APIs are available:
280
280
 
@@ -244,7 +244,7 @@ module InfluxDB2
244
244
  when 'base64Binary'
245
245
  Base64.decode64(str_val)
246
246
  when 'dateTime:RFC3339', 'dateTime:RFC3339Nano'
247
- Time.parse(str_val).to_datetime.rfc3339
247
+ Time.parse(str_val).to_datetime.rfc3339(9)
248
248
  else
249
249
  str_val
250
250
  end
@@ -155,10 +155,33 @@ class FluxCsvParserTest < MiniTest::Test
155
155
  tables = InfluxDB2::FluxCsvParser.new(data).parse.tables
156
156
  records = tables[0].records
157
157
 
158
- assert_equal Time.parse('1970-01-01T00:00:10Z').to_datetime.rfc3339, records[0].values['value']
158
+ assert_equal _parse_time('1970-01-01T00:00:10Z'), records[0].values['value']
159
159
  assert_nil records[1].values['value']
160
160
  end
161
161
 
162
+ def test_mapping_rfc3339_nano
163
+ data = "#group,false,false,true,true,false,false,true,true,true,true,true,true\n" \
164
+ '#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,' \
165
+ "string,string,string,string,string,string\n" \
166
+ "#default,mean,,,,,,,,,,,\n" \
167
+ ",result,table,_start,_stop,_time,_value,_field,_measurement,language,license,name,owner\n" \
168
+ ',,0,2020-11-02T07:29:49.55050738Z,2020-12-02T07:29:49.55050738Z,2020-11-02T09:00:00Z,9,' \
169
+ "stars,github_repository,Ruby,MIT License,influxdb-client-ruby,influxdata\n"
170
+
171
+ tables = InfluxDB2::FluxCsvParser.new(data).parse.tables
172
+ records = tables[0].records
173
+
174
+ assert_equal 9, records[0].values['_value']
175
+ start = Time.parse(records[0].values['_start'])
176
+ assert_equal 2020, start.year
177
+ assert_equal 11, start.month
178
+ assert_equal 2, start.day
179
+ assert_equal 7, start.hour
180
+ assert_equal 29, start.min
181
+ assert_equal 49, start.sec
182
+ assert_equal '55050738', start.strftime('%8N')
183
+ end
184
+
162
185
  def test_mapping_duration
163
186
  data = '#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339' \
164
187
  ",dateTime:RFC3339,long,string,string,string,duration\n" \
@@ -209,7 +232,7 @@ class FluxCsvParserTest < MiniTest::Test
209
232
  private
210
233
 
211
234
  def _parse_time(time)
212
- Time.parse(time).to_datetime.rfc3339
235
+ Time.parse(time).to_datetime.rfc3339(9)
213
236
  end
214
237
 
215
238
  def _assert_record(flux_record, values: nil, size: 0, value: nil)
@@ -55,4 +55,25 @@ class QueryApiIntegrationTest < MiniTest::Test
55
55
  assert_equal 2, record.value
56
56
  assert_equal 'level', record.field
57
57
  end
58
+
59
+ def test_parsed_time_precision
60
+ now = Time.now.utc
61
+ measurement = 'h2o_query_' + now.to_i.to_s + now.nsec.to_s
62
+
63
+ @client.create_write_api.write(data: InfluxDB2::Point.new(name: measurement)
64
+ .add_field('value', 10)
65
+ .time(123_456, InfluxDB2::WritePrecision::NANOSECOND))
66
+
67
+ result = @client.create_query_api.query(query: 'from(bucket: "my-bucket") |> range(start: 0, stop: now()) '\
68
+ "|> filter(fn: (r) => r._measurement == \"#{measurement}\")")
69
+
70
+ assert_equal 1, result.size
71
+
72
+ records = result[0].records
73
+ assert_equal 1, records.size
74
+
75
+ record = records[0]
76
+ assert_equal 10, record.value
77
+ assert_equal '1970-01-01T00:00:00.000123456+00:00', record.values['_time']
78
+ end
58
79
  end
@@ -67,7 +67,7 @@ class QueryApiTest < MiniTest::Test
67
67
 
68
68
  record1 = result[0].records[0]
69
69
 
70
- assert_equal Time.parse('1970-01-01T00:00:10Z').to_datetime.rfc3339, record1.time
70
+ assert_equal Time.parse('1970-01-01T00:00:10Z').to_datetime.rfc3339(9), record1.time
71
71
  assert_equal 'mem', record1.measurement
72
72
  assert_equal 10, record1.value
73
73
  assert_equal 'free', record1.field
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxdb-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0.pre.1408
4
+ version: 1.10.0.pre.1440
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Bednar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-28 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler