click_house 1.2.5 → 1.2.6

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: 700d57a764315e709b8e78f10a5765801baa2b491aeb4aad6b6cc6c2016f8c74
4
- data.tar.gz: 34f61608fd6b67fed90f9ec1d84db1677abdeda86f3c8751fb124457f25274e4
3
+ metadata.gz: ae4929902ce5c3173cad7dfa301c592b585bc5c9799106f47968c7019272bced
4
+ data.tar.gz: 1cb5ddc0bfc8a9b99317a1a0dc6fffe483e4bf91c3f3da836969240a1201e9c6
5
5
  SHA512:
6
- metadata.gz: bff6c7f9bda496860ee38038bde526f706f7f6a1c1be8be0800806c70c24de15764d090e579c4dafe0bf3e86eca18acfce4a3c96542b5e89756182b8711f8aaf
7
- data.tar.gz: 5cd4d79cb422ea0feb9171b2e1ca5eb824d50fabdd718e2789c65e1ce75bcefedd60c479a0a46a9488a0c6ac8f352e25caa07e2c417c8ae79c351c2b121ffd3b
6
+ metadata.gz: 4ed6e536a2fbb0e7d762baf9b274151b90e6881e719ce6c98e026e78d8721dc70766b4e71626909dd9012f9649c2444cd9fedc78678d917c80dd38f0f822acc3
7
+ data.tar.gz: 78bad0a773e0903143f0f3bc2d532e9c070bdb623eff7231ab52679ca5052309c3ed8fedcd87172c7d5cf7abe7a750fbca4904ad0d50858b602ad06f8d7cc5a5
data/.rubocop.yml CHANGED
@@ -31,22 +31,22 @@ Metrics/AbcSize:
31
31
 
32
32
  # ============================== Naming =============================
33
33
  Naming/PredicateName:
34
- NamePrefixBlacklist:
34
+ ForbiddenPrefixes:
35
35
  - is_
36
36
  Naming/FileName:
37
37
  Enabled: true
38
38
  Exclude:
39
39
  - 'Gemfile'
40
- Naming/UncommunicativeMethodParamName:
40
+ Naming/MethodParameterName:
41
41
  Enabled: false
42
42
  Naming/AccessorMethodName:
43
43
  Enabled: false
44
44
 
45
45
  # ============================== Layout =============================
46
- Layout/AlignHash:
46
+ Layout/HashAlignment:
47
47
  EnforcedHashRocketStyle: key
48
48
  EnforcedColonStyle: key
49
- Layout/AlignParameters:
49
+ Layout/ParameterAlignment:
50
50
  EnforcedStyle: with_fixed_indentation
51
51
  Layout/CaseIndentation:
52
52
  EnforcedStyle: case
@@ -65,9 +65,9 @@ Layout/EmptyLinesAroundBlockBody:
65
65
  Enabled: true
66
66
  Layout/EndAlignment:
67
67
  EnforcedStyleAlignWith: variable
68
- Layout/IndentFirstHashElement:
68
+ Layout/FirstHashElementIndentation:
69
69
  EnforcedStyle: consistent
70
- Layout/IndentHeredoc:
70
+ Layout/HeredocIndentation:
71
71
  Enabled: false
72
72
  Layout/RescueEnsureAlignment:
73
73
  Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ # 1.2.6
2
+ * Datetime64 field type support [#3](https://github.com/shlima/click_house/pull/3)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house (1.2.5)
4
+ click_house (1.2.6)
5
5
  faraday
6
6
  faraday_middleware
7
7
 
@@ -11,45 +11,47 @@ GEM
11
11
  ast (2.4.0)
12
12
  coderay (1.1.2)
13
13
  diff-lcs (1.3)
14
- faraday (0.17.0)
14
+ faraday (0.17.3)
15
15
  multipart-post (>= 1.2, < 3)
16
- faraday_middleware (0.13.1)
16
+ faraday_middleware (0.14.0)
17
17
  faraday (>= 0.7.4, < 1.0)
18
18
  jaro_winkler (1.5.4)
19
- method_source (0.9.2)
19
+ method_source (1.0.0)
20
20
  multipart-post (2.1.1)
21
- parallel (1.18.0)
22
- parser (2.6.5.0)
21
+ parallel (1.19.1)
22
+ parser (2.7.0.5)
23
23
  ast (~> 2.4.0)
24
- pry (0.12.2)
25
- coderay (~> 1.1.0)
26
- method_source (~> 0.9.0)
24
+ pry (0.13.0)
25
+ coderay (~> 1.1)
26
+ method_source (~> 1.0)
27
27
  rainbow (3.0.0)
28
- rake (13.0.0)
28
+ rake (13.0.1)
29
+ rexml (3.2.4)
29
30
  rspec (3.9.0)
30
31
  rspec-core (~> 3.9.0)
31
32
  rspec-expectations (~> 3.9.0)
32
33
  rspec-mocks (~> 3.9.0)
33
- rspec-core (3.9.0)
34
- rspec-support (~> 3.9.0)
35
- rspec-expectations (3.9.0)
34
+ rspec-core (3.9.1)
35
+ rspec-support (~> 3.9.1)
36
+ rspec-expectations (3.9.1)
36
37
  diff-lcs (>= 1.2.0, < 2.0)
37
38
  rspec-support (~> 3.9.0)
38
- rspec-mocks (3.9.0)
39
+ rspec-mocks (3.9.1)
39
40
  diff-lcs (>= 1.2.0, < 2.0)
40
41
  rspec-support (~> 3.9.0)
41
- rspec-support (3.9.0)
42
- rubocop (0.76.0)
42
+ rspec-support (3.9.2)
43
+ rubocop (0.80.1)
43
44
  jaro_winkler (~> 1.5.1)
44
45
  parallel (~> 1.10)
45
- parser (>= 2.6)
46
+ parser (>= 2.7.0.1)
46
47
  rainbow (>= 2.2.2, < 4.0)
48
+ rexml
47
49
  ruby-progressbar (~> 1.7)
48
50
  unicode-display_width (>= 1.4.0, < 1.7)
49
- rubocop-performance (1.5.0)
51
+ rubocop-performance (1.5.2)
50
52
  rubocop (>= 0.71.0)
51
53
  ruby-progressbar (1.10.1)
52
- unicode-display_width (1.6.0)
54
+ unicode-display_width (1.6.1)
53
55
 
54
56
  PLATFORMS
55
57
  ruby
data/lib/click_house.rb CHANGED
@@ -41,6 +41,11 @@ module ClickHouse
41
41
  add_type "Nullable(#{column})", Type::NullableType.new(Type::DateTimeType.new)
42
42
  end
43
43
 
44
+ ['DateTime64(%d, %s)'].each do |column|
45
+ add_type column, Type::DateTime64Type.new
46
+ add_type "Nullable(#{column})", Type::NullableType.new(Type::DateTime64Type.new)
47
+ end
48
+
44
49
  ['Decimal(%s, %s)', 'Decimal32(%s)', 'Decimal64(%s)', 'Decimal128(%s)'].each do |column|
45
50
  add_type column, Type::DecimalType.new
46
51
  add_type "Nullable(#{column})", Type::NullableType.new(Type::DecimalType.new)
@@ -11,7 +11,7 @@ module ClickHouse
11
11
  'FixedString(%d)',
12
12
  'UUID',
13
13
  'Date',
14
- "DateTime('%s')"
14
+ "DateTime('%s')", "DateTime64(%d, '%s')"
15
15
  ].freeze
16
16
 
17
17
  class << self
@@ -26,7 +26,7 @@ module ClickHouse
26
26
  logger.level == Logger::DEBUG
27
27
  end
28
28
 
29
- # rubocop:disable Metrics/LineLength
29
+ # rubocop:disable Layout/LineLength
30
30
  def on_complete(env)
31
31
  summary = extract_summary(env.response_headers)
32
32
  elapsed = duration
@@ -36,7 +36,7 @@ module ClickHouse
36
36
  logger.debug(body) if body
37
37
  logger.info("\e[1mRead: #{summary.fetch(:read_rows)} rows, #{summary.fetch(:read_bytes)}. Written: #{summary.fetch(:written_rows)}, rows #{summary.fetch(:written_bytes)}\e[0m")
38
38
  end
39
- # rubocop:enable Metrics/LineLength
39
+ # rubocop:enable Layout/LineLength
40
40
 
41
41
  def duration
42
42
  timestamp - starting
@@ -7,6 +7,7 @@ module ClickHouse
7
7
  autoload :UndefinedType, 'click_house/type/undefined_type'
8
8
  autoload :DateType, 'click_house/type/date_type'
9
9
  autoload :DateTimeType, 'click_house/type/date_time_type'
10
+ autoload :DateTime64Type, 'click_house/type/date_time64_type'
10
11
  autoload :IntegerType, 'click_house/type/integer_type'
11
12
  autoload :FloatType, 'click_house/type/float_type'
12
13
  autoload :BooleanType, 'click_house/type/boolean_type'
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ClickHouse
4
+ module Type
5
+ class DateTime64Type < BaseType
6
+ def cast(value, _precision = nil, tz = nil)
7
+ DateTime.parse("#{value} #{tz}")
8
+ end
9
+
10
+ def serialize(value, precision = 3)
11
+ value.strftime("%Y-%m-%d %H:%M:%S.%#{precision}N")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClickHouse
4
- VERSION = '1.2.5'
4
+ VERSION = '1.2.6'
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.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksandr Shylau
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-12 00:00:00.000000000 Z
11
+ date: 2020-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -133,6 +133,7 @@ files:
133
133
  - ".rspec"
134
134
  - ".rubocop.yml"
135
135
  - ".travis.yml"
136
+ - CHANGELOG.md
136
137
  - Gemfile
137
138
  - Gemfile.lock
138
139
  - LICENCE.txt
@@ -173,6 +174,7 @@ files:
173
174
  - lib/click_house/type/array_type.rb
174
175
  - lib/click_house/type/base_type.rb
175
176
  - lib/click_house/type/boolean_type.rb
177
+ - lib/click_house/type/date_time64_type.rb
176
178
  - lib/click_house/type/date_time_type.rb
177
179
  - lib/click_house/type/date_type.rb
178
180
  - lib/click_house/type/decimal_type.rb