table_saw 2.3.0 → 2.4.0
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 +4 -4
- data/Gemfile.lock +27 -27
- data/lib/table_saw/connection.rb +8 -8
- data/lib/table_saw/dependency_graph/belongs_to_directives.rb +5 -1
- data/lib/table_saw/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfb7db9a15aed357484e10dabd9687a4b06fa2f8871bbff409c2dd54e7172cb3
|
|
4
|
+
data.tar.gz: ae37d05b97291739a83964d6e7b2c741cafbf7579087bb5c9e5721c0f08efd78
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60c64ddc7485a42fd359de58e6c0cbcaff2a05747ad03998e7ee9774e28d02864025a99f4513f8f63320364a8b00034771c4b946ce776f07e66ebd3dd232d2a3
|
|
7
|
+
data.tar.gz: 2b754503fa0039d4192e73c006e5fac4abde173dc26b2625242260f54e215e57f31f2a3ca9455e35bbd743b5b051b7ba6e68987fec9e06aa1a37a0b52136a469
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
table_saw (2.
|
|
4
|
+
table_saw (2.4.0)
|
|
5
5
|
activerecord (>= 5.2)
|
|
6
6
|
pg
|
|
7
7
|
thor
|
|
@@ -9,35 +9,34 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
actionpack (
|
|
13
|
-
actionview (=
|
|
14
|
-
activesupport (=
|
|
12
|
+
actionpack (6.0.1)
|
|
13
|
+
actionview (= 6.0.1)
|
|
14
|
+
activesupport (= 6.0.1)
|
|
15
15
|
rack (~> 2.0)
|
|
16
16
|
rack-test (>= 0.6.3)
|
|
17
17
|
rails-dom-testing (~> 2.0)
|
|
18
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
|
19
|
-
actionview (
|
|
20
|
-
activesupport (=
|
|
18
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
19
|
+
actionview (6.0.1)
|
|
20
|
+
activesupport (= 6.0.1)
|
|
21
21
|
builder (~> 3.1)
|
|
22
22
|
erubi (~> 1.4)
|
|
23
23
|
rails-dom-testing (~> 2.0)
|
|
24
|
-
rails-html-sanitizer (~> 1.
|
|
25
|
-
activemodel (
|
|
26
|
-
activesupport (=
|
|
27
|
-
activerecord (
|
|
28
|
-
activemodel (=
|
|
29
|
-
activesupport (=
|
|
30
|
-
|
|
31
|
-
activesupport (5.2.3)
|
|
24
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
25
|
+
activemodel (6.0.1)
|
|
26
|
+
activesupport (= 6.0.1)
|
|
27
|
+
activerecord (6.0.1)
|
|
28
|
+
activemodel (= 6.0.1)
|
|
29
|
+
activesupport (= 6.0.1)
|
|
30
|
+
activesupport (6.0.1)
|
|
32
31
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
33
32
|
i18n (>= 0.7, < 2)
|
|
34
33
|
minitest (~> 5.1)
|
|
35
34
|
tzinfo (~> 1.1)
|
|
36
|
-
|
|
35
|
+
zeitwerk (~> 2.2)
|
|
37
36
|
ast (2.4.0)
|
|
38
37
|
builder (3.2.3)
|
|
39
38
|
coderay (1.1.2)
|
|
40
|
-
combustion (1.1.
|
|
39
|
+
combustion (1.1.2)
|
|
41
40
|
activesupport (>= 3.0.0)
|
|
42
41
|
railties (>= 3.0.0)
|
|
43
42
|
thor (>= 0.14.6)
|
|
@@ -46,18 +45,18 @@ GEM
|
|
|
46
45
|
database_cleaner (1.7.0)
|
|
47
46
|
diff-lcs (1.3)
|
|
48
47
|
docile (1.3.1)
|
|
49
|
-
erubi (1.
|
|
48
|
+
erubi (1.9.0)
|
|
50
49
|
i18n (1.7.0)
|
|
51
50
|
concurrent-ruby (~> 1.0)
|
|
52
51
|
jaro_winkler (1.5.2)
|
|
53
52
|
json (2.2.0)
|
|
54
|
-
loofah (2.
|
|
53
|
+
loofah (2.4.0)
|
|
55
54
|
crass (~> 1.0.2)
|
|
56
55
|
nokogiri (>= 1.5.9)
|
|
57
56
|
method_source (0.9.2)
|
|
58
57
|
mini_portile2 (2.4.0)
|
|
59
58
|
minitest (5.13.0)
|
|
60
|
-
nokogiri (1.10.
|
|
59
|
+
nokogiri (1.10.7)
|
|
61
60
|
mini_portile2 (~> 2.4.0)
|
|
62
61
|
parallel (1.17.0)
|
|
63
62
|
parser (2.6.3.0)
|
|
@@ -72,14 +71,14 @@ GEM
|
|
|
72
71
|
rails-dom-testing (2.0.3)
|
|
73
72
|
activesupport (>= 4.2.0)
|
|
74
73
|
nokogiri (>= 1.6)
|
|
75
|
-
rails-html-sanitizer (1.0
|
|
76
|
-
loofah (~> 2.
|
|
77
|
-
railties (
|
|
78
|
-
actionpack (=
|
|
79
|
-
activesupport (=
|
|
74
|
+
rails-html-sanitizer (1.3.0)
|
|
75
|
+
loofah (~> 2.3)
|
|
76
|
+
railties (6.0.1)
|
|
77
|
+
actionpack (= 6.0.1)
|
|
78
|
+
activesupport (= 6.0.1)
|
|
80
79
|
method_source
|
|
81
80
|
rake (>= 0.8.7)
|
|
82
|
-
thor (>= 0.
|
|
81
|
+
thor (>= 0.20.3, < 2.0)
|
|
83
82
|
rainbow (3.0.0)
|
|
84
83
|
rake (10.5.0)
|
|
85
84
|
rspec (3.8.0)
|
|
@@ -113,11 +112,12 @@ GEM
|
|
|
113
112
|
json (>= 1.8, < 3)
|
|
114
113
|
simplecov-html (~> 0.10.0)
|
|
115
114
|
simplecov-html (0.10.2)
|
|
116
|
-
thor (0.
|
|
115
|
+
thor (0.20.3)
|
|
117
116
|
thread_safe (0.3.6)
|
|
118
117
|
tzinfo (1.2.5)
|
|
119
118
|
thread_safe (~> 0.1)
|
|
120
119
|
unicode-display_width (1.6.0)
|
|
120
|
+
zeitwerk (2.2.2)
|
|
121
121
|
|
|
122
122
|
PLATFORMS
|
|
123
123
|
ruby
|
data/lib/table_saw/connection.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'pg'
|
|
4
3
|
require 'active_record'
|
|
4
|
+
|
|
5
|
+
require 'active_record/connection_adapters/abstract/connection_pool'
|
|
5
6
|
require 'active_record/connection_adapters/postgresql_adapter'
|
|
6
7
|
|
|
7
8
|
module TableSaw
|
|
@@ -9,11 +10,7 @@ module TableSaw
|
|
|
9
10
|
def self.with
|
|
10
11
|
raise ArgumentError, 'requires a block' unless block_given?
|
|
11
12
|
|
|
12
|
-
yield
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def self.raw
|
|
16
|
-
@raw ||= PG::Connection.new(TableSaw.configuration.connection)
|
|
13
|
+
yield adapter.raw_connection
|
|
17
14
|
end
|
|
18
15
|
|
|
19
16
|
def self.exec(sql)
|
|
@@ -23,8 +20,11 @@ module TableSaw
|
|
|
23
20
|
end
|
|
24
21
|
|
|
25
22
|
def self.adapter
|
|
26
|
-
@adapter ||=
|
|
27
|
-
|
|
23
|
+
@adapter ||= begin
|
|
24
|
+
config = TableSaw.configuration.connection
|
|
25
|
+
conn = ::PG::Connection.new(config)
|
|
26
|
+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new(conn, nil, config, {})
|
|
27
|
+
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -27,6 +27,7 @@ module TableSaw
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# rubocop:disable Metrics/AbcSize
|
|
30
31
|
def query_result(column)
|
|
31
32
|
return [] unless directive.selectable?
|
|
32
33
|
|
|
@@ -34,10 +35,13 @@ module TableSaw
|
|
|
34
35
|
format(
|
|
35
36
|
'select distinct %{column} from %{table_name} where %{clause} and %{column} is not null',
|
|
36
37
|
primary_key: directive.primary_key, column: column, table_name: directive.table_name,
|
|
37
|
-
clause: TableSaw::Queries::SerializeSqlInClause.new(directive.table_name,
|
|
38
|
+
clause: TableSaw::Queries::SerializeSqlInClause.new(directive.table_name,
|
|
39
|
+
directive.primary_key,
|
|
40
|
+
directive.ids).call
|
|
38
41
|
)
|
|
39
42
|
)
|
|
40
43
|
end
|
|
44
|
+
# rubocop:enable Metrics/AbcSize
|
|
41
45
|
end
|
|
42
46
|
end
|
|
43
47
|
end
|
data/lib/table_saw/version.rb
CHANGED