click_house-client 0.5.0 → 0.5.1

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: 4fb73c384094387fbb53365e18a5378aca87148e07e501b25e03f9371cead01e
4
- data.tar.gz: f5a179a229a5c9fe115ce03d84d22d14b01c56dfa99694cea5f75d9f9c034f37
3
+ metadata.gz: 55b79507a43d0c64c35ed2a024c4314e6d8d1f4daf227aee3db84947d34e2a2a
4
+ data.tar.gz: 6673504ba4ffe2b790064529600e3e66e5e7c4d687cc82f15fb9237cd5661c94
5
5
  SHA512:
6
- metadata.gz: 1b3055e3104e139834ac5e3538ac3d0e402c16b8f1456861ed0bca269c03870038c9aadc97ebb1c74e1486a273c6a44867f20a07f423075ab8e8b90f972c2acd
7
- data.tar.gz: 9f1e7160de8c0d4ead180e10dfc40b36db5e155d08a1d7d2c62c6225636dc72751c7b1ee68d583ff8653409b8fdddb8e9ce0cd2ff920bd38995e5eab8408e04e
6
+ metadata.gz: 41b0de769672003cd9ab1e8d755419191ba53f47786f555f12c018c8a41cc101f0196f48ea7f2f7ad1f0f0390eb1be04e14bb7d0c0f5d351b8b712b1b7dcfae3
7
+ data.tar.gz: 3cd5e7948eb80aedf7f75b4470d067b4ef7e1a70b987b349786700d5aa07b981439d8baa75fc399def7a4f2ed80e8ba47f0c8779cf12fc06771626e2f0ebc605
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house-client (0.5.0)
4
+ click_house-client (0.5.1)
5
5
  activerecord (>= 7.0, < 9.0)
6
6
  activesupport (>= 7.0, < 9.0)
7
7
  addressable (~> 2.8)
@@ -136,7 +136,7 @@ CHECKSUMS
136
136
  benchmark (0.4.1) sha256=d4ef40037bba27f03b28013e219b950b82bace296549ec15a78016552f8d2cce
137
137
  bigdecimal (3.2.2) sha256=39085f76b495eb39a79ce07af716f3a6829bc35eb44f2195e2753749f2fa5adc
138
138
  byebug (12.0.0) sha256=d4a150d291cca40b66ec9ca31f754e93fed8aa266a17335f71bb0afa7fca1a1e
139
- click_house-client (0.5.0)
139
+ click_house-client (0.5.1)
140
140
  concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6
141
141
  connection_pool (2.5.3) sha256=cfd74a82b9b094d1ce30c4f1a346da23ee19dc8a062a16a85f58eab1ced4305b
142
142
  diff-lcs (1.5.0) sha256=49b934001c8c6aedb37ba19daec5c634da27b318a7a3c654ae979d6ba1929b67
data/README.md CHANGED
@@ -22,10 +22,13 @@ ClickHouse::Client.configure do |config|
22
22
 
23
23
  # Use any HTTP client to build the POST request, here we use Net::HTTP
24
24
  config.http_post_proc = ->(url, headers, body) do
25
- # Query placeholders go to the URI
26
- params = URI.encode_www_form(body.except("query"))
25
+ uri = URI.parse(url)
26
+
27
+ unless body.is_a?(IO)
28
+ # Append placeholders to URI's query
29
+ uri.query = [uri.query, URI.encode_www_form(body.except("query"))].compact.join('&')
30
+ end
27
31
 
28
- uri = URI.parse("#{url}&#{params}")
29
32
  request = Net::HTTP::Post.new(uri)
30
33
 
31
34
  headers.each do |header, value|
@@ -33,9 +36,14 @@ ClickHouse::Client.configure do |config|
33
36
  end
34
37
 
35
38
  request['Content-type'] = 'application/x-www-form-urlencoded'
36
- request.body = body["query"]
37
39
 
38
- response = Net::HTTP.start(uri.hostname, uri.port) do |http|
40
+ if body.is_a?(IO)
41
+ request.body_stream = body
42
+ else
43
+ request.body = body['query']
44
+ end
45
+
46
+ response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
39
47
  http.request(request)
40
48
  end
41
49
 
@@ -6,6 +6,9 @@ module ClickHouse
6
6
  DEFAULT = ->(value) { value }
7
7
 
8
8
  BASIC_TYPE_CASTERS = {
9
+ 'Int32' => ->(value) { Integer(value) },
10
+ 'UInt32' => ->(value) { Integer(value) },
11
+ 'Int64' => ->(value) { Integer(value) },
9
12
  'UInt64' => ->(value) { Integer(value) },
10
13
  "DateTime64(6, 'UTC')" => ->(value) { ActiveSupport::TimeZone['UTC'].parse(value) },
11
14
  "IntervalSecond" => ->(value) { ActiveSupport::Duration.build(value.to_i) },
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ClickHouse
4
4
  module Client
5
- VERSION = "0.5.0"
5
+ VERSION = "0.5.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: click_house-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - group::optimize
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-22 00:00:00.000000000 Z
11
+ date: 2025-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord