clickhouse-activerecord 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71882da78e208681ad3f28c05bfad0ca4746f8e6b046a4b8cd14c2fa26a007b6
|
4
|
+
data.tar.gz: b0daa57171963e98a6d0aa4284b7728731009960a07cbdd45a0cc104fcb14213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aea7e2146f23b6183e4583a1b5cc7e4a38131fabff83574415a1e6c8bd607089305265c53ddb54dcbe2c476144d21b4b97795123cd7bfa038ef7a975de7bde9d
|
7
|
+
data.tar.gz: 2228a7f2a7e71005f2d2bb910c721373671bdbb7a6ea15e370ecd923a8fb47fa7cebaa548b50ed7ca9bf8d6d6c2ac27a95cca8c680604ba95934866b6488a8b9
|
data/README.md
CHANGED
@@ -149,7 +149,15 @@ Structure load from `db/clickhouse_structure.sql` file:
|
|
149
149
|
$ rake db:schema:dump
|
150
150
|
$ rake db:schema:load
|
151
151
|
$ rake db:structure:dump
|
152
|
-
$ rake db:structure:load
|
152
|
+
$ rake db:structure:load
|
153
|
+
|
154
|
+
### RSpec
|
155
|
+
|
156
|
+
For auto truncate tables before each test add to `spec/rails_helper.rb` file:
|
157
|
+
|
158
|
+
```
|
159
|
+
require 'clickhouse-activerecord/rspec'
|
160
|
+
```
|
153
161
|
|
154
162
|
### Insert and select data
|
155
163
|
|
@@ -133,6 +133,16 @@ module ActiveRecord
|
|
133
133
|
connect
|
134
134
|
end
|
135
135
|
|
136
|
+
# Savepoints are not supported, noop
|
137
|
+
def create_savepoint(name)
|
138
|
+
end
|
139
|
+
|
140
|
+
def exec_rollback_to_savepoint(name)
|
141
|
+
end
|
142
|
+
|
143
|
+
def release_savepoint(name)
|
144
|
+
end
|
145
|
+
|
136
146
|
def migrations_paths
|
137
147
|
@config[:migrations_paths] || 'db/migrate_clickhouse'
|
138
148
|
end
|
@@ -264,7 +274,7 @@ module ActiveRecord
|
|
264
274
|
# @param [String] table
|
265
275
|
# @return [String]
|
266
276
|
def show_create_table(table)
|
267
|
-
do_system_execute("SHOW CREATE TABLE `#{table}`")['data'].try(:first).try(:first).gsub(/[\n\s]+/m, ' ')
|
277
|
+
do_system_execute("SHOW CREATE TABLE `#{table}`")['data'].try(:first).try(:first).gsub(/[\n\s]+/m, ' ').gsub("#{@config[:database]}.", "")
|
268
278
|
end
|
269
279
|
|
270
280
|
# Create a new ClickHouse database.
|
@@ -16,8 +16,12 @@ module Arel
|
|
16
16
|
# https://clickhouse.com/docs/en/sql-reference/statements/delete
|
17
17
|
# DELETE and UPDATE in ClickHouse working only without table name
|
18
18
|
def visit_Arel_Attributes_Attribute(o, collector)
|
19
|
-
|
20
|
-
|
19
|
+
if collector.value.is_a?(String)
|
20
|
+
collector << quote_table_name(o.relation.table_alias || o.relation.name) << '.' unless collector.value.start_with?('DELETE FROM ') || collector.value.include?(' UPDATE ')
|
21
|
+
collector << quote_column_name(o.name)
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
def visit_Arel_Nodes_SelectOptions(o, collector)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.before do
|
5
|
+
ActiveRecord::Base.configurations.configurations.select { |x| x.env_name == Rails.env && x.adapter == 'clickhouse' }.each do |config|
|
6
|
+
ActiveRecord::Base.establish_connection(config)
|
7
|
+
ActiveRecord::Base.connection.tables.each do |table|
|
8
|
+
ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{table}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
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.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Odintsov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/arel/visitors/clickhouse.rb
|
122
122
|
- lib/clickhouse-activerecord.rb
|
123
123
|
- lib/clickhouse-activerecord/railtie.rb
|
124
|
+
- lib/clickhouse-activerecord/rspec.rb
|
124
125
|
- lib/clickhouse-activerecord/schema.rb
|
125
126
|
- lib/clickhouse-activerecord/schema_dumper.rb
|
126
127
|
- lib/clickhouse-activerecord/tasks.rb
|