data_taster 0.6.0 → 0.6.1

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: 2ea98339906aa0e399bb9b3f98fe4da01427eeef571c9144163cbc6e24a2746a
4
- data.tar.gz: 84c2069b369c1898108c2ce8545df3384b8dbf9e24e7e45e9ac8fe12cfc92682
3
+ metadata.gz: a3d5ab212f773905194af6bf35f28b9535eb6a381eb1958c715f31f7571ae068
4
+ data.tar.gz: 9a2ae14ea79cd751762a600cf81a00f48bb045d4e931f12dbc773d8565b763a2
5
5
  SHA512:
6
- metadata.gz: 3ef19b1d64946d683fee115a0c4cad46bde05bd761d8a701fa30856124659b329b950a6bc79b1a237799101a585233161a0ab956b0f54b617e5fc66d22ebe133
7
- data.tar.gz: c36a8e79951dddcaa74a58d3afdde6055e3f6c256732960bbeab90469e348fbc3b6370540527b4146b09ae6ace0620bec8fe236fde5911470a73f31a0c5f3df2
6
+ metadata.gz: dd8c7af7eeedd8b4076bdd6c8601c3d131de3d5fecc721fba671da178b84267e965e4f3b2a9fb79998e77740761449669d23d64aa455448d2ea259c242a5a91f
7
+ data.tar.gz: 669f139c04ee1c2e58575211d7b1b5f2ceb49d8c37450550f41a6cc76b8a4d96515979e52ddd4e0c0f11f2f8836aa0d036367f84c6b290004153b02fe0ecff9b
data/Gemfile.lock CHANGED
@@ -1,85 +1,82 @@
1
1
  PATH
2
2
  remote: ../rubocop-powerhome
3
3
  specs:
4
- rubocop-powerhome (0.8.0)
4
+ rubocop-powerhome (0.9.0)
5
5
  lint_roller (~> 1.1)
6
- rubocop (= 1.82.1)
6
+ rubocop (>= 1.82.1, < 2)
7
7
  rubocop-performance (>= 1.24)
8
- rubocop-rails (>= 2.28)
8
+ rubocop-rails (>= 2.35.5)
9
9
  rubocop-rake (>= 0.7)
10
10
  rubocop-rspec (>= 3.5)
11
11
 
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- data_taster (0.6.0)
15
+ data_taster (0.6.1)
16
16
  rails (>= 7.1.3.2, <= 8.2)
17
17
 
18
18
  GEM
19
19
  remote: https://rubygems.org/
20
20
  specs:
21
- actioncable (7.2.3.1)
22
- actionpack (= 7.2.3.1)
23
- activesupport (= 7.2.3.1)
21
+ actioncable (8.0.5.2)
22
+ actionpack (= 8.0.5.2)
23
+ activesupport (= 8.0.5.2)
24
24
  nio4r (~> 2.0)
25
25
  websocket-driver (>= 0.6.1)
26
26
  zeitwerk (~> 2.6)
27
- actionmailbox (7.2.3.1)
28
- actionpack (= 7.2.3.1)
29
- activejob (= 7.2.3.1)
30
- activerecord (= 7.2.3.1)
31
- activestorage (= 7.2.3.1)
32
- activesupport (= 7.2.3.1)
27
+ actionmailbox (8.0.5.2)
28
+ actionpack (= 8.0.5.2)
29
+ activejob (= 8.0.5.2)
30
+ activerecord (= 8.0.5.2)
31
+ activestorage (= 8.0.5.2)
32
+ activesupport (= 8.0.5.2)
33
33
  mail (>= 2.8.0)
34
- actionmailer (7.2.3.1)
35
- actionpack (= 7.2.3.1)
36
- actionview (= 7.2.3.1)
37
- activejob (= 7.2.3.1)
38
- activesupport (= 7.2.3.1)
34
+ actionmailer (8.0.5.2)
35
+ actionpack (= 8.0.5.2)
36
+ actionview (= 8.0.5.2)
37
+ activejob (= 8.0.5.2)
38
+ activesupport (= 8.0.5.2)
39
39
  mail (>= 2.8.0)
40
40
  rails-dom-testing (~> 2.2)
41
- actionpack (7.2.3.1)
42
- actionview (= 7.2.3.1)
43
- activesupport (= 7.2.3.1)
44
- cgi
41
+ actionpack (8.0.5.2)
42
+ actionview (= 8.0.5.2)
43
+ activesupport (= 8.0.5.2)
45
44
  nokogiri (>= 1.8.5)
46
- racc
47
- rack (>= 2.2.4, < 3.3)
45
+ rack (>= 2.2.4)
48
46
  rack-session (>= 1.0.1)
49
47
  rack-test (>= 0.6.3)
50
48
  rails-dom-testing (~> 2.2)
51
49
  rails-html-sanitizer (~> 1.6)
52
50
  useragent (~> 0.16)
53
- actiontext (7.2.3.1)
54
- actionpack (= 7.2.3.1)
55
- activerecord (= 7.2.3.1)
56
- activestorage (= 7.2.3.1)
57
- activesupport (= 7.2.3.1)
51
+ actiontext (8.0.5.2)
52
+ actionpack (= 8.0.5.2)
53
+ activerecord (= 8.0.5.2)
54
+ activestorage (= 8.0.5.2)
55
+ activesupport (= 8.0.5.2)
58
56
  globalid (>= 0.6.0)
59
57
  nokogiri (>= 1.8.5)
60
- actionview (7.2.3.1)
61
- activesupport (= 7.2.3.1)
58
+ actionview (8.0.5.2)
59
+ activesupport (= 8.0.5.2)
62
60
  builder (~> 3.1)
63
- cgi
64
61
  erubi (~> 1.11)
65
62
  rails-dom-testing (~> 2.2)
66
- rails-html-sanitizer (~> 1.6)
67
- activejob (7.2.3.1)
68
- activesupport (= 7.2.3.1)
63
+ rails-html-sanitizer (~> 1.6, >= 1.7.2)
64
+ activejob (8.0.5.2)
65
+ activesupport (= 8.0.5.2)
69
66
  globalid (>= 0.3.6)
70
- activemodel (7.2.3.1)
71
- activesupport (= 7.2.3.1)
72
- activerecord (7.2.3.1)
73
- activemodel (= 7.2.3.1)
74
- activesupport (= 7.2.3.1)
67
+ activemodel (8.0.5.2)
68
+ activesupport (= 8.0.5.2)
69
+ activerecord (8.0.5.2)
70
+ activemodel (= 8.0.5.2)
71
+ activesupport (= 8.0.5.2)
75
72
  timeout (>= 0.4.0)
76
- activestorage (7.2.3.1)
77
- actionpack (= 7.2.3.1)
78
- activejob (= 7.2.3.1)
79
- activerecord (= 7.2.3.1)
80
- activesupport (= 7.2.3.1)
73
+ activestorage (8.0.5.2)
74
+ actionpack (= 8.0.5.2)
75
+ activejob (= 8.0.5.2)
76
+ activerecord (= 8.0.5.2)
77
+ activesupport (= 8.0.5.2)
81
78
  marcel (~> 1.0)
82
- activesupport (7.2.3.1)
79
+ activesupport (8.0.5.2)
83
80
  base64
84
81
  benchmark (>= 0.3)
85
82
  bigdecimal
@@ -88,9 +85,10 @@ GEM
88
85
  drb
89
86
  i18n (>= 1.6, < 2)
90
87
  logger (>= 1.4.2)
91
- minitest (>= 5.1, < 6)
88
+ minitest (>= 5.1)
92
89
  securerandom (>= 0.3)
93
90
  tzinfo (~> 2.0, >= 2.0.5)
91
+ uri (>= 0.13.1)
94
92
  appraisal (2.5.0)
95
93
  bundler
96
94
  rake
@@ -98,22 +96,21 @@ GEM
98
96
  ast (2.4.3)
99
97
  base64 (0.3.0)
100
98
  benchmark (0.5.0)
101
- bigdecimal (4.1.1)
99
+ bigdecimal (4.1.3)
102
100
  builder (3.3.0)
103
- cgi (0.5.1)
104
101
  combustion (1.5.0)
105
102
  activesupport (>= 3.0.0)
106
103
  railties (>= 3.0.0)
107
104
  thor (>= 0.14.6)
108
- concurrent-ruby (1.3.6)
109
- connection_pool (3.0.2)
110
- crass (1.0.6)
105
+ concurrent-ruby (1.3.8)
106
+ connection_pool (3.0.3)
107
+ crass (1.0.8)
111
108
  csv (3.3.5)
112
109
  date (3.5.1)
113
110
  diff-lcs (1.6.2)
114
111
  docile (1.1.5)
115
112
  drb (2.2.3)
116
- erb (6.0.2)
113
+ erb (6.0.7)
117
114
  erubi (1.13.1)
118
115
  globalid (1.3.0)
119
116
  activesupport (>= 6.1)
@@ -137,57 +134,57 @@ GEM
137
134
  xml-simple (~> 1.1.9)
138
135
  lint_roller (1.1.0)
139
136
  logger (1.7.0)
140
- loofah (2.25.1)
137
+ loofah (2.25.3)
141
138
  crass (~> 1.0.2)
142
- nokogiri (>= 1.12.0)
143
- mail (2.9.0)
139
+ nokogiri (>= 1.19.5)
140
+ mail (2.9.1)
144
141
  logger
145
142
  mini_mime (>= 0.1.1)
146
143
  net-imap
147
144
  net-pop
148
145
  net-smtp
149
- marcel (1.1.0)
146
+ marcel (1.1.1)
150
147
  mini_mime (1.1.5)
151
148
  mini_portile2 (2.8.9)
152
149
  minitest (5.27.0)
153
150
  mysql2 (0.5.5)
154
- net-imap (0.6.3)
151
+ net-imap (0.6.8)
155
152
  date
156
153
  net-protocol
157
154
  net-pop (0.1.2)
158
155
  net-protocol
159
156
  net-protocol (0.2.2)
160
157
  timeout
161
- net-smtp (0.5.1)
158
+ net-smtp (0.5.2)
162
159
  net-protocol
163
160
  nio4r (2.7.5)
164
- nokogiri (1.19.2)
161
+ nokogiri (1.19.7)
165
162
  mini_portile2 (~> 2.8.2)
166
163
  racc (~> 1.4)
167
- nokogiri (1.19.2-aarch64-linux-gnu)
164
+ nokogiri (1.19.7-aarch64-linux-gnu)
168
165
  racc (~> 1.4)
169
- nokogiri (1.19.2-arm-linux-gnu)
166
+ nokogiri (1.19.7-arm-linux-gnu)
170
167
  racc (~> 1.4)
171
- nokogiri (1.19.2-arm64-darwin)
168
+ nokogiri (1.19.7-arm64-darwin)
172
169
  racc (~> 1.4)
173
- nokogiri (1.19.2-x86_64-darwin)
170
+ nokogiri (1.19.7-x86_64-darwin)
174
171
  racc (~> 1.4)
175
- nokogiri (1.19.2-x86_64-linux-gnu)
172
+ nokogiri (1.19.7-x86_64-linux-gnu)
176
173
  racc (~> 1.4)
177
174
  parallel (1.28.0)
178
175
  parser (3.3.11.1)
179
176
  ast (~> 2.4.1)
180
177
  racc
181
178
  power_assert (3.0.1)
182
- pp (0.6.3)
179
+ pp (0.6.4)
183
180
  prettyprint
184
- prettyprint (0.2.0)
181
+ prettyprint (0.2.1)
185
182
  prism (1.9.0)
186
183
  psych (5.3.1)
187
184
  date
188
185
  stringio
189
186
  racc (1.8.1)
190
- rack (3.2.6)
187
+ rack (3.2.9)
191
188
  rack-session (2.1.2)
192
189
  base64 (>= 0.1.0)
193
190
  rack (>= 3.0.0)
@@ -195,31 +192,30 @@ GEM
195
192
  rack (>= 1.3)
196
193
  rackup (2.3.1)
197
194
  rack (>= 3)
198
- rails (7.2.3.1)
199
- actioncable (= 7.2.3.1)
200
- actionmailbox (= 7.2.3.1)
201
- actionmailer (= 7.2.3.1)
202
- actionpack (= 7.2.3.1)
203
- actiontext (= 7.2.3.1)
204
- actionview (= 7.2.3.1)
205
- activejob (= 7.2.3.1)
206
- activemodel (= 7.2.3.1)
207
- activerecord (= 7.2.3.1)
208
- activestorage (= 7.2.3.1)
209
- activesupport (= 7.2.3.1)
195
+ rails (8.0.5.2)
196
+ actioncable (= 8.0.5.2)
197
+ actionmailbox (= 8.0.5.2)
198
+ actionmailer (= 8.0.5.2)
199
+ actionpack (= 8.0.5.2)
200
+ actiontext (= 8.0.5.2)
201
+ actionview (= 8.0.5.2)
202
+ activejob (= 8.0.5.2)
203
+ activemodel (= 8.0.5.2)
204
+ activerecord (= 8.0.5.2)
205
+ activestorage (= 8.0.5.2)
206
+ activesupport (= 8.0.5.2)
210
207
  bundler (>= 1.15.0)
211
- railties (= 7.2.3.1)
208
+ railties (= 8.0.5.2)
212
209
  rails-dom-testing (2.3.0)
213
210
  activesupport (>= 5.0.0)
214
211
  minitest
215
212
  nokogiri (>= 1.6)
216
- rails-html-sanitizer (1.7.0)
217
- loofah (~> 2.25)
213
+ rails-html-sanitizer (1.7.2)
214
+ loofah (~> 2.25, >= 2.25.3)
218
215
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
219
- railties (7.2.3.1)
220
- actionpack (= 7.2.3.1)
221
- activesupport (= 7.2.3.1)
222
- cgi
216
+ railties (8.0.5.2)
217
+ actionpack (= 8.0.5.2)
218
+ activesupport (= 8.0.5.2)
223
219
  irb (~> 1.13)
224
220
  rackup (>= 1.0.0)
225
221
  rake (>= 12.2)
@@ -249,36 +245,39 @@ GEM
249
245
  diff-lcs (>= 1.2.0, < 2.0)
250
246
  rspec-support (~> 3.13.0)
251
247
  rspec-support (3.13.7)
252
- rubocop (1.82.1)
253
- json (~> 2.3)
248
+ rubocop (1.93.0)
249
+ json (>= 2.3)
254
250
  language_server-protocol (~> 3.17.0.2)
255
251
  lint_roller (~> 1.1.0)
256
- parallel (~> 1.10)
252
+ parallel (>= 1.10)
257
253
  parser (>= 3.3.0.2)
258
254
  rainbow (>= 2.2.2, < 4.0)
259
- regexp_parser (>= 2.9.3, < 3.0)
260
- rubocop-ast (>= 1.48.0, < 2.0)
255
+ regexp_parser (>= 2.11.3, < 3.0)
256
+ rubocop-ast (>= 1.54.0, < 2.0)
261
257
  ruby-progressbar (~> 1.7)
262
258
  unicode-display_width (>= 2.4.0, < 4.0)
263
- rubocop-ast (1.49.1)
259
+ rubocop-ast (1.54.0)
260
+ ast (~> 2.4)
264
261
  parser (>= 3.3.7.2)
265
- prism (~> 1.7)
266
- rubocop-performance (1.26.1)
262
+ prism (>= 1.7)
263
+ racc
264
+ rubocop-performance (1.27.0)
267
265
  lint_roller (~> 1.1)
268
- rubocop (>= 1.75.0, < 2.0)
266
+ rubocop (>= 1.89.0, < 2.0)
269
267
  rubocop-ast (>= 1.47.1, < 2.0)
270
- rubocop-rails (2.34.3)
268
+ rubocop-rails (2.38.0)
271
269
  activesupport (>= 4.2.0)
272
270
  lint_roller (~> 1.1)
273
271
  rack (>= 1.1)
274
- rubocop (>= 1.75.0, < 2.0)
272
+ rubocop (>= 1.89.0, < 2.0)
275
273
  rubocop-ast (>= 1.44.0, < 2.0)
276
274
  rubocop-rake (0.7.1)
277
275
  lint_roller (~> 1.1)
278
276
  rubocop (>= 1.72.1)
279
- rubocop-rspec (3.9.0)
277
+ rubocop-rspec (3.10.2)
280
278
  lint_roller (~> 1.1)
281
- rubocop (~> 1.81)
279
+ regexp_parser (>= 2.0)
280
+ rubocop (~> 1.86, >= 1.86.2)
282
281
  ruby-progressbar (1.13.0)
283
282
  rubyzip (2.4.1)
284
283
  securerandom (0.4.1)
@@ -301,8 +300,9 @@ GEM
301
300
  unicode-display_width (3.2.0)
302
301
  unicode-emoji (~> 4.1)
303
302
  unicode-emoji (4.2.0)
303
+ uri (1.1.2)
304
304
  useragent (0.16.11)
305
- websocket-driver (0.8.0)
305
+ websocket-driver (0.8.2)
306
306
  base64
307
307
  websocket-extensions (>= 0.1.0)
308
308
  websocket-extensions (0.1.5)
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.1](https://github.com/powerhome/power-tools/compare/data_taster/v0.6.0...data_taster/v0.6.1) (2026-11-25)
4
+
5
+
6
+ ### Fixed
7
+
8
+ * **data-taster:** copy tables on the server when source and target share one ([#514](https://github.com/powerhome/power-tools/issues/514)) ([a55ff6d](https://github.com/powerhome/power-tools/commit/a55ff6de5d5b328c503053b18d452b940024a522))
9
+
3
10
  ## [0.6.0](https://github.com/powerhome/power-tools/compare/data_taster/v0.5.1...data_taster/v0.6.0) (2026-11-23)
4
11
 
5
12
 
data/docs/README.md CHANGED
@@ -65,6 +65,8 @@ DataTaster.sample!
65
65
 
66
66
  This selects data from the source and writes it, sanitized, to the output.
67
67
 
68
+ When a `DatabaseOutput` target is on the same MySQL server as the source, each table is copied on the server with `INSERT … SELECT` and then sanitized with `UPDATE`s, so DataTaster never holds a table's rows. The `SELECT` runs on the target connection, so a table a `select:` clause names without a database is read from the target, where the tables already copied are. Tables are copied in the order `SHOW TABLES` lists them, which is alphabetical, so such a table holds the sampled rows only if its name sorts before the table being copied. Name the source database (`<%= source_db %>.table`) to read the whole source table instead. Otherwise, the rows are read into memory and written back as sanitized `INSERT`s.
69
+
68
70
 
69
71
  #### Deprecating Tables
70
72
 
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: ../../rubocop-powerhome
3
3
  specs:
4
- rubocop-powerhome (0.8.0)
4
+ rubocop-powerhome (0.9.0)
5
5
  lint_roller (~> 1.1)
6
- rubocop (= 1.82.1)
6
+ rubocop (>= 1.82.1, < 2)
7
7
  rubocop-performance (>= 1.24)
8
- rubocop-rails (>= 2.28)
8
+ rubocop-rails (>= 2.35.5)
9
9
  rubocop-rake (>= 0.7)
10
10
  rubocop-rspec (>= 3.5)
11
11
 
12
12
  PATH
13
13
  remote: ..
14
14
  specs:
15
- data_taster (0.6.0)
15
+ data_taster (0.6.1)
16
16
  rails (>= 7.1.3.2, <= 8.2)
17
17
 
18
18
  GEM
@@ -151,6 +151,7 @@ GEM
151
151
  net-smtp
152
152
  marcel (1.1.0)
153
153
  mini_mime (1.1.5)
154
+ mini_portile2 (2.8.9)
154
155
  minitest (6.0.6)
155
156
  drb (~> 2.0)
156
157
  prism (~> 1.5)
@@ -166,6 +167,9 @@ GEM
166
167
  net-smtp (0.5.1)
167
168
  net-protocol
168
169
  nio4r (2.7.5)
170
+ nokogiri (1.19.3)
171
+ mini_portile2 (~> 2.8.2)
172
+ racc (~> 1.4)
169
173
  nokogiri (1.19.3-aarch64-linux-gnu)
170
174
  racc (~> 1.4)
171
175
  nokogiri (1.19.3-aarch64-linux-musl)
@@ -263,36 +267,39 @@ GEM
263
267
  rspec-mocks (~> 3.13)
264
268
  rspec-support (~> 3.13)
265
269
  rspec-support (3.13.7)
266
- rubocop (1.82.1)
267
- json (~> 2.3)
270
+ rubocop (1.93.0)
271
+ json (>= 2.3)
268
272
  language_server-protocol (~> 3.17.0.2)
269
273
  lint_roller (~> 1.1.0)
270
- parallel (~> 1.10)
274
+ parallel (>= 1.10)
271
275
  parser (>= 3.3.0.2)
272
276
  rainbow (>= 2.2.2, < 4.0)
273
- regexp_parser (>= 2.9.3, < 3.0)
274
- rubocop-ast (>= 1.48.0, < 2.0)
277
+ regexp_parser (>= 2.11.3, < 3.0)
278
+ rubocop-ast (>= 1.54.0, < 2.0)
275
279
  ruby-progressbar (~> 1.7)
276
280
  unicode-display_width (>= 2.4.0, < 4.0)
277
- rubocop-ast (1.49.1)
281
+ rubocop-ast (1.54.0)
282
+ ast (~> 2.4)
278
283
  parser (>= 3.3.7.2)
279
- prism (~> 1.7)
280
- rubocop-performance (1.26.1)
284
+ prism (>= 1.7)
285
+ racc
286
+ rubocop-performance (1.27.0)
281
287
  lint_roller (~> 1.1)
282
- rubocop (>= 1.75.0, < 2.0)
288
+ rubocop (>= 1.89.0, < 2.0)
283
289
  rubocop-ast (>= 1.47.1, < 2.0)
284
- rubocop-rails (2.34.3)
290
+ rubocop-rails (2.38.0)
285
291
  activesupport (>= 4.2.0)
286
292
  lint_roller (~> 1.1)
287
293
  rack (>= 1.1)
288
- rubocop (>= 1.75.0, < 2.0)
294
+ rubocop (>= 1.89.0, < 2.0)
289
295
  rubocop-ast (>= 1.44.0, < 2.0)
290
296
  rubocop-rake (0.7.1)
291
297
  lint_roller (~> 1.1)
292
298
  rubocop (>= 1.72.1)
293
- rubocop-rspec (3.9.0)
299
+ rubocop-rspec (3.10.2)
294
300
  lint_roller (~> 1.1)
295
- rubocop (~> 1.81)
301
+ regexp_parser (>= 2.0)
302
+ rubocop (~> 1.86, >= 1.86.2)
296
303
  ruby-progressbar (1.13.0)
297
304
  rubyzip (2.4.1)
298
305
  securerandom (0.4.1)
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: ../../rubocop-powerhome
3
3
  specs:
4
- rubocop-powerhome (0.8.0)
4
+ rubocop-powerhome (0.9.0)
5
5
  lint_roller (~> 1.1)
6
- rubocop (= 1.82.1)
6
+ rubocop (>= 1.82.1, < 2)
7
7
  rubocop-performance (>= 1.24)
8
- rubocop-rails (>= 2.28)
8
+ rubocop-rails (>= 2.35.5)
9
9
  rubocop-rake (>= 0.7)
10
10
  rubocop-rspec (>= 3.5)
11
11
 
12
12
  PATH
13
13
  remote: ..
14
14
  specs:
15
- data_taster (0.6.0)
15
+ data_taster (0.6.1)
16
16
  rails (>= 7.1.3.2, <= 8.2)
17
17
 
18
18
  GEM
@@ -145,6 +145,7 @@ GEM
145
145
  net-smtp
146
146
  marcel (1.1.0)
147
147
  mini_mime (1.1.5)
148
+ mini_portile2 (2.8.9)
148
149
  minitest (6.0.6)
149
150
  drb (~> 2.0)
150
151
  prism (~> 1.5)
@@ -159,6 +160,9 @@ GEM
159
160
  net-smtp (0.5.1)
160
161
  net-protocol
161
162
  nio4r (2.7.5)
163
+ nokogiri (1.19.3)
164
+ mini_portile2 (~> 2.8.2)
165
+ racc (~> 1.4)
162
166
  nokogiri (1.19.3-aarch64-linux-gnu)
163
167
  racc (~> 1.4)
164
168
  nokogiri (1.19.3-aarch64-linux-musl)
@@ -256,36 +260,39 @@ GEM
256
260
  rspec-mocks (>= 3.13.0, < 5.0.0)
257
261
  rspec-support (>= 3.13.0, < 5.0.0)
258
262
  rspec-support (3.13.7)
259
- rubocop (1.82.1)
260
- json (~> 2.3)
263
+ rubocop (1.93.0)
264
+ json (>= 2.3)
261
265
  language_server-protocol (~> 3.17.0.2)
262
266
  lint_roller (~> 1.1.0)
263
- parallel (~> 1.10)
267
+ parallel (>= 1.10)
264
268
  parser (>= 3.3.0.2)
265
269
  rainbow (>= 2.2.2, < 4.0)
266
- regexp_parser (>= 2.9.3, < 3.0)
267
- rubocop-ast (>= 1.48.0, < 2.0)
270
+ regexp_parser (>= 2.11.3, < 3.0)
271
+ rubocop-ast (>= 1.54.0, < 2.0)
268
272
  ruby-progressbar (~> 1.7)
269
273
  unicode-display_width (>= 2.4.0, < 4.0)
270
- rubocop-ast (1.49.1)
274
+ rubocop-ast (1.54.0)
275
+ ast (~> 2.4)
271
276
  parser (>= 3.3.7.2)
272
- prism (~> 1.7)
273
- rubocop-performance (1.26.1)
277
+ prism (>= 1.7)
278
+ racc
279
+ rubocop-performance (1.27.0)
274
280
  lint_roller (~> 1.1)
275
- rubocop (>= 1.75.0, < 2.0)
281
+ rubocop (>= 1.89.0, < 2.0)
276
282
  rubocop-ast (>= 1.47.1, < 2.0)
277
- rubocop-rails (2.34.3)
283
+ rubocop-rails (2.38.0)
278
284
  activesupport (>= 4.2.0)
279
285
  lint_roller (~> 1.1)
280
286
  rack (>= 1.1)
281
- rubocop (>= 1.75.0, < 2.0)
287
+ rubocop (>= 1.89.0, < 2.0)
282
288
  rubocop-ast (>= 1.44.0, < 2.0)
283
289
  rubocop-rake (0.7.1)
284
290
  lint_roller (~> 1.1)
285
291
  rubocop (>= 1.72.1)
286
- rubocop-rspec (3.9.0)
292
+ rubocop-rspec (3.10.2)
287
293
  lint_roller (~> 1.1)
288
- rubocop (~> 1.81)
294
+ regexp_parser (>= 2.0)
295
+ rubocop (~> 1.86, >= 1.86.2)
289
296
  ruby-progressbar (1.13.0)
290
297
  rubyzip (2.4.1)
291
298
  securerandom (0.4.1)
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: ../../rubocop-powerhome
3
3
  specs:
4
- rubocop-powerhome (0.8.0)
4
+ rubocop-powerhome (0.9.0)
5
5
  lint_roller (~> 1.1)
6
- rubocop (= 1.82.1)
6
+ rubocop (>= 1.82.1, < 2)
7
7
  rubocop-performance (>= 1.24)
8
- rubocop-rails (>= 2.28)
8
+ rubocop-rails (>= 2.35.5)
9
9
  rubocop-rake (>= 0.7)
10
10
  rubocop-rspec (>= 3.5)
11
11
 
12
12
  PATH
13
13
  remote: ..
14
14
  specs:
15
- data_taster (0.6.0)
15
+ data_taster (0.6.1)
16
16
  rails (>= 7.1.3.2, <= 8.2)
17
17
 
18
18
  GEM
@@ -145,6 +145,7 @@ GEM
145
145
  net-smtp
146
146
  marcel (1.1.0)
147
147
  mini_mime (1.1.5)
148
+ mini_portile2 (2.8.9)
148
149
  minitest (6.0.6)
149
150
  drb (~> 2.0)
150
151
  prism (~> 1.5)
@@ -159,6 +160,9 @@ GEM
159
160
  net-smtp (0.5.1)
160
161
  net-protocol
161
162
  nio4r (2.7.5)
163
+ nokogiri (1.19.3)
164
+ mini_portile2 (~> 2.8.2)
165
+ racc (~> 1.4)
162
166
  nokogiri (1.19.3-aarch64-linux-gnu)
163
167
  racc (~> 1.4)
164
168
  nokogiri (1.19.3-aarch64-linux-musl)
@@ -249,36 +253,39 @@ GEM
249
253
  diff-lcs (>= 1.2.0, < 2.0)
250
254
  rspec-support (~> 3.13.0)
251
255
  rspec-support (3.13.7)
252
- rubocop (1.82.1)
253
- json (~> 2.3)
256
+ rubocop (1.93.0)
257
+ json (>= 2.3)
254
258
  language_server-protocol (~> 3.17.0.2)
255
259
  lint_roller (~> 1.1.0)
256
- parallel (~> 1.10)
260
+ parallel (>= 1.10)
257
261
  parser (>= 3.3.0.2)
258
262
  rainbow (>= 2.2.2, < 4.0)
259
- regexp_parser (>= 2.9.3, < 3.0)
260
- rubocop-ast (>= 1.48.0, < 2.0)
263
+ regexp_parser (>= 2.11.3, < 3.0)
264
+ rubocop-ast (>= 1.54.0, < 2.0)
261
265
  ruby-progressbar (~> 1.7)
262
266
  unicode-display_width (>= 2.4.0, < 4.0)
263
- rubocop-ast (1.49.1)
267
+ rubocop-ast (1.54.0)
268
+ ast (~> 2.4)
264
269
  parser (>= 3.3.7.2)
265
- prism (~> 1.7)
266
- rubocop-performance (1.26.1)
270
+ prism (>= 1.7)
271
+ racc
272
+ rubocop-performance (1.27.0)
267
273
  lint_roller (~> 1.1)
268
- rubocop (>= 1.75.0, < 2.0)
274
+ rubocop (>= 1.89.0, < 2.0)
269
275
  rubocop-ast (>= 1.47.1, < 2.0)
270
- rubocop-rails (2.35.0)
276
+ rubocop-rails (2.38.0)
271
277
  activesupport (>= 4.2.0)
272
278
  lint_roller (~> 1.1)
273
279
  rack (>= 1.1)
274
- rubocop (>= 1.75.0, < 2.0)
280
+ rubocop (>= 1.89.0, < 2.0)
275
281
  rubocop-ast (>= 1.44.0, < 2.0)
276
282
  rubocop-rake (0.7.1)
277
283
  lint_roller (~> 1.1)
278
284
  rubocop (>= 1.72.1)
279
- rubocop-rspec (3.9.0)
285
+ rubocop-rspec (3.10.2)
280
286
  lint_roller (~> 1.1)
281
- rubocop (~> 1.81)
287
+ regexp_parser (>= 2.0)
288
+ rubocop (~> 1.86, >= 1.86.2)
282
289
  ruby-progressbar (1.13.0)
283
290
  rubyzip (2.4.1)
284
291
  securerandom (0.4.1)
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: ../../rubocop-powerhome
3
3
  specs:
4
- rubocop-powerhome (0.8.0)
4
+ rubocop-powerhome (0.9.0)
5
5
  lint_roller (~> 1.1)
6
- rubocop (= 1.82.1)
6
+ rubocop (>= 1.82.1, < 2)
7
7
  rubocop-performance (>= 1.24)
8
- rubocop-rails (>= 2.28)
8
+ rubocop-rails (>= 2.35.5)
9
9
  rubocop-rake (>= 0.7)
10
10
  rubocop-rspec (>= 3.5)
11
11
 
12
12
  PATH
13
13
  remote: ..
14
14
  specs:
15
- data_taster (0.6.0)
15
+ data_taster (0.6.1)
16
16
  rails (>= 7.1.3.2, <= 8.2)
17
17
 
18
18
  GEM
@@ -147,6 +147,7 @@ GEM
147
147
  net-smtp
148
148
  marcel (1.1.0)
149
149
  mini_mime (1.1.5)
150
+ mini_portile2 (2.8.9)
150
151
  minitest (6.0.6)
151
152
  drb (~> 2.0)
152
153
  prism (~> 1.5)
@@ -161,6 +162,9 @@ GEM
161
162
  net-smtp (0.5.1)
162
163
  net-protocol
163
164
  nio4r (2.7.5)
165
+ nokogiri (1.19.3)
166
+ mini_portile2 (~> 2.8.2)
167
+ racc (~> 1.4)
164
168
  nokogiri (1.19.3-aarch64-linux-gnu)
165
169
  racc (~> 1.4)
166
170
  nokogiri (1.19.3-aarch64-linux-musl)
@@ -251,36 +255,39 @@ GEM
251
255
  diff-lcs (>= 1.2.0, < 2.0)
252
256
  rspec-support (~> 3.13.0)
253
257
  rspec-support (3.13.7)
254
- rubocop (1.82.1)
255
- json (~> 2.3)
258
+ rubocop (1.93.0)
259
+ json (>= 2.3)
256
260
  language_server-protocol (~> 3.17.0.2)
257
261
  lint_roller (~> 1.1.0)
258
- parallel (~> 1.10)
262
+ parallel (>= 1.10)
259
263
  parser (>= 3.3.0.2)
260
264
  rainbow (>= 2.2.2, < 4.0)
261
- regexp_parser (>= 2.9.3, < 3.0)
262
- rubocop-ast (>= 1.48.0, < 2.0)
265
+ regexp_parser (>= 2.11.3, < 3.0)
266
+ rubocop-ast (>= 1.54.0, < 2.0)
263
267
  ruby-progressbar (~> 1.7)
264
268
  unicode-display_width (>= 2.4.0, < 4.0)
265
- rubocop-ast (1.49.1)
269
+ rubocop-ast (1.54.0)
270
+ ast (~> 2.4)
266
271
  parser (>= 3.3.7.2)
267
- prism (~> 1.7)
268
- rubocop-performance (1.26.1)
272
+ prism (>= 1.7)
273
+ racc
274
+ rubocop-performance (1.27.0)
269
275
  lint_roller (~> 1.1)
270
- rubocop (>= 1.75.0, < 2.0)
276
+ rubocop (>= 1.89.0, < 2.0)
271
277
  rubocop-ast (>= 1.47.1, < 2.0)
272
- rubocop-rails (2.35.0)
278
+ rubocop-rails (2.38.0)
273
279
  activesupport (>= 4.2.0)
274
280
  lint_roller (~> 1.1)
275
281
  rack (>= 1.1)
276
- rubocop (>= 1.75.0, < 2.0)
282
+ rubocop (>= 1.89.0, < 2.0)
277
283
  rubocop-ast (>= 1.44.0, < 2.0)
278
284
  rubocop-rake (0.7.1)
279
285
  lint_roller (~> 1.1)
280
286
  rubocop (>= 1.72.1)
281
- rubocop-rspec (3.9.0)
287
+ rubocop-rspec (3.10.2)
282
288
  lint_roller (~> 1.1)
283
- rubocop (~> 1.81)
289
+ regexp_parser (>= 2.0)
290
+ rubocop (~> 1.86, >= 1.86.2)
284
291
  ruby-progressbar (1.13.0)
285
292
  rubyzip (2.4.1)
286
293
  securerandom (0.4.1)
@@ -47,6 +47,19 @@ module DataTaster
47
47
  write_statement(line)
48
48
  end
49
49
 
50
+ # When the source and target share a MySQL server, MySQL copies each table itself and DataTaster never holds its
51
+ # rows. Otherwise every row is read into memory and written back as INSERTs, and a large table can use more memory
52
+ # than the process has.
53
+ def copies_on_server?
54
+ source_client = DataTaster.config.source.source_client
55
+ # Checked once per source, since a later DataTaster.setup can pair this output with another source
56
+ return @copies_on_server if @checked_source.equal?(source_client)
57
+
58
+ target_server = server_uuid(target_client)
59
+ @checked_source = source_client
60
+ @copies_on_server = target_server.present? && target_server == server_uuid(source_client)
61
+ end
62
+
50
63
  private
51
64
 
52
65
  def safe_execute(sql)
@@ -64,8 +77,35 @@ module DataTaster
64
77
  source.table_names
65
78
  end
66
79
 
80
+ def server_uuid(client)
81
+ client.query("SELECT @@server_uuid AS server_uuid").first&.fetch("server_uuid", nil)
82
+ rescue
83
+ nil
84
+ end
85
+
67
86
  def export(collection, table_name, payload)
68
87
  write_statement("TRUNCATE TABLE #{qualified_table_name(table_name)}")
88
+ if copies_on_server?
89
+ copy_on_server(collection, table_name, payload)
90
+ else
91
+ export_through_client(collection, table_name, payload)
92
+ end
93
+ end
94
+
95
+ # The SELECT runs on the target connection, so a table its WHERE clause names without a database is read from the
96
+ # target: the rows already copied there, not the whole source table. The rows are copied as they are and sanitized
97
+ # afterwards, so a failed sanitization empties the table rather than leave production values in it.
98
+ def copy_on_server(collection, table_name, payload)
99
+ write_statement("INSERT INTO #{qualified_table_name(table_name)} #{collection.export_select_sql}")
100
+ begin
101
+ Sanitizer.new(table_name, payload[:sanitize]).clean!
102
+ rescue
103
+ write_statement("TRUNCATE TABLE #{qualified_table_name(table_name)}")
104
+ raise
105
+ end
106
+ end
107
+
108
+ def export_through_client(collection, table_name, payload)
69
109
  insert_table_name = "#{ExportContext.quote_ident(target_database)}.#{ExportContext.quote_ident(table_name)}"
70
110
  Sanitizer.new(table_name, payload[:sanitize]).export_sanitized_rows(
71
111
  collection,
@@ -26,7 +26,7 @@ module DataTaster
26
26
  end
27
27
 
28
28
  def export_select_sql
29
- <<-SQL.squish
29
+ <<~SQL.squish
30
30
  SELECT * FROM #{source_db}.#{table_name}
31
31
  WHERE #{where_clause}
32
32
  SQL
@@ -83,7 +83,7 @@ module DataTaster
83
83
  end
84
84
 
85
85
  def sql_for_uncast_value
86
- <<-SQL.squish
86
+ <<~SQL.squish
87
87
  UPDATE #{qualified_table_name}
88
88
  SET #{column_name} = #{value}
89
89
  WHERE #{column_name} IS NOT NULL
@@ -92,7 +92,7 @@ module DataTaster
92
92
  end
93
93
 
94
94
  def sql_for_date_value
95
- <<-SQL.squish
95
+ <<~SQL.squish
96
96
  UPDATE #{qualified_table_name}
97
97
  SET #{column_name} = '#{value}'
98
98
  WHERE #{column_name} IS NOT NULL
@@ -100,7 +100,7 @@ module DataTaster
100
100
  end
101
101
 
102
102
  def sql_for_nil_value
103
- <<-SQL.squish
103
+ <<~SQL.squish
104
104
  UPDATE #{qualified_table_name}
105
105
  SET #{column_name} = NULL
106
106
  WHERE #{column_name} IS NOT NULL
@@ -108,14 +108,20 @@ module DataTaster
108
108
  end
109
109
 
110
110
  def sql_for_cast_value
111
- <<-SQL.squish
111
+ <<~SQL.squish
112
112
  UPDATE #{qualified_table_name}
113
- SET #{column_name} = '#{value}'
113
+ SET #{column_name} = #{string_literal(value)}
114
114
  WHERE #{column_name} IS NOT NULL
115
115
  AND #{column_name} <> ''
116
116
  SQL
117
117
  end
118
118
 
119
+ # A quote or backslash in a configured value would otherwise end the literal early and break the UPDATE
120
+ def string_literal(string)
121
+ escaped = string.to_s.gsub("\\") { "\\\\" }.gsub("'", "''")
122
+ "'#{escaped}'"
123
+ end
124
+
119
125
  def qualified_table_name
120
126
  DataTaster.config.output.qualified_table_name(table_name)
121
127
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DataTaster
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_taster
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
  - Jill Klang