click_house 1.6.1 → 1.6.2

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: 85fbf603cf09ee0a076a3ca0fa0add17c167919c458008a5616a4a7b064b0790
4
- data.tar.gz: 95cf0f595c70a2943bba62a0d8568b4f432b3fdf27365b036377a66960733efe
3
+ metadata.gz: 6a24e10e60cd19671f70f521f6db773ef0d3b0f6f33a9ef40b5a26ed7aaf8106
4
+ data.tar.gz: 3a948f7381d345f6784a8a125bedbc62ba9df554920cc40eb217699c350cfc02
5
5
  SHA512:
6
- metadata.gz: 8a31451c3ed68aa5ff213cabaa51578723212fe43d0e63a1b58a1d68b135facece27f2d52025512d41862ba7495dcd05972f3a9cd8a4d01cc25916e2e502f42b
7
- data.tar.gz: 0d78cbad863fcb89e8d58da4c10eeec60013877c5097480c0e6bc190c9698641f5ac95c116bd3b938f7ce927aa58ad10abae73729ce579149d40a51e529320c7
6
+ metadata.gz: 12af01d64fb80f0fbfff2df8654c79b6574bd09b6159bac8ae9425417a5fc48fbf7ae8bcf2b0e42efc80bd23bc55212f5ba232f187e606b76fb8d6f7193a6976
7
+ data.tar.gz: 2d819029b2030f25b68a85f623dcbbec497aa9756d6b69d2e223eccdc97ba35ef58299ceea47f45de568cfdd161f09ca75e1635f9bc3176e94de337ae88e4a59
@@ -8,7 +8,7 @@ jobs:
8
8
 
9
9
  services:
10
10
  clickhouse:
11
- image: yandex/clickhouse-server:22.1
11
+ image: clickhouse/clickhouse-server:22.6
12
12
  ports:
13
13
  - 8123:8123
14
14
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.6.2
2
+ * [PR](https://github.com/shlima/click_house/pull/31) Add rows_before_limit_at_least to ResultSet
3
+ * [PR](https://github.com/shlima/click_house/pull/29) Force JSON format by using "default_format" instead of modifying the query
4
+
1
5
  # 1.6.1
2
6
  * [PR](https://github.com/shlima/click_house/pull/26) call logging middleware when an error is raised
3
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house (1.6.1)
4
+ click_house (1.6.2)
5
5
  faraday (>= 1.7)
6
6
  faraday_middleware
7
7
 
@@ -27,8 +27,8 @@ GEM
27
27
  faraday-em_synchrony (1.0.0)
28
28
  faraday-excon (1.1.0)
29
29
  faraday-httpclient (1.0.1)
30
- faraday-multipart (1.0.3)
31
- multipart-post (>= 1.2, < 3)
30
+ faraday-multipart (1.0.4)
31
+ multipart-post (~> 2)
32
32
  faraday-net_http (1.0.1)
33
33
  faraday-net_http_persistent (1.2.0)
34
34
  faraday-patron (1.0.0)
@@ -37,7 +37,7 @@ GEM
37
37
  faraday_middleware (1.2.0)
38
38
  faraday (~> 1.0)
39
39
  method_source (1.0.0)
40
- multipart-post (2.1.1)
40
+ multipart-post (2.2.3)
41
41
  parallel (1.22.1)
42
42
  parser (3.1.1.0)
43
43
  ast (~> 2.4.1)
data/docker-compose.yml CHANGED
@@ -2,7 +2,7 @@ version: '3.5'
2
2
 
3
3
  services:
4
4
  clickhouse:
5
- image: yandex/clickhouse-server:22.1
5
+ image: clickhouse/clickhouse-server:22.6
6
6
  ports:
7
7
  - "8123:8123"
8
8
  - "9000:9000"
@@ -5,17 +5,17 @@ module ClickHouse
5
5
  module ConnectionSelective
6
6
  # @return [ResultSet]
7
7
  def select_all(sql)
8
- response = get(body: Util::Statement.format(sql, 'JSON'))
8
+ response = get(body: sql, query: { default_format: 'JSON' })
9
9
  Response::Factory[response]
10
10
  end
11
11
 
12
12
  def select_value(sql)
13
- response = get(body: Util::Statement.format(sql, 'JSON'))
13
+ response = get(body: sql, query: { default_format: 'JSON' })
14
14
  Array(Response::Factory[response].first).dig(0, -1)
15
15
  end
16
16
 
17
17
  def select_one(sql)
18
- response = get(body: Util::Statement.format(sql, 'JSON'))
18
+ response = get(body: sql, query: { default_format: 'JSON' })
19
19
  Response::Factory[response].first
20
20
  end
21
21
  end
@@ -14,7 +14,8 @@ module ClickHouse
14
14
  meta: body.fetch('meta'),
15
15
  data: body.fetch('data'),
16
16
  totals: body['totals'],
17
- statistics: body['statistics']
17
+ statistics: body['statistics'],
18
+ rows_before_limit_at_least: body['rows_before_limit_at_least']
18
19
  )
19
20
  end
20
21
  end
@@ -14,7 +14,7 @@ module ClickHouse
14
14
  :inspect, :each, :fetch, :length, :count, :size,
15
15
  :first, :last, :[], :to_h
16
16
 
17
- attr_reader :meta, :data, :totals, :statistics
17
+ attr_reader :meta, :data, :totals, :statistics, :rows_before_limit_at_least
18
18
 
19
19
  class << self
20
20
  # @return [Array<String, Array>]
@@ -51,10 +51,11 @@ module ClickHouse
51
51
  # @param totals [Array|Hash|NilClass] Support for 'GROUP BY WITH TOTALS' modifier
52
52
  # https://clickhouse.tech/docs/en/sql-reference/statements/select/group-by/#with-totals-modifier
53
53
  # Hash in JSON format and Array in JSONCompact
54
- def initialize(meta:, data:, totals: nil, statistics: nil)
54
+ def initialize(meta:, data:, totals: nil, statistics: nil, rows_before_limit_at_least: nil)
55
55
  @meta = meta
56
56
  @data = data
57
57
  @totals = totals
58
+ @rows_before_limit_at_least = rows_before_limit_at_least
58
59
  @statistics = Hash(statistics)
59
60
  end
60
61
 
@@ -3,20 +3,11 @@
3
3
  module ClickHouse
4
4
  module Util
5
5
  module Statement
6
- END_OF_STATEMENT = ';'
7
- END_OF_STATEMENT_RE = /#{END_OF_STATEMENT}(\s+|\Z)/.freeze
8
-
9
6
  module_function
10
7
 
11
8
  def ensure(truthful, value, fallback = nil)
12
9
  truthful ? value : fallback
13
10
  end
14
-
15
- def format(sql, format)
16
- return sql if sql.match?(/FORMAT/i)
17
-
18
- "#{sql.sub(END_OF_STATEMENT_RE, '')} FORMAT #{format};"
19
- end
20
11
  end
21
12
  end
22
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClickHouse
4
- VERSION = '1.6.1'
4
+ VERSION = '1.6.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: click_house
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksandr Shylau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-03 00:00:00.000000000 Z
11
+ date: 2022-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday