clickhouse-activerecord 0.5.8 → 0.5.10

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: c8f8d01291f12197d0b5d0b8f791631fe144cdc5d855de9dd9c8498e170fafdf
4
- data.tar.gz: 2ebd5b6068a179a7c87679db0fe9c34bbe2f9197c6230da9aad1a6935fc9c7d9
3
+ metadata.gz: e172255ef4610b0db49f84dea36cdd85951fc4ea596f1cbe7b63c62e9c9b2633
4
+ data.tar.gz: ec85d89e0274006250466bd8a96654d30eb6614512c4d0d0bee80dcf08285a20
5
5
  SHA512:
6
- metadata.gz: 94abbef81ff0000ecbc05092dd3558dc90e53223fd0025c5a57549f4b5f98431a01ee9fceee5587887c9fa6fcc3411420e936ad942150caa8edc5146c7db54df
7
- data.tar.gz: '03871bfe2bec394c9612928229cc3380615acd795b25c058072a3aec62a7852e06711f2811286438ab278c838d4ed65736bd47ae449bc0ca5bbad6763692a927'
6
+ metadata.gz: 5130aef7dc279582f73ca91fbd0be7f80cf7200d241b17ab747e356762a9a21d5060f2f10995762a29ba5c46942bda17643937a7f849b28da58214998e85462d
7
+ data.tar.gz: '00096694c1b25b72e1f45c1f0160714eceb0c1f0c101206a9e4bc0cb4abadc825c24665f68ad4bcc7950b07553ffbceaa809830df5b35c7c3043ae9acb969ce6'
data/CHANGELOG.md CHANGED
@@ -1,10 +1,14 @@
1
+ ### Version 0.5.8 (Oct 25, 2021)
2
+
3
+ * Added support rails 7
4
+
1
5
  ### Version 0.5.6 (Oct 25, 2021)
2
-
6
+
3
7
  * Added auto creating service distributed tables and additional options for creating view [@ygreeek](https://github.com/ygreeek)
4
8
  * Added default user agent
5
9
 
6
10
  ### Version 0.5.3 (Sep 22, 2021)
7
-
11
+
8
12
  * Fix replica cluster for a new syntax MergeTree
9
13
  * Fix support rails 5.2 on alter table
10
14
  * Support array type of column
@@ -92,7 +92,7 @@ module ActiveRecord
92
92
  if (duplicate = inserting.detect { |v| inserting.count(v) > 1 })
93
93
  raise "Duplicate migration #{duplicate}. Please renumber your migrations to resolve the conflict."
94
94
  end
95
- execute insert_versions_sql(inserting)
95
+ do_execute(insert_versions_sql(inserting), nil, settings: {max_partitions_per_insert_block: [100, inserting.size].max})
96
96
  end
97
97
  end
98
98
 
@@ -32,6 +32,7 @@ module ActiveRecord
32
32
  sslca: config[:sslca],
33
33
  read_timeout: config[:read_timeout],
34
34
  write_timeout: config[:write_timeout],
35
+ keep_alive_timeout: config[:keep_alive_timeout]
35
36
  }
36
37
  end
37
38
 
@@ -80,17 +81,10 @@ module ActiveRecord
80
81
  def is_view=(value)
81
82
  @is_view = value
82
83
  end
83
- end
84
- end
85
84
 
86
- ActiveRecord::Core::ClassMethods.module_eval do
87
- def arel_table
88
- @arel_table ||=
89
- if self.connection.is_a?(ConnectionAdapters::ClickhouseAdapter)
90
- ClickhouseActiverecord::Arel::Table.new(table_name, type_caster: type_caster)
91
- else
92
- Arel::Table.new(table_name, klass: self)
93
- end
85
+ def arel_table # :nodoc:
86
+ @arel_table ||= ClickhouseActiverecord::Arel::Table.new(table_name, type_caster: type_caster)
87
+ end
94
88
  end
95
89
  end
96
90
 
@@ -233,14 +227,22 @@ module ActiveRecord
233
227
  # Quoting time without microseconds
234
228
  def quoted_date(value)
235
229
  if value.acts_like?(:time)
236
- zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal
230
+ if ActiveRecord::version >= Gem::Version.new('7')
231
+ zone_conversion_method = ActiveRecord.default_timezone == :utc ? :getutc : :getlocal
232
+ else
233
+ zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal
234
+ end
237
235
 
238
236
  if value.respond_to?(zone_conversion_method)
239
237
  value = value.send(zone_conversion_method)
240
238
  end
241
239
  end
242
240
 
243
- value.to_s(:db)
241
+ if ActiveRecord::version >= Gem::Version.new('7')
242
+ value.to_fs(:db)
243
+ else
244
+ value.to_s(:db)
245
+ end
244
246
  end
245
247
 
246
248
  def column_name_for_operation(operation, node) # :nodoc:
@@ -292,7 +294,7 @@ module ActiveRecord
292
294
  drop_table(table_name, options.merge(if_exists: true))
293
295
  end
294
296
 
295
- execute schema_creation.accept td
297
+ do_execute(schema_creation.accept(td), format: nil)
296
298
  end
297
299
 
298
300
  def create_table(table_name, **options, &block)
@@ -304,7 +306,7 @@ module ActiveRecord
304
306
  drop_table(table_name, options.merge(if_exists: true))
305
307
  end
306
308
 
307
- execute schema_creation.accept td
309
+ do_execute(schema_creation.accept(td), format: nil)
308
310
 
309
311
  if options[:with_distributed]
310
312
  distributed_table_name = options.delete(:with_distributed)
@@ -376,7 +378,7 @@ module ActiveRecord
376
378
 
377
379
  def database_engine_atomic?
378
380
  current_database_engine = "select engine from system.databases where name = '#{@config[:database]}'"
379
- res = ActiveRecord::Base.connection.select_one(current_database_engine)
381
+ res = select_one(current_database_engine)
380
382
  res['engine'] == 'Atomic' if res
381
383
  end
382
384
 
@@ -418,6 +420,9 @@ module ActiveRecord
418
420
  @connection.read_timeout = @connection_parameters[:read_timeout] if @connection_parameters[:read_timeout]
419
421
  @connection.write_timeout = @connection_parameters[:write_timeout] if @connection_parameters[:write_timeout]
420
422
 
423
+ # Use clickhouse default keep_alive_timeout value of 10, rather than Net::HTTP's default of 2
424
+ @connection.keep_alive_timeout = @connection_parameters[:keep_alive_timeout] || 10
425
+
421
426
  @connection
422
427
  end
423
428
 
@@ -1,3 +1,3 @@
1
1
  module ClickhouseActiverecord
2
- VERSION = '0.5.8'
2
+ VERSION = '0.5.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clickhouse-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Odintsov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-26 00:00:00.000000000 Z
11
+ date: 2022-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler