click_house 1.6.2 → 2.0.0

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +16 -5
  3. data/.rubocop.yml +77 -1
  4. data/CHANGELOG.md +15 -0
  5. data/Gemfile.lock +41 -48
  6. data/Gemfile_faraday1 +11 -0
  7. data/Gemfile_faraday1.lock +111 -0
  8. data/Gemfile_faraday2 +1 -0
  9. data/Gemfile_faraday2.lock +88 -0
  10. data/Makefile +25 -0
  11. data/README.md +6 -20
  12. data/click_house.gemspec +4 -3
  13. data/docker-compose.yml +1 -1
  14. data/lib/click_house/ast/parser.rb +53 -0
  15. data/lib/click_house/ast/statement.rb +99 -0
  16. data/lib/click_house/ast/ticker.rb +42 -0
  17. data/lib/click_house/ast.rb +9 -0
  18. data/lib/click_house/config.rb +17 -1
  19. data/lib/click_house/connection.rb +3 -2
  20. data/lib/click_house/definition/column.rb +6 -3
  21. data/lib/click_house/definition/column_set.rb +3 -2
  22. data/lib/click_house/extend/configurable.rb +2 -0
  23. data/lib/click_house/extend/connection_inserting.rb +3 -3
  24. data/lib/click_house/extend/type_definition.rb +1 -10
  25. data/lib/click_house/middleware/logging.rb +1 -1
  26. data/lib/click_house/middleware/parse_csv.rb +5 -6
  27. data/lib/click_house/middleware/parse_json.rb +16 -0
  28. data/lib/click_house/middleware/parse_json_oj.rb +22 -0
  29. data/lib/click_house/middleware/raise_error.rb +8 -8
  30. data/lib/click_house/middleware/response_base.rb +45 -0
  31. data/lib/click_house/middleware.rb +3 -0
  32. data/lib/click_house/response/result_set.rb +58 -40
  33. data/lib/click_house/response.rb +1 -0
  34. data/lib/click_house/type/array_type.rb +6 -12
  35. data/lib/click_house/type/base_type.rb +25 -1
  36. data/lib/click_house/type/date_time64_type.rb +5 -1
  37. data/lib/click_house/type/date_time_type.rb +5 -1
  38. data/lib/click_house/type/decimal_type.rb +15 -1
  39. data/lib/click_house/type/low_cardinality_type.rb +15 -0
  40. data/lib/click_house/type/map_type.rb +15 -0
  41. data/lib/click_house/type/nullable_type.rb +6 -8
  42. data/lib/click_house/type/string_type.rb +1 -1
  43. data/lib/click_house/type/tuple_type.rb +15 -0
  44. data/lib/click_house/type.rb +3 -0
  45. data/lib/click_house/version.rb +1 -1
  46. data/lib/click_house.rb +10 -3
  47. metadata +38 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a24e10e60cd19671f70f521f6db773ef0d3b0f6f33a9ef40b5a26ed7aaf8106
4
- data.tar.gz: 3a948f7381d345f6784a8a125bedbc62ba9df554920cc40eb217699c350cfc02
3
+ metadata.gz: 87293ae8c38bd7182d525925ca9c36c4660c004465d0d7b4ce9f27f166ef6c6d
4
+ data.tar.gz: 93bb17fe88aae7e0dae175a4b03dced840a6e8d57b507d78f91833e470cd8cbf
5
5
  SHA512:
6
- metadata.gz: 12af01d64fb80f0fbfff2df8654c79b6574bd09b6159bac8ae9425417a5fc48fbf7ae8bcf2b0e42efc80bd23bc55212f5ba232f187e606b76fb8d6f7193a6976
7
- data.tar.gz: 2d819029b2030f25b68a85f623dcbbec497aa9756d6b69d2e223eccdc97ba35ef58299ceea47f45de568cfdd161f09ca75e1635f9bc3176e94de337ae88e4a59
6
+ metadata.gz: e7309f25dddb0c7f6e6c032098b6b47b324cbc8c731ff15958bf38f835e3dcacc222cb2f7e7c59a1aeec32b952afb4916e23cacdaf323a624d0c4a6e07e7a114
7
+ data.tar.gz: dbe36582b28d40ab85bf02067495296609b27600fa4ff3b1b0d7e81bb3890af512ffb4a5a7d045f7b155753c75e31c0353801fbc256767d2a594743a63090aae
@@ -8,13 +8,13 @@ jobs:
8
8
 
9
9
  services:
10
10
  clickhouse:
11
- image: clickhouse/clickhouse-server:22.6
11
+ image: clickhouse/clickhouse-server:22.9
12
12
  ports:
13
13
  - 8123:8123
14
14
 
15
15
  strategy:
16
16
  matrix:
17
- ruby-version: [3.1, '3.0', 2.7, 2.6]
17
+ ruby-version: [3.1, '3.0', 2.7]
18
18
 
19
19
  steps:
20
20
  - uses: actions/checkout@v2
@@ -23,10 +23,21 @@ jobs:
23
23
  uses: ruby/setup-ruby@v1
24
24
  with:
25
25
  ruby-version: ${{ matrix.ruby-version }}
26
- bundler-cache: true # 'bundle install' and cache
27
26
 
28
- - name: Run tests
29
- run: bundle exec rspec
27
+ - name: Setup v1
28
+ run: make faraday1 bundle
29
+
30
+ - name: Setup v2
31
+ run: make faraday2 bundle
32
+
33
+ - name: Run tests with faraday v.1 JSON
34
+ run: make faraday1 rspec
35
+ - name: Run tests with faraday v.2 JSON
36
+ run: make faraday2 rspec
37
+ - name: Run tests with faraday v.1 OJ
38
+ run: make faraday1 oj rspec
39
+ - name: Run tests with faraday v.2 OJ
40
+ run: make faraday2 oj rspec
30
41
 
31
42
  rubocop:
32
43
  runs-on: ubuntu-latest
data/.rubocop.yml CHANGED
@@ -14,7 +14,9 @@ Bundler/OrderedGems:
14
14
  Enabled: false
15
15
 
16
16
  # ============================== Gemspec ======================
17
- Gemspec/DateAssignment:
17
+ Gemspec/DeprecatedAttributeAssignment:
18
+ Enabled: true
19
+ Gemspec/RequireMFA: # new in 1.23
18
20
  Enabled: true
19
21
 
20
22
  # =============================== Performance =======================
@@ -52,6 +54,10 @@ Performance/RedundantSplitRegexpArgument:
52
54
  Enabled: true
53
55
  Performance/MapCompact:
54
56
  Enabled: true
57
+ Performance/ConcurrentMonotonicTime: # new in 1.12
58
+ Enabled: true
59
+ Performance/StringIdentifierArgument: # new in 1.13
60
+ Enabled: true
55
61
 
56
62
  # ============================== Metrics ============================
57
63
  Metrics/ClassLength:
@@ -77,6 +83,8 @@ Naming/AccessorMethodName:
77
83
  Enabled: false
78
84
  Naming/InclusiveLanguage:
79
85
  Enabled: true
86
+ Naming/BlockForwarding: # new in 1.24
87
+ Enabled: true
80
88
 
81
89
  # ============================== Layout =============================
82
90
  Layout/LineLength:
@@ -117,6 +125,10 @@ Layout/SpaceBeforeBrackets:
117
125
  Enabled: true
118
126
  Layout/LineEndStringConcatenationIndentation:
119
127
  Enabled: true
128
+ Layout/LineContinuationLeadingSpace: # new in 1.31
129
+ Enabled: true
130
+ Layout/LineContinuationSpacing: # new in 1.31
131
+ Enabled: true
120
132
 
121
133
  # ============================== Style ==============================
122
134
  Style/RescueModifier:
@@ -247,6 +259,50 @@ Style/QuotedSymbols:
247
259
  Enabled: true
248
260
  Style/StringChars:
249
261
  Enabled: true
262
+ Style/EmptyHeredoc: # new in 1.32
263
+ Enabled: true
264
+ Style/EnvHome: # new in 1.29
265
+ Enabled: true
266
+ Style/FetchEnvVar: # new in 1.28
267
+ Enabled: true
268
+ Style/FileRead: # new in 1.24
269
+ Enabled: true
270
+ Style/FileWrite: # new in 1.24
271
+ Enabled: true
272
+ Style/MagicCommentFormat: # new in 1.35
273
+ Enabled: true
274
+ Style/MapCompactWithConditionalBlock: # new in 1.30
275
+ Enabled: true
276
+ Style/MapToHash: # new in 1.24
277
+ Enabled: true
278
+ Style/NestedFileDirname: # new in 1.26
279
+ Enabled: true
280
+ Style/NumberedParameters: # new in 1.22
281
+ Enabled: true
282
+ Style/NumberedParametersLimit: # new in 1.22
283
+ Enabled: true
284
+ Style/ObjectThen: # new in 1.28
285
+ Enabled: true
286
+ Style/OpenStructUse: # new in 1.23
287
+ Enabled: true
288
+ Style/OperatorMethodCall: # new in 1.37
289
+ Enabled: true
290
+ Style/RedundantEach: # new in 1.38
291
+ Enabled: true
292
+ Style/RedundantInitialize: # new in 1.27
293
+ Enabled: true
294
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
295
+ Enabled: true
296
+ Style/RedundantStringEscape: # new in 1.37
297
+ Enabled: true
298
+ Style/SelectByRegexp: # new in 1.22
299
+ Enabled: true
300
+
301
+ # ============================== Security ==============================
302
+ Security/CompoundHash: # new in 1.28
303
+ Enabled: true
304
+ Security/IoMethods: # new in 1.22
305
+ Enabled: true
250
306
 
251
307
  # ============================== Lint ==============================
252
308
  Lint/DuplicateMethods:
@@ -335,3 +391,23 @@ Lint/AmbiguousAssignment:
335
391
  Enabled: true
336
392
  Lint/EmptyInPattern:
337
393
  Enabled: true
394
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
395
+ Enabled: true
396
+ Lint/AmbiguousRange: # new in 1.19
397
+ Enabled: true
398
+ Lint/ConstantOverwrittenInRescue: # new in 1.31
399
+ Enabled: true
400
+ Lint/DuplicateMagicComment: # new in 1.37
401
+ Enabled: true
402
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
403
+ Enabled: true
404
+ Lint/NonAtomicFileOperation: # new in 1.31
405
+ Enabled: true
406
+ Lint/RefinementImportMethods: # new in 1.27
407
+ Enabled: true
408
+ Lint/RequireRangeParentheses: # new in 1.32
409
+ Enabled: true
410
+ Lint/RequireRelativeSelfPath: # new in 1.22
411
+ Enabled: true
412
+ Lint/UselessRuby2Keywords: # new in 1.23
413
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # 2.0.0
2
+ * Fixed `Bigdecimal` casting with high precision
3
+ * Added nested `type casting like Array(Array(Array(Nullable(T))))`
4
+ * Added `Map(T1, T2)` support
5
+ * Added `Tuple(T1, T2)` support
6
+ * Added support for `Faraday` v1 and v2
7
+ * Added support for `Oj` parser
8
+
9
+ # 1.6.3
10
+ * [PR](https://github.com/shlima/click_house/pull/38) Add option format for insert
11
+ * [PR](https://github.com/shlima/click_house/pull/34) Support X-ClickHouse-Exception-Code header
12
+ * [ISSUE](https://github.com/shlima/click_house/issues/33) Fix parameterized types parsing
13
+ * Added LowCardinality DDL support
14
+ * Fixed body logging with POST queries
15
+
1
16
  # 1.6.2
2
17
  * [PR](https://github.com/shlima/click_house/pull/31) Add rows_before_limit_at_least to ResultSet
3
18
  * [PR](https://github.com/shlima/click_house/pull/29) Force JSON format by using "default_format" instead of modifying the query
data/Gemfile.lock CHANGED
@@ -1,83 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house (1.6.2)
5
- faraday (>= 1.7)
6
- faraday_middleware
4
+ click_house (2.0.0)
5
+ activesupport
6
+ faraday (>= 1.7, < 3)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ activesupport (7.0.4)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
11
16
  ast (2.4.2)
12
17
  coderay (1.1.3)
18
+ concurrent-ruby (1.1.10)
13
19
  diff-lcs (1.5.0)
14
- faraday (1.10.0)
15
- faraday-em_http (~> 1.0)
16
- faraday-em_synchrony (~> 1.0)
17
- faraday-excon (~> 1.1)
18
- faraday-httpclient (~> 1.0)
19
- faraday-multipart (~> 1.0)
20
- faraday-net_http (~> 1.0)
21
- faraday-net_http_persistent (~> 1.0)
22
- faraday-patron (~> 1.0)
23
- faraday-rack (~> 1.0)
24
- faraday-retry (~> 1.0)
20
+ faraday (2.7.1)
21
+ faraday-net_http (>= 2.0, < 3.1)
25
22
  ruby2_keywords (>= 0.0.4)
26
- faraday-em_http (1.0.0)
27
- faraday-em_synchrony (1.0.0)
28
- faraday-excon (1.1.0)
29
- faraday-httpclient (1.0.1)
30
- faraday-multipart (1.0.4)
31
- multipart-post (~> 2)
32
- faraday-net_http (1.0.1)
33
- faraday-net_http_persistent (1.2.0)
34
- faraday-patron (1.0.0)
35
- faraday-rack (1.0.0)
36
- faraday-retry (1.0.3)
37
- faraday_middleware (1.2.0)
38
- faraday (~> 1.0)
23
+ faraday-net_http (3.0.2)
24
+ i18n (1.12.0)
25
+ concurrent-ruby (~> 1.0)
26
+ json (2.6.2)
39
27
  method_source (1.0.0)
40
- multipart-post (2.2.3)
28
+ minitest (5.16.3)
29
+ oj (3.13.23)
41
30
  parallel (1.22.1)
42
- parser (3.1.1.0)
31
+ parser (3.1.2.1)
43
32
  ast (~> 2.4.1)
44
33
  pry (0.14.1)
45
34
  coderay (~> 1.1)
46
35
  method_source (~> 1.0)
47
36
  rainbow (3.1.1)
48
37
  rake (13.0.6)
49
- regexp_parser (2.2.1)
38
+ regexp_parser (2.6.1)
50
39
  rexml (3.2.5)
51
- rspec (3.11.0)
52
- rspec-core (~> 3.11.0)
53
- rspec-expectations (~> 3.11.0)
54
- rspec-mocks (~> 3.11.0)
55
- rspec-core (3.11.0)
56
- rspec-support (~> 3.11.0)
57
- rspec-expectations (3.11.0)
40
+ rspec (3.12.0)
41
+ rspec-core (~> 3.12.0)
42
+ rspec-expectations (~> 3.12.0)
43
+ rspec-mocks (~> 3.12.0)
44
+ rspec-core (3.12.0)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-expectations (3.12.0)
58
47
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.11.0)
60
- rspec-mocks (3.11.1)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-mocks (3.12.0)
61
50
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.11.0)
63
- rspec-support (3.11.0)
64
- rubocop (1.26.1)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-support (3.12.0)
53
+ rubocop (1.39.0)
54
+ json (~> 2.3)
65
55
  parallel (~> 1.10)
66
- parser (>= 3.1.0.0)
56
+ parser (>= 3.1.2.1)
67
57
  rainbow (>= 2.2.2, < 4.0)
68
58
  regexp_parser (>= 1.8, < 3.0)
69
- rexml
70
- rubocop-ast (>= 1.16.0, < 2.0)
59
+ rexml (>= 3.2.5, < 4.0)
60
+ rubocop-ast (>= 1.23.0, < 2.0)
71
61
  ruby-progressbar (~> 1.7)
72
62
  unicode-display_width (>= 1.4.0, < 3.0)
73
- rubocop-ast (1.16.0)
63
+ rubocop-ast (1.23.0)
74
64
  parser (>= 3.1.1.0)
75
- rubocop-performance (1.13.3)
65
+ rubocop-performance (1.15.1)
76
66
  rubocop (>= 1.7.0, < 2.0)
77
67
  rubocop-ast (>= 0.4.0)
78
68
  ruby-progressbar (1.11.0)
79
69
  ruby2_keywords (0.0.5)
80
- unicode-display_width (2.1.0)
70
+ tzinfo (2.0.5)
71
+ concurrent-ruby (~> 1.0)
72
+ unicode-display_width (2.3.0)
81
73
 
82
74
  PLATFORMS
83
75
  ruby
@@ -85,6 +77,7 @@ PLATFORMS
85
77
  DEPENDENCIES
86
78
  bundler
87
79
  click_house!
80
+ oj
88
81
  pry
89
82
  rake
90
83
  rspec
data/Gemfile_faraday1 ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # lock faraday to v1
8
+ gem 'faraday_middleware'
9
+
10
+ # Specify your gem's dependencies in click_house.gemspec
11
+ gemspec
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ click_house (1.7.0)
5
+ activesupport
6
+ faraday (>= 1.7, < 3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (7.0.4)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ ast (2.4.2)
17
+ coderay (1.1.3)
18
+ concurrent-ruby (1.1.10)
19
+ diff-lcs (1.5.0)
20
+ faraday (1.10.2)
21
+ faraday-em_http (~> 1.0)
22
+ faraday-em_synchrony (~> 1.0)
23
+ faraday-excon (~> 1.1)
24
+ faraday-httpclient (~> 1.0)
25
+ faraday-multipart (~> 1.0)
26
+ faraday-net_http (~> 1.0)
27
+ faraday-net_http_persistent (~> 1.0)
28
+ faraday-patron (~> 1.0)
29
+ faraday-rack (~> 1.0)
30
+ faraday-retry (~> 1.0)
31
+ ruby2_keywords (>= 0.0.4)
32
+ faraday-em_http (1.0.0)
33
+ faraday-em_synchrony (1.0.0)
34
+ faraday-excon (1.1.0)
35
+ faraday-httpclient (1.0.1)
36
+ faraday-multipart (1.0.4)
37
+ multipart-post (~> 2)
38
+ faraday-net_http (1.0.1)
39
+ faraday-net_http_persistent (1.2.0)
40
+ faraday-patron (1.0.0)
41
+ faraday-rack (1.0.0)
42
+ faraday-retry (1.0.3)
43
+ faraday_middleware (1.2.0)
44
+ faraday (~> 1.0)
45
+ i18n (1.12.0)
46
+ concurrent-ruby (~> 1.0)
47
+ json (2.6.2)
48
+ method_source (1.0.0)
49
+ minitest (5.16.3)
50
+ multipart-post (2.2.3)
51
+ oj (3.13.23)
52
+ parallel (1.22.1)
53
+ parser (3.1.2.1)
54
+ ast (~> 2.4.1)
55
+ pry (0.14.1)
56
+ coderay (~> 1.1)
57
+ method_source (~> 1.0)
58
+ rainbow (3.1.1)
59
+ rake (13.0.6)
60
+ regexp_parser (2.6.1)
61
+ rexml (3.2.5)
62
+ rspec (3.12.0)
63
+ rspec-core (~> 3.12.0)
64
+ rspec-expectations (~> 3.12.0)
65
+ rspec-mocks (~> 3.12.0)
66
+ rspec-core (3.12.0)
67
+ rspec-support (~> 3.12.0)
68
+ rspec-expectations (3.12.0)
69
+ diff-lcs (>= 1.2.0, < 2.0)
70
+ rspec-support (~> 3.12.0)
71
+ rspec-mocks (3.12.0)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.12.0)
74
+ rspec-support (3.12.0)
75
+ rubocop (1.39.0)
76
+ json (~> 2.3)
77
+ parallel (~> 1.10)
78
+ parser (>= 3.1.2.1)
79
+ rainbow (>= 2.2.2, < 4.0)
80
+ regexp_parser (>= 1.8, < 3.0)
81
+ rexml (>= 3.2.5, < 4.0)
82
+ rubocop-ast (>= 1.23.0, < 2.0)
83
+ ruby-progressbar (~> 1.7)
84
+ unicode-display_width (>= 1.4.0, < 3.0)
85
+ rubocop-ast (1.23.0)
86
+ parser (>= 3.1.1.0)
87
+ rubocop-performance (1.15.1)
88
+ rubocop (>= 1.7.0, < 2.0)
89
+ rubocop-ast (>= 0.4.0)
90
+ ruby-progressbar (1.11.0)
91
+ ruby2_keywords (0.0.5)
92
+ tzinfo (2.0.5)
93
+ concurrent-ruby (~> 1.0)
94
+ unicode-display_width (2.3.0)
95
+
96
+ PLATFORMS
97
+ x86_64-darwin-21
98
+
99
+ DEPENDENCIES
100
+ bundler
101
+ click_house!
102
+ faraday_middleware
103
+ oj
104
+ pry
105
+ rake
106
+ rspec
107
+ rubocop
108
+ rubocop-performance
109
+
110
+ BUNDLED WITH
111
+ 2.3.7
data/Gemfile_faraday2 ADDED
@@ -0,0 +1 @@
1
+ Gemfile
@@ -0,0 +1,88 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ click_house (1.7.0)
5
+ activesupport
6
+ faraday (>= 1.7, < 3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (7.0.4)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ ast (2.4.2)
17
+ coderay (1.1.3)
18
+ concurrent-ruby (1.1.10)
19
+ diff-lcs (1.5.0)
20
+ faraday (2.7.1)
21
+ faraday-net_http (>= 2.0, < 3.1)
22
+ ruby2_keywords (>= 0.0.4)
23
+ faraday-net_http (3.0.2)
24
+ i18n (1.12.0)
25
+ concurrent-ruby (~> 1.0)
26
+ json (2.6.2)
27
+ method_source (1.0.0)
28
+ minitest (5.16.3)
29
+ oj (3.13.23)
30
+ parallel (1.22.1)
31
+ parser (3.1.2.1)
32
+ ast (~> 2.4.1)
33
+ pry (0.14.1)
34
+ coderay (~> 1.1)
35
+ method_source (~> 1.0)
36
+ rainbow (3.1.1)
37
+ rake (13.0.6)
38
+ regexp_parser (2.6.1)
39
+ rexml (3.2.5)
40
+ rspec (3.12.0)
41
+ rspec-core (~> 3.12.0)
42
+ rspec-expectations (~> 3.12.0)
43
+ rspec-mocks (~> 3.12.0)
44
+ rspec-core (3.12.0)
45
+ rspec-support (~> 3.12.0)
46
+ rspec-expectations (3.12.0)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-mocks (3.12.0)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-support (3.12.0)
53
+ rubocop (1.39.0)
54
+ json (~> 2.3)
55
+ parallel (~> 1.10)
56
+ parser (>= 3.1.2.1)
57
+ rainbow (>= 2.2.2, < 4.0)
58
+ regexp_parser (>= 1.8, < 3.0)
59
+ rexml (>= 3.2.5, < 4.0)
60
+ rubocop-ast (>= 1.23.0, < 2.0)
61
+ ruby-progressbar (~> 1.7)
62
+ unicode-display_width (>= 1.4.0, < 3.0)
63
+ rubocop-ast (1.23.0)
64
+ parser (>= 3.1.1.0)
65
+ rubocop-performance (1.15.1)
66
+ rubocop (>= 1.7.0, < 2.0)
67
+ rubocop-ast (>= 0.4.0)
68
+ ruby-progressbar (1.11.0)
69
+ ruby2_keywords (0.0.5)
70
+ tzinfo (2.0.5)
71
+ concurrent-ruby (~> 1.0)
72
+ unicode-display_width (2.3.0)
73
+
74
+ PLATFORMS
75
+ x86_64-darwin-21
76
+
77
+ DEPENDENCIES
78
+ bundler
79
+ click_house!
80
+ oj
81
+ pry
82
+ rake
83
+ rspec
84
+ rubocop
85
+ rubocop-performance
86
+
87
+ BUNDLED WITH
88
+ 2.3.7
data/Makefile CHANGED
@@ -1,12 +1,37 @@
1
1
  .PHONY: help
2
2
 
3
+ .BUNDLE_GEMFILE:=
4
+ .REQUIRE:=./spec/spec_helper
5
+
3
6
  help:
4
7
  @echo 'Available targets:'
5
8
  @echo ' make dockerize OR make ARGS="--build" dockerize'
6
9
  @echo ' make release'
10
+ @echo ' '
11
+ @echo ' make faraday1 bundle'
12
+ @echo ' make faraday2 bundle'
13
+ @echo ' '
14
+ @echo ' make faraday1 rspec'
15
+ @echo ' make faraday2 rspec'
16
+ @echo ' make faraday2 oj rspec'
7
17
 
8
18
  dockerize:
9
19
  docker-compose up ${ARGS}
10
20
 
11
21
  release:
12
22
  bin/release.sh
23
+
24
+ faraday1:
25
+ $(eval .BUNDLE_GEMFILE=Gemfile_faraday1)
26
+
27
+ faraday2:
28
+ $(eval .BUNDLE_GEMFILE=Gemfile_faraday2)
29
+
30
+ oj:
31
+ $(eval .REQUIRE=./spec/oj_helper)
32
+
33
+ bundle:
34
+ BUNDLE_GEMFILE=${.BUNDLE_GEMFILE} bundle
35
+
36
+ rspec:
37
+ BUNDLE_GEMFILE=${.BUNDLE_GEMFILE} rspec --require ${.REQUIRE} spec
data/README.md CHANGED
@@ -65,6 +65,11 @@ ClickHouse.config do |config|
65
65
 
66
66
  # if you want to add settings to all queries
67
67
  config.global_params = { mutations_sync: 1 }
68
+
69
+ # choose a ruby JSON parser
70
+ config.json_parser = ClickHouse::Middleware::ParseJson
71
+ # or Oj parser
72
+ config.json_parser = ClickHouse::Middleware::ParseJsonOj
68
73
  end
69
74
  ```
70
75
 
@@ -221,7 +226,7 @@ end
221
226
  ```ruby
222
227
  ClickHouse.connection.create_table('visits', if_not_exists: true, engine: 'MergeTree(date, (year, date), 8192)') do |t|
223
228
  t.FixedString :id, 16
224
- t.UInt16 :year
229
+ t.UInt16 :year, low_cardinality: true
225
230
  t.Date :date
226
231
  t.DateTime :time, 'UTC'
227
232
  t.Decimal :money, 5, 4
@@ -337,25 +342,6 @@ end
337
342
  ClickHouse.add_type('Date', DateType.new)
338
343
  ```
339
344
 
340
- Actually `serialize` function is not used for now, but you may use it manually:
341
-
342
- ```ruby
343
- time_type = ClickHouse::Type::DateTimeType.new
344
- string_type = ClickHouse::Type::FixedStringType.new
345
-
346
- ClickHouse.connection.insert('table', columns: %i[name time]) do |buffer|
347
- buffer << [string_type.serialize('a' * 1000, 20), time_type.serialize(Time.current, 'Europe/Moscow')]
348
- end
349
-
350
- ## alternatively
351
- data = @records.map do |record|
352
- {
353
- id: record.id,
354
- time: ClickHouse.types['DateTime(%s)'].serialize(Time.current)
355
- }
356
- end
357
- ```
358
-
359
345
  If native type supports arguments, define *String* type with `%s`
360
346
  argument and *Numeric* type with `%d` argument:
361
347
 
data/click_house.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.summary = 'Modern Ruby database driver for ClickHouse'
11
11
  spec.description = 'Yandex ClickHouse database interface for Ruby'
12
12
  spec.homepage = 'https://github.com/shlima/click_house'
13
- spec.required_ruby_version = '>= 2.6.0'
13
+ spec.required_ruby_version = '>= 2.7.0'
14
14
 
15
15
  # Specify which files should be added to the gem when it is released.
16
16
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
19
19
  end
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_dependency 'faraday', '>= 1.7'
23
- spec.add_dependency 'faraday_middleware'
22
+ spec.add_dependency 'faraday', '>= 1.7', '< 3'
23
+ spec.add_dependency 'activesupport'
24
24
  spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'oj'
26
27
  spec.add_development_dependency 'rspec'
27
28
  spec.add_development_dependency 'pry'
28
29
  spec.add_development_dependency 'rubocop'
data/docker-compose.yml CHANGED
@@ -2,7 +2,7 @@ version: '3.5'
2
2
 
3
3
  services:
4
4
  clickhouse:
5
- image: clickhouse/clickhouse-server:22.6
5
+ image: clickhouse/clickhouse-server:22.9
6
6
  ports:
7
7
  - "8123:8123"
8
8
  - "9000:9000"