clickhouse-activerecord 0.6.0 → 0.6.1

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: 182d838abbda9972bdfa59b1e6a76af247bd4e3b275a5e611dfe6cd8ceaaea5c
4
- data.tar.gz: f987ee429692c24518a0ea54d24f52c65f96ddfe1e6d6770fe0c2dd4549c623e
3
+ metadata.gz: 74728f97bde396aae27436dd6b7ec8d57ec172e818122f9094d994583c92781f
4
+ data.tar.gz: 64e08f74a95d755338b489b32f2aade49685b6b604a3d02d2f232ca9f24b7b23
5
5
  SHA512:
6
- metadata.gz: 90aac52260cd39eaa23dddb9be9290afa8ccb6731f4c84b6403d67fc56ddf1e24d075e9e33d9cc99ffdf29309608b0a8ae78a35db87d673731438dd5db50c57b
7
- data.tar.gz: 505c299c7f657deb7b0685504c0f61754b801d0900238fa9a00a939b49873e379e2d2c84f9ce3661e0c26d405b9e94a31cbeb71c514f644cf4391059df44fa22
6
+ metadata.gz: 959c753aaf61bcef02dd336953d1bd88bc0d2d3762bc5f96e3816699685c809da2f4ad7646201570892a12fad32760a80d69ff6292b172fb6e9c518c13dc622d
7
+ data.tar.gz: e7ee279cf5dc1b8168448f8c657550e2cb418121da1ef58c1d53989f8a7cc678527fcb7678cc0ba903d9e5d9e108450c9da28d03ba0e6d9364738d1c2f60e414
data/README.md CHANGED
@@ -183,6 +183,10 @@ Action.where(date: Date.current).final.limit(10)
183
183
  Action.settings(optimize_read_in_order: 1).where(date: Date.current).limit(10)
184
184
  # Clickhouse Action Load (10.3ms) SELECT actions.* FROM actions FINAL WHERE actions.date = '2017-11-29' LIMIT 10 SETTINGS optimize_read_in_order = 1
185
185
  #=> #<ActiveRecord::Relation [#<Action *** >]>
186
+
187
+ User.joins(:actions).using(:group_id)
188
+ # Clickhouse User Load (10.3ms) SELECT users.* FROM users INNER JOIN actions USING group_id
189
+ #=> #<ActiveRecord::Relation [#<Action *** >]>
186
190
  ```
187
191
 
188
192
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ['lib']
25
25
 
26
26
  spec.add_runtime_dependency 'bundler', '>= 1.13.4'
27
- spec.add_runtime_dependency 'activerecord', '>= 5.2'
27
+ spec.add_runtime_dependency 'activerecord', '>= 5.2', '< 7'
28
28
 
29
29
  spec.add_development_dependency 'rake', '~> 13.0'
30
30
  spec.add_development_dependency 'rspec', '~> 3.4'
@@ -125,7 +125,7 @@ module ActiveRecord
125
125
  end
126
126
 
127
127
  def current_database
128
- if ActiveRecord::version >= Gem::Version.new('6')
128
+ if ActiveRecord::version >= Gem::Version.new('6.1')
129
129
  ActiveRecord::Base.connection_db_config.database
130
130
  else
131
131
  ActiveRecord::Base.connection_config[:database]
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'arel/visitors/clickhouse'
4
4
  require 'arel/nodes/settings'
5
+ require 'arel/nodes/using'
5
6
  require 'clickhouse-activerecord/migration'
6
7
  require 'active_record/connection_adapters/clickhouse/oid/array'
7
8
  require 'active_record/connection_adapters/clickhouse/oid/date'
@@ -0,0 +1,6 @@
1
+ module Arel # :nodoc: all
2
+ module Nodes
3
+ class Using < Arel::Nodes::Unary
4
+ end
5
+ end
6
+ end
@@ -36,6 +36,12 @@ module Arel
36
36
  collector
37
37
  end
38
38
 
39
+ def visit_Arel_Nodes_Using o, collector
40
+ collector << "USING "
41
+ visit o.expr, collector
42
+ collector
43
+ end
44
+
39
45
  def sanitize_as_setting_value(value)
40
46
  if value == :default
41
47
  'DEFAULT'
@@ -1,3 +1,3 @@
1
1
  module ClickhouseActiverecord
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -7,6 +7,11 @@ module CoreExtensions
7
7
  @ast.settings = ::Arel::Nodes::Settings.new(values)
8
8
  self
9
9
  end
10
+
11
+ def using(*exprs)
12
+ @ctx.source.right.last.right = ::Arel::Nodes::Using.new(::Arel.sql(exprs.join(',')))
13
+ self
14
+ end
10
15
  end
11
16
  end
12
17
  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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Odintsov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2023-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '5.2'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '5.2'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +114,7 @@ files:
108
114
  - lib/active_record/connection_adapters/clickhouse/schema_statements.rb
109
115
  - lib/active_record/connection_adapters/clickhouse_adapter.rb
110
116
  - lib/arel/nodes/settings.rb
117
+ - lib/arel/nodes/using.rb
111
118
  - lib/arel/visitors/clickhouse.rb
112
119
  - lib/clickhouse-activerecord.rb
113
120
  - lib/clickhouse-activerecord/migration.rb