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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a31a5e1d3ea2e5d069ce7167a472e1eb001e9a9dbae0245a3adbc82a1155436d
|
|
4
|
+
data.tar.gz: 6e690df8b5088073777b46098ff77659da3c7b1fa7c9593305a07e7f61df2d31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89075c98153b99021ba858ae4de186beff0ab537780f141d974480f8ac1d44a71dd751d15693c6b605a4fc956a537cb8026ddf5d5bd1d4eaaedd8d7863369ec3
|
|
7
|
+
data.tar.gz: c498273b5fd00c0acdd174315783d62220b52e4aa99ffb08f491c61fe5f7a76b3c0fd63bc5ea78c385f53c2947fee4c87f37317c868e0b9d38ece66eb6d92c5a
|
data/CHANGELOG.md
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 [
|
|
283
|
+
# @param [String] sql
|
|
290
284
|
# @param [Hash] settings
|
|
291
285
|
# @param [Array] except_params
|
|
292
286
|
# @return [Net::HTTPResponse]
|
|
293
|
-
def request(
|
|
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
|
-
|
|
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
|
-
|
|
91
|
-
|
|
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
|
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.
|
|
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-
|
|
11
|
+
date: 2026-02-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|