masamune 0.13.7 → 0.13.8
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/lib/masamune/transform/bulk_upsert.psql.erb +4 -1
- data/lib/masamune/version.rb +1 -1
- data/spec/masamune/transform/bulk_upsert.dimension_spec.rb +10 -2
- data/spec/masamune/transform/insert_reference_values.dimension_spec.rb +6 -1
- data/spec/masamune/transform/insert_reference_values.fact_spec.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4d4d75d505e70be3e5c119ccb677ad9e9846a85
|
4
|
+
data.tar.gz: 2518fa319f34c708c94b363473b9e0ab4cf73b75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43e4b96852c3cacaadf6a82169eefd892d962329f151ced5923369281340cf0a2b49e1edadc0de59cb1080f89b2c91ebfa61378e6bcae602ccd7af361ccb793a
|
7
|
+
data.tar.gz: e5aabba71b0721d37537f59d0744ebb02a66e73dcc060a98704bf8247b9ec229c3db8a3a338a4603c2b57e780a97cec663da5ecb653a67ff09fc6acd577ecf13
|
@@ -20,8 +20,9 @@
|
|
20
20
|
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
-- THE SOFTWARE.
|
22
22
|
|
23
|
+
SELECT pg_advisory_lock(<%= target.lock_id %>);
|
24
|
+
|
23
25
|
BEGIN;
|
24
|
-
LOCK TABLE <%= target.name %> IN EXCLUSIVE MODE;
|
25
26
|
|
26
27
|
<%- if target.update_columns.any? -%>
|
27
28
|
UPDATE
|
@@ -64,3 +65,5 @@ WHERE
|
|
64
65
|
COMMIT;
|
65
66
|
|
66
67
|
VACUUM FULL ANALYZE <%= target.name %>;
|
68
|
+
|
69
|
+
SELECT pg_advisory_unlock(<%= target.lock_id %>);
|
data/lib/masamune/version.rb
CHANGED
@@ -24,6 +24,8 @@ require 'spec_helper'
|
|
24
24
|
|
25
25
|
describe Masamune::Transform::BulkUpsert do
|
26
26
|
before do
|
27
|
+
allow_any_instance_of(Masamune::Schema::Table).to receive(:lock_id).and_return(42)
|
28
|
+
|
27
29
|
catalog.schema :postgres do
|
28
30
|
dimension 'cluster', type: :mini do
|
29
31
|
column 'id', type: :integer, surrogate_key: true, auto: true
|
@@ -78,8 +80,9 @@ describe Masamune::Transform::BulkUpsert do
|
|
78
80
|
|
79
81
|
it 'should render bulk_upsert template' do
|
80
82
|
is_expected.to eq <<-EOS.strip_heredoc
|
83
|
+
SELECT pg_advisory_lock(42);
|
84
|
+
|
81
85
|
BEGIN;
|
82
|
-
LOCK TABLE user_dimension IN EXCLUSIVE MODE;
|
83
86
|
|
84
87
|
UPDATE
|
85
88
|
user_dimension
|
@@ -130,6 +133,8 @@ describe Masamune::Transform::BulkUpsert do
|
|
130
133
|
COMMIT;
|
131
134
|
|
132
135
|
VACUUM FULL ANALYZE user_dimension;
|
136
|
+
|
137
|
+
SELECT pg_advisory_unlock(42);
|
133
138
|
EOS
|
134
139
|
end
|
135
140
|
end
|
@@ -139,8 +144,9 @@ describe Masamune::Transform::BulkUpsert do
|
|
139
144
|
|
140
145
|
it 'should render bulk_upsert template' do
|
141
146
|
is_expected.to eq <<-EOS.strip_heredoc
|
147
|
+
SELECT pg_advisory_lock(42);
|
148
|
+
|
142
149
|
BEGIN;
|
143
|
-
LOCK TABLE user_dimension_ledger IN EXCLUSIVE MODE;
|
144
150
|
|
145
151
|
UPDATE
|
146
152
|
user_dimension_ledger
|
@@ -196,6 +202,8 @@ describe Masamune::Transform::BulkUpsert do
|
|
196
202
|
COMMIT;
|
197
203
|
|
198
204
|
VACUUM FULL ANALYZE user_dimension_ledger;
|
205
|
+
|
206
|
+
SELECT pg_advisory_unlock(42);
|
199
207
|
EOS
|
200
208
|
end
|
201
209
|
end
|
@@ -24,6 +24,8 @@ require 'spec_helper'
|
|
24
24
|
|
25
25
|
describe Masamune::Transform::InsertReferenceValues do
|
26
26
|
before do
|
27
|
+
allow_any_instance_of(Masamune::Schema::Table).to receive(:lock_id).and_return(42)
|
28
|
+
|
27
29
|
catalog.schema :postgres do
|
28
30
|
dimension 'department', type: :mini do
|
29
31
|
column 'tenant_id', type: :integer, unique: true, natural_key: true
|
@@ -76,8 +78,9 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
76
78
|
|
77
79
|
ANALYZE department_type_stage;
|
78
80
|
|
81
|
+
SELECT pg_advisory_lock(42);
|
82
|
+
|
79
83
|
BEGIN;
|
80
|
-
LOCK TABLE department_type IN EXCLUSIVE MODE;
|
81
84
|
|
82
85
|
INSERT INTO
|
83
86
|
department_type (tenant_id, department_id)
|
@@ -99,6 +102,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
99
102
|
COMMIT;
|
100
103
|
|
101
104
|
VACUUM FULL ANALYZE department_type;
|
105
|
+
|
106
|
+
SELECT pg_advisory_unlock(42);
|
102
107
|
EOS
|
103
108
|
end
|
104
109
|
end
|
@@ -24,6 +24,8 @@ require 'spec_helper'
|
|
24
24
|
|
25
25
|
describe Masamune::Transform::InsertReferenceValues do
|
26
26
|
before do
|
27
|
+
allow_any_instance_of(Masamune::Schema::Table).to receive(:lock_id).and_return(42)
|
28
|
+
|
27
29
|
catalog.schema :postgres do
|
28
30
|
dimension 'date', type: :one do
|
29
31
|
column 'date_id', type: :integer, unique: true, index: true, natural_key: true
|
@@ -93,8 +95,9 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
93
95
|
|
94
96
|
ANALYZE user_agent_type_stage;
|
95
97
|
|
98
|
+
SELECT pg_advisory_lock(42);
|
99
|
+
|
96
100
|
BEGIN;
|
97
|
-
LOCK TABLE user_agent_type IN EXCLUSIVE MODE;
|
98
101
|
|
99
102
|
INSERT INTO
|
100
103
|
user_agent_type (name, version)
|
@@ -117,6 +120,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
117
120
|
|
118
121
|
VACUUM FULL ANALYZE user_agent_type;
|
119
122
|
|
123
|
+
SELECT pg_advisory_unlock(42);
|
124
|
+
|
120
125
|
CREATE TEMPORARY TABLE IF NOT EXISTS feature_type_stage (LIKE feature_type INCLUDING ALL);
|
121
126
|
|
122
127
|
INSERT INTO
|
@@ -131,8 +136,9 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
131
136
|
|
132
137
|
ANALYZE feature_type_stage;
|
133
138
|
|
139
|
+
SELECT pg_advisory_lock(42);
|
140
|
+
|
134
141
|
BEGIN;
|
135
|
-
LOCK TABLE feature_type IN EXCLUSIVE MODE;
|
136
142
|
|
137
143
|
INSERT INTO
|
138
144
|
feature_type (name)
|
@@ -151,6 +157,8 @@ describe Masamune::Transform::InsertReferenceValues do
|
|
151
157
|
COMMIT;
|
152
158
|
|
153
159
|
VACUUM FULL ANALYZE feature_type;
|
160
|
+
|
161
|
+
SELECT pg_advisory_unlock(42);
|
154
162
|
EOS
|
155
163
|
end
|
156
164
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: masamune
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Andrews
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|