clickhouse-activerecord 1.6.3 → 1.6.4

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: 5bfabbcebb77881c7199f5895b1c3e4a7066c2eddaeec138432434f0a754fb70
4
- data.tar.gz: a17ff604e9b01015f4a100f1e83267aad340c847541f8aeb0467d083afeb789a
3
+ metadata.gz: a31a5e1d3ea2e5d069ce7167a472e1eb001e9a9dbae0245a3adbc82a1155436d
4
+ data.tar.gz: 6e690df8b5088073777b46098ff77659da3c7b1fa7c9593305a07e7f61df2d31
5
5
  SHA512:
6
- metadata.gz: 266b0794fe05ec58183b61cb7b7e8cefd99b44ce7fbc8a92810651f897dff514df09b48f16e8d50cdd394d7f00833039094caaf671c7e322a1a3b44c470b05df
7
- data.tar.gz: afb3f2a22842ea4caef138ab206e73151fe237f89fa136c0fb2f4b1b160ff9e5594b4045224f8ab0c46512e1fe158eaf35cd698a66f4ff9d1542c69baebf9fa8
6
+ metadata.gz: 89075c98153b99021ba858ae4de186beff0ab537780f141d974480f8ac1d44a71dd751d15693c6b605a4fc956a537cb8026ddf5d5bd1d4eaaedd8d7863369ec3
7
+ data.tar.gz: c498273b5fd00c0acdd174315783d62220b52e4aa99ffb08f491c61fe5f7a76b3c0fd63bc5ea78c385f53c2947fee4c87f37317c868e0b9d38ece66eb6d92c5a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### Version 1.6.4 (Feb 13, 2026)
2
+
3
+ * Fix error: EOFError (end of file reached)
4
+
1
5
  ### Version 1.6.3 (Feb 04, 2026)
2
6
 
3
7
  * Rename method `execute_streaming` to `execute_to_file`
@@ -58,10 +58,7 @@ module ActiveRecord
58
58
  def execute_to_file(sql, name = nil, format: @response_format, settings: {})
59
59
  with_response_format(format) do
60
60
  log(sql, [adapter_name, 'Stream', name].compact.join(' ')) do
61
- statement = Statement.new(sql, format: @response_format)
62
- request(statement, settings: settings) do |response|
63
- return statement.streaming_response(response)
64
- end
61
+ request(sql, settings: settings, streaming: true)
65
62
  end
66
63
  end
67
64
  end
@@ -102,8 +99,7 @@ module ActiveRecord
102
99
  # @link https://clickhouse.com/docs/en/sql-reference/statements/delete
103
100
  def exec_delete(sql, name = nil, _binds = [])
104
101
  log(sql, "#{adapter_name} #{name}") do
105
- statement = Statement.new(sql, format: @response_format)
106
- res = request(statement)
102
+ res = request(sql, raw_response: true)
107
103
  begin
108
104
  data = JSON.parse(res.header['x-clickhouse-summary'])
109
105
  data['result_rows'].to_i
@@ -280,23 +276,30 @@ module ActiveRecord
280
276
  end
281
277
 
282
278
  def raw_execute(sql, settings: {}, except_params: [])
283
- statement = Statement.new(sql, format: @response_format)
284
- response = request(statement, settings: settings, except_params: except_params)
285
- statement.processed_response(response)
279
+ request(sql, settings: settings, except_params: except_params)
286
280
  end
287
281
 
288
282
  # Make HTTP request to ClickHouse server
289
- # @param [ActiveRecord::ConnectionAdapters::Clickhouse::Statement] statement
283
+ # @param [String] sql
290
284
  # @param [Hash] settings
291
285
  # @param [Array] except_params
292
286
  # @return [Net::HTTPResponse]
293
- def request(statement, settings: {}, except_params: [], &block)
287
+ def request(sql, settings: {}, except_params: [], raw_response: false, streaming: false)
294
288
  @lock.synchronize do
295
289
  req = Net::HTTP::Post.new("/?#{settings_params(settings, except: except_params)}", {
296
290
  'Content-Type' => 'application/x-www-form-urlencoded',
297
291
  'User-Agent' => ClickhouseAdapter::USER_AGENT,
298
292
  })
299
- @connection.request(req, statement.formatted_sql, &block)
293
+ statement = Statement.new(sql, format: @response_format)
294
+ if streaming
295
+ @connection.request(req, statement.formatted_sql) do |response|
296
+ return statement.streaming_response(response)
297
+ end
298
+ else
299
+ response = @connection.request(req, statement.formatted_sql)
300
+ return response if raw_response
301
+ statement.processed_response(response)
302
+ end
300
303
  end
301
304
  end
302
305
 
@@ -85,10 +85,16 @@ module ClickhouseActiverecord
85
85
  columns.each do |column|
86
86
  raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type)
87
87
  next if column.name == pk && column.name == "id"
88
- type, colspec = column_spec(column)
89
88
  name = column.name =~ (/\./) ? "\"`#{column.name}`\"" : column.name.inspect
90
- tbl.print " t.#{type} #{name}"
91
- tbl.print ", #{format_colspec(colspec)}" if colspec.present?
89
+ if column.sql_type.match?(/^(Simple)?AggregateFunction/)
90
+ tbl.print " t.column #{name}, #{column.sql_type.inspect}"
91
+ colspec = prepare_column_options(column)
92
+ tbl.print ", #{format_colspec(colspec)}" if colspec.present?
93
+ else
94
+ type, colspec = column_spec(column)
95
+ tbl.print " t.#{type} #{name}"
96
+ tbl.print ", #{format_colspec(colspec)}" if colspec.present?
97
+ end
92
98
  tbl.puts
93
99
  end
94
100
  end
@@ -1,3 +1,3 @@
1
1
  module ClickhouseActiverecord
2
- VERSION = '1.6.3'
2
+ VERSION = '1.6.4'
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: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Odintsov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-04 00:00:00.000000000 Z
11
+ date: 2026-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler