click_house 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -9
- data/lib/click_house/config.rb +3 -1
- data/lib/click_house/connection.rb +2 -0
- data/lib/click_house/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1374424a3c271d0414b1d40088dfa532337f1047606b55bf4f1a4f0c2e22f140
|
4
|
+
data.tar.gz: 53200789244d3e83c0bd2b9de660db0d82d8f8d9af83dd44a5813d4d5cbbfd39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 482c77bda957329e1187bd009567eb216547028ad0810ced5a3ee58474ac273cb11e4b271f2107edae78e44bc855cc0c3130b848c028ebc84422a517d3e1bfdf
|
7
|
+
data.tar.gz: 82bdf1a4f88537652bcc7f0827fa3e89ff609c24e1631bd3f131080295b4b184164975b439244e1cdb15c89fcf294f3f8482032f00b93db83b60c1cb51804403
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -53,6 +53,7 @@ ClickHouse.config do |config|
|
|
53
53
|
config.timeout = 60
|
54
54
|
config.open_timeout = 3
|
55
55
|
config.ssl_verify = false
|
56
|
+
config.headers = {}
|
56
57
|
|
57
58
|
# or provide connection options separately
|
58
59
|
config.scheme = 'http'
|
@@ -216,7 +217,8 @@ ClickHouse.connection.create_table('visits', if_not_exists: true, engine: 'Merge
|
|
216
217
|
t.Decimal :money, 5, 4
|
217
218
|
t.String :event
|
218
219
|
t.UInt32 :user_id
|
219
|
-
t.
|
220
|
+
t.IPv4 :ipv4
|
221
|
+
t.IPv6 :ipv6
|
220
222
|
end
|
221
223
|
```
|
222
224
|
|
@@ -328,11 +330,11 @@ ClickHouse.add_type('Date', DateType.new)
|
|
328
330
|
Actually `serialize` function is not used for now, but you may use it manually:
|
329
331
|
|
330
332
|
```ruby
|
331
|
-
time_type = DateTimeType.new
|
332
|
-
string_type = FixedStringType.new
|
333
|
+
time_type = ClickHouse::Type::DateTimeType.new
|
334
|
+
string_type = ClickHouse::Type::FixedStringType.new
|
333
335
|
|
334
336
|
ClickHouse.connection.insert('table', columns: %i[name time]) do |buffer|
|
335
|
-
buffer << [string_type.serialize('a' * 1000, 20),
|
337
|
+
buffer << [string_type.serialize('a' * 1000, 20), time_type.serialize(Time.current, 'Europe/Moscow')]
|
336
338
|
end
|
337
339
|
|
338
340
|
## alternatively
|
@@ -448,11 +450,6 @@ class CreateAdvertVisits < ActiveRecord::Migration[6.0]
|
|
448
450
|
t.UInt16 :account_id
|
449
451
|
t.UInt16 :user_id
|
450
452
|
t.Date :date
|
451
|
-
t.DateTime :time, 'UTC'
|
452
|
-
t.IPv4 :ipv4
|
453
|
-
t.IPv6 :ipv6
|
454
|
-
t.UInt32 :device_type_id
|
455
|
-
t.UInt32 :os_family_id
|
456
453
|
end
|
457
454
|
end
|
458
455
|
|
data/lib/click_house/config.rb
CHANGED
@@ -18,7 +18,8 @@ module ClickHouse
|
|
18
18
|
password: nil,
|
19
19
|
timeout: nil,
|
20
20
|
open_timeout: nil,
|
21
|
-
ssl_verify: false
|
21
|
+
ssl_verify: false,
|
22
|
+
headers: {}
|
22
23
|
}.freeze
|
23
24
|
|
24
25
|
attr_accessor :adapter
|
@@ -33,6 +34,7 @@ module ClickHouse
|
|
33
34
|
attr_accessor :timeout
|
34
35
|
attr_accessor :open_timeout
|
35
36
|
attr_accessor :ssl_verify
|
37
|
+
attr_accessor :headers
|
36
38
|
|
37
39
|
def initialize(params = {})
|
38
40
|
assign(DEFAULTS.merge(params))
|
@@ -11,6 +11,7 @@ module ClickHouse
|
|
11
11
|
|
12
12
|
attr_reader :config
|
13
13
|
|
14
|
+
# @param [Config]
|
14
15
|
def initialize(config)
|
15
16
|
@config = config
|
16
17
|
end
|
@@ -31,6 +32,7 @@ module ClickHouse
|
|
31
32
|
@transport ||= Faraday.new(config.url!) do |conn|
|
32
33
|
conn.options.timeout = config.timeout
|
33
34
|
conn.options.open_timeout = config.open_timeout
|
35
|
+
conn.headers = config.headers
|
34
36
|
conn.ssl.verify = config.ssl_verify
|
35
37
|
conn.basic_auth(config.username, config.password) if config.auth?
|
36
38
|
conn.response Middleware::Logging, logger: config.logger!
|
data/lib/click_house/version.rb
CHANGED
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aliaksandr Shylau
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|