purview 1.0.0.alpha → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -4
- data/Gemfile +10 -0
- data/README.md +2 -2
- data/TODO +10 -5
- data/lib/purview/columns/base.rb +2 -2
- data/lib/purview/columns.rb +1 -0
- data/lib/purview/connections/base.rb +17 -31
- data/lib/purview/connections/mysql.rb +2 -30
- data/lib/purview/connections/postgresql.rb +2 -18
- data/lib/purview/databases/base.rb +32 -31
- data/lib/purview/databases/mysql.rb +4 -16
- data/lib/purview/databases/postgresql.rb +4 -16
- data/lib/purview/databases.rb +1 -0
- data/lib/purview/dialects/base.rb +25 -0
- data/lib/purview/dialects/mysql.rb +25 -0
- data/lib/purview/dialects/postgresql.rb +25 -0
- data/lib/purview/dialects.rb +4 -0
- data/lib/purview/exceptions/{table.rb → base_table.rb} +1 -1
- data/lib/purview/exceptions/could_not_acquire_lock.rb +1 -1
- data/lib/purview/exceptions/lock_already_released.rb +1 -1
- data/lib/purview/exceptions/no_window.rb +1 -1
- data/lib/purview/exceptions.rb +2 -1
- data/lib/purview/loaders/base.rb +26 -2
- data/lib/purview/loaders/mysql.rb +4 -0
- data/lib/purview/loaders/postgresql.rb +4 -0
- data/lib/purview/loaders.rb +1 -0
- data/lib/purview/loggers.rb +1 -0
- data/lib/purview/mixins/connection.rb +13 -0
- data/lib/purview/mixins/helpers.rb +5 -1
- data/lib/purview/mixins/logger.rb +2 -2
- data/lib/purview/mixins.rb +1 -0
- data/lib/purview/parsers/base.rb +7 -11
- data/lib/purview/parsers/csv.rb +19 -3
- data/lib/purview/parsers/sql.rb +13 -0
- data/lib/purview/parsers.rb +2 -0
- data/lib/purview/pullers/base.rb +4 -0
- data/lib/purview/pullers/base_sql.rb +97 -0
- data/lib/purview/pullers/mysql.rb +15 -0
- data/lib/purview/pullers/postgresql.rb +15 -0
- data/lib/purview/pullers.rb +4 -0
- data/lib/purview/raw_connections/base.rb +118 -0
- data/lib/purview/raw_connections/jdbc/base.rb +65 -0
- data/lib/purview/raw_connections/jdbc/mysql.rb +19 -0
- data/lib/purview/raw_connections/jdbc/postgres.rb +19 -0
- data/lib/purview/raw_connections/jdbc.rb +4 -0
- data/lib/purview/raw_connections/mysql2.rb +35 -0
- data/lib/purview/raw_connections/pg.rb +35 -0
- data/lib/purview/raw_connections.rb +8 -0
- data/lib/purview/refinements/object.rb +4 -0
- data/lib/purview/refinements/string.rb +5 -0
- data/lib/purview/refinements.rb +1 -0
- data/lib/purview/structs/base.rb +12 -2
- data/lib/purview/structs/row.rb +7 -0
- data/lib/purview/structs.rb +2 -0
- data/lib/purview/tables/base.rb +1 -1
- data/lib/purview/types.rb +1 -0
- data/lib/purview/version.rb +1 -1
- data/lib/purview.rb +3 -3
- data/purview.gemspec +2 -2
- metadata +25 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48f684f51dd0c4ff6b947959f5c1a3c2eb9489d9
|
4
|
+
data.tar.gz: 832f24cb3904d7fb527b5cabc36d75f488b494ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d78891cc67a18657720290c7bf5cfb8c41259b7a574eb23b0e6160c987a43cfbe513948ca0d35b3df8c4372fce790c9cb64986a83596ba1ecfad825998eb17
|
7
|
+
data.tar.gz: 9e4004abc1d287912deaabb8634589db52ea15fbaf6c561609e7f058a8966cbc6fdc778e48abd3780b00a17451683b8f13a471b9818cfbddf54a263d6f3b4d9d
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -61,7 +61,7 @@ columns = [
|
|
61
61
|
]
|
62
62
|
```
|
63
63
|
|
64
|
-
Configure the `Puller` (available puller-types: `URI`)
|
64
|
+
Configure the `Puller` (available puller-types: `MySQL`, `PostgreSQL` & `URI`)
|
65
65
|
```ruby
|
66
66
|
puller_opts = {
|
67
67
|
:type => Purview::Pullers::URI,
|
@@ -69,7 +69,7 @@ puller_opts = {
|
|
69
69
|
}
|
70
70
|
```
|
71
71
|
|
72
|
-
Configure the `Parser` (available parser-types: `CSV` & `TSV`)
|
72
|
+
Configure the `Parser` (available parser-types: `CSV`, `SQL` & `TSV`)
|
73
73
|
```ruby
|
74
74
|
parser_opts = {
|
75
75
|
:type => Purview::Parsers::TSV,
|
data/TODO
CHANGED
@@ -40,6 +40,10 @@
|
|
40
40
|
* Finish PostgreSQL support (requires `pg` gem)
|
41
41
|
* Finish MySQL support (requires `mysql2` gem)
|
42
42
|
* Usage/configuration examples in README.md
|
43
|
+
* Create SQL-puller(s)
|
44
|
+
* Introduce [SQL] dialect(s)
|
45
|
+
* Fix JRuby bundle/build
|
46
|
+
* Fall back to logged in user if no [database-]username is provided
|
43
47
|
|
44
48
|
... ONGOING TASKS ...
|
45
49
|
|
@@ -49,16 +53,17 @@
|
|
49
53
|
|
50
54
|
... OPEN TASKS ....
|
51
55
|
|
52
|
-
*
|
56
|
+
* Add COPY `def copy(sql)` support to PostgreSQL connection
|
57
|
+
* Leverage COPY support for PostgreSQL pulls
|
58
|
+
* Create class to encapulate `table_metadata` logic
|
59
|
+
* Further encapsulate `Dialect` logic
|
53
60
|
* Build out change-log tables
|
54
61
|
* Build out canonical, fact and aggregate tables (and related transforms)
|
55
62
|
* Configurable re-pull window (do this automatically once up to current?)
|
56
63
|
* Add schema management capabilities (detect schema-deltas and suggestion
|
57
64
|
modifications)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
* Fix JRuby bundle/build
|
65
|
+
* Refactor mutator methods to be globally available (e.g. coalesced -> Coalesce,
|
66
|
+
quoted -> Quote, etc.)
|
62
67
|
|
63
68
|
... CLOSED QUESTIONS ...
|
64
69
|
|
data/lib/purview/columns/base.rb
CHANGED
@@ -25,7 +25,7 @@ module Purview
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def nullable
|
28
|
-
|
28
|
+
coalesced(opts[:nullable], true)
|
29
29
|
end
|
30
30
|
|
31
31
|
def nullable?
|
@@ -48,7 +48,7 @@ module Purview
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def type
|
51
|
-
|
51
|
+
coalesced(opts[:type], Purview::Types::String)
|
52
52
|
end
|
53
53
|
|
54
54
|
private
|
data/lib/purview/columns.rb
CHANGED
@@ -1,54 +1,40 @@
|
|
1
1
|
module Purview
|
2
2
|
module Connections
|
3
3
|
class Base
|
4
|
-
def
|
5
|
-
|
4
|
+
def self.connect(opts)
|
5
|
+
new(opts)
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
|
10
|
-
|
8
|
+
def self.with_new_connection(opts)
|
9
|
+
yield connection = connect(opts)
|
10
|
+
ensure
|
11
|
+
connection.disconnect if connection
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(opts)
|
15
|
+
@raw_connection = raw_connection_type.connect(opts)
|
11
16
|
end
|
12
17
|
|
13
18
|
def disconnect
|
14
|
-
|
15
|
-
@
|
19
|
+
raw_connection.disconnect
|
20
|
+
@raw_connection = nil
|
16
21
|
self
|
17
22
|
end
|
18
23
|
|
19
24
|
def execute(sql)
|
20
|
-
|
21
|
-
result = execute_sql(sql)
|
22
|
-
Purview::Structs::Result.new(
|
23
|
-
:rows => extract_rows(result),
|
24
|
-
:rows_affected => extract_rows_affected(result)
|
25
|
-
)
|
25
|
+
raw_connection.execute(sql)
|
26
26
|
end
|
27
27
|
|
28
28
|
def with_transaction
|
29
|
-
|
29
|
+
raw_connection.with_transaction { yield }
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
attr_reader :opts, :connection
|
37
|
-
|
38
|
-
def execute_sql(sql)
|
39
|
-
raise %{All "#{Base}(s)" must override the "execute_sql" method}
|
40
|
-
end
|
41
|
-
|
42
|
-
def extract_rows(result)
|
43
|
-
raise %{All "#{Base}(s)" must override the "extract_rows" method}
|
44
|
-
end
|
45
|
-
|
46
|
-
def extract_rows_affected(result)
|
47
|
-
raise %{All "#{Base}(s)" must override the "extract_rows_affected" method}
|
48
|
-
end
|
34
|
+
attr_reader :raw_connection
|
49
35
|
|
50
|
-
def
|
51
|
-
raise %{All "#{Base}(s)" must override the "
|
36
|
+
def raw_connection_type
|
37
|
+
raise %{All "#{Base}(s)" must override the "raw_connection_type" method}
|
52
38
|
end
|
53
39
|
end
|
54
40
|
end
|
@@ -1,38 +1,10 @@
|
|
1
1
|
module Purview
|
2
2
|
module Connections
|
3
3
|
class MySQL < Base
|
4
|
-
def with_transaction
|
5
|
-
connection.query(BEGIN_TRANSACTION)
|
6
|
-
yield.tap { |result| connection.query(COMMIT_TRANSACTION) }
|
7
|
-
rescue Mysql2::Error
|
8
|
-
connection.query(ROLLBACK_TRANSACTION)
|
9
|
-
raise
|
10
|
-
end
|
11
|
-
|
12
4
|
private
|
13
5
|
|
14
|
-
|
15
|
-
|
16
|
-
ROLLBACK_TRANSACTION = 'ROLLBACK'
|
17
|
-
|
18
|
-
def execute_sql(sql)
|
19
|
-
connection.query(sql, query_opts)
|
20
|
-
end
|
21
|
-
|
22
|
-
def extract_rows(result)
|
23
|
-
result && result.to_a
|
24
|
-
end
|
25
|
-
|
26
|
-
def extract_rows_affected(result)
|
27
|
-
connection.affected_rows
|
28
|
-
end
|
29
|
-
|
30
|
-
def new_connection
|
31
|
-
Mysql2::Client.new(opts)
|
32
|
-
end
|
33
|
-
|
34
|
-
def query_opts
|
35
|
-
{ :cast => false }
|
6
|
+
def raw_connection_type
|
7
|
+
Purview::RawConnections::MySQL
|
36
8
|
end
|
37
9
|
end
|
38
10
|
end
|
@@ -1,26 +1,10 @@
|
|
1
1
|
module Purview
|
2
2
|
module Connections
|
3
3
|
class PostgreSQL < Base
|
4
|
-
def with_transaction
|
5
|
-
connection.transaction { yield }
|
6
|
-
end
|
7
|
-
|
8
4
|
private
|
9
5
|
|
10
|
-
def
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
def extract_rows(result)
|
15
|
-
result && result.to_a
|
16
|
-
end
|
17
|
-
|
18
|
-
def extract_rows_affected(result)
|
19
|
-
result && result.cmd_tuples
|
20
|
-
end
|
21
|
-
|
22
|
-
def new_connection
|
23
|
-
PG.connect(opts)
|
6
|
+
def raw_connection_type
|
7
|
+
Purview::RawConnections::PostgreSQL
|
24
8
|
end
|
25
9
|
end
|
26
10
|
end
|
@@ -13,10 +13,6 @@ module Purview
|
|
13
13
|
@tables << table
|
14
14
|
end
|
15
15
|
|
16
|
-
def connect
|
17
|
-
connection.connect
|
18
|
-
end
|
19
|
-
|
20
16
|
def create_index(connection, table, columns, opts={})
|
21
17
|
table_opts = extract_table_options(opts)
|
22
18
|
table_name = table_name(table, table_opts)
|
@@ -142,10 +138,6 @@ module Purview
|
|
142
138
|
end
|
143
139
|
end
|
144
140
|
|
145
|
-
def false_value
|
146
|
-
raise %{All "#{Base}(s)" must override the "false_value" method}
|
147
|
-
end
|
148
|
-
|
149
141
|
def lock_table(table, timestamp)
|
150
142
|
with_context_logging("`lock_table` for: #{table_name(table)}") do
|
151
143
|
with_new_connection do |connection|
|
@@ -157,14 +149,6 @@ module Purview
|
|
157
149
|
end
|
158
150
|
end
|
159
151
|
|
160
|
-
def null_value
|
161
|
-
raise %{All "#{Base}(s)" must override the "null_value" method}
|
162
|
-
end
|
163
|
-
|
164
|
-
def quoted(value)
|
165
|
-
value.nil? ? null_value : value.quoted
|
166
|
-
end
|
167
|
-
|
168
152
|
def sync
|
169
153
|
with_new_connection do |connection|
|
170
154
|
with_transaction(connection) do |timestamp|
|
@@ -183,10 +167,6 @@ module Purview
|
|
183
167
|
end
|
184
168
|
end
|
185
169
|
|
186
|
-
def true_value
|
187
|
-
raise %{All "#{Base}(s)" must override the "true_value" method}
|
188
|
-
end
|
189
|
-
|
190
170
|
def unlock_table(table)
|
191
171
|
with_context_logging("`unlock_table` for: #{table_name(table)}") do
|
192
172
|
with_new_connection do |connection|
|
@@ -200,11 +180,14 @@ module Purview
|
|
200
180
|
|
201
181
|
private
|
202
182
|
|
183
|
+
include Purview::Mixins::Connection
|
203
184
|
include Purview::Mixins::Helpers
|
204
185
|
include Purview::Mixins::Logger
|
205
186
|
|
206
187
|
attr_reader :opts, :tables
|
207
188
|
|
189
|
+
public :connect
|
190
|
+
|
208
191
|
def column_names(columns)
|
209
192
|
columns.map(&:name)
|
210
193
|
end
|
@@ -235,12 +218,8 @@ module Purview
|
|
235
218
|
end
|
236
219
|
end
|
237
220
|
|
238
|
-
def connection
|
239
|
-
connection_type.new(connection_opts)
|
240
|
-
end
|
241
|
-
|
242
221
|
def connection_opts
|
243
|
-
{}
|
222
|
+
{ :database => name }
|
244
223
|
end
|
245
224
|
|
246
225
|
def connection_type
|
@@ -267,6 +246,14 @@ module Purview
|
|
267
246
|
{}
|
268
247
|
end
|
269
248
|
|
249
|
+
def dialect
|
250
|
+
dialect_type.new
|
251
|
+
end
|
252
|
+
|
253
|
+
def dialect_type
|
254
|
+
raise %{All "#{Base}(s)" must override the "dialect_type" method}
|
255
|
+
end
|
256
|
+
|
270
257
|
def drop_index_sql(table_name, index_name, table, columns, index_opts={})
|
271
258
|
raise %{All "#{Base}(s)" must override the "drop_index_sql" method}
|
272
259
|
end
|
@@ -305,6 +292,10 @@ module Purview
|
|
305
292
|
opts[:table] || { :create_indices => true }
|
306
293
|
end
|
307
294
|
|
295
|
+
def false_value
|
296
|
+
dialect.false_value
|
297
|
+
end
|
298
|
+
|
308
299
|
def get_enabled_for_table(connection, table)
|
309
300
|
row = connection.execute(get_last_pulled_at_for_table_sql(table)).rows[0]
|
310
301
|
enabled = row[table_metadata_enabled_column_name]
|
@@ -390,6 +381,10 @@ module Purview
|
|
390
381
|
Purview::Structs::Window.new(:min => min, :max => max)
|
391
382
|
end
|
392
383
|
|
384
|
+
def null_value
|
385
|
+
dialect.null_value
|
386
|
+
end
|
387
|
+
|
393
388
|
def nullable?(column)
|
394
389
|
column.nullable?
|
395
390
|
end
|
@@ -398,6 +393,14 @@ module Purview
|
|
398
393
|
column.primary_key?
|
399
394
|
end
|
400
395
|
|
396
|
+
def quoted(value)
|
397
|
+
dialect.quoted(value)
|
398
|
+
end
|
399
|
+
|
400
|
+
def sanitized(value)
|
401
|
+
dialect.sanitized(value)
|
402
|
+
end
|
403
|
+
|
401
404
|
def set_enabled_for_table(connection, table, enabled)
|
402
405
|
connection.execute(set_enabled_for_table_sql(table, enabled))
|
403
406
|
end
|
@@ -491,6 +494,10 @@ module Purview
|
|
491
494
|
table_opts[:name] || table.name
|
492
495
|
end
|
493
496
|
|
497
|
+
def true_value
|
498
|
+
dialect.true_value
|
499
|
+
end
|
500
|
+
|
494
501
|
def type(column)
|
495
502
|
type_map[column.type]
|
496
503
|
end
|
@@ -512,12 +519,6 @@ module Purview
|
|
512
519
|
raise %{All "#{Base}(s)" must override the "unlock_table_sql" method}
|
513
520
|
end
|
514
521
|
|
515
|
-
def with_new_connection
|
516
|
-
yield connection = connect
|
517
|
-
ensure
|
518
|
-
connection.disconnect if connection
|
519
|
-
end
|
520
|
-
|
521
522
|
def with_next_table(connection, timestamp)
|
522
523
|
table = next_table(connection, timestamp)
|
523
524
|
raise Purview::Exceptions::NoTable.new unless table
|
@@ -1,24 +1,8 @@
|
|
1
1
|
module Purview
|
2
2
|
module Databases
|
3
3
|
class MySQL < Base
|
4
|
-
def false_value
|
5
|
-
'0'
|
6
|
-
end
|
7
|
-
|
8
|
-
def null_value
|
9
|
-
'NULL'
|
10
|
-
end
|
11
|
-
|
12
|
-
def true_value
|
13
|
-
'1'
|
14
|
-
end
|
15
|
-
|
16
4
|
private
|
17
5
|
|
18
|
-
def connection_opts
|
19
|
-
super.merge(:database => name)
|
20
|
-
end
|
21
|
-
|
22
6
|
def connection_type
|
23
7
|
Purview::Connections::MySQL
|
24
8
|
end
|
@@ -49,6 +33,10 @@ module Purview
|
|
49
33
|
super.merge(Purview::Types::Timestamp => '0')
|
50
34
|
end
|
51
35
|
|
36
|
+
def dialect_type
|
37
|
+
Purview::Dialects::MySQL
|
38
|
+
end
|
39
|
+
|
52
40
|
def drop_index_sql(table_name, index_name, table, columns, index_opts={})
|
53
41
|
'DROP INDEX %s' % [
|
54
42
|
index_name,
|
@@ -1,24 +1,8 @@
|
|
1
1
|
module Purview
|
2
2
|
module Databases
|
3
3
|
class PostgreSQL < Base
|
4
|
-
def false_value
|
5
|
-
'FALSE'
|
6
|
-
end
|
7
|
-
|
8
|
-
def null_value
|
9
|
-
'NULL'
|
10
|
-
end
|
11
|
-
|
12
|
-
def true_value
|
13
|
-
'TRUE'
|
14
|
-
end
|
15
|
-
|
16
4
|
private
|
17
5
|
|
18
|
-
def connection_opts
|
19
|
-
super.merge(:dbname => name)
|
20
|
-
end
|
21
|
-
|
22
6
|
def connection_type
|
23
7
|
Purview::Connections::PostgreSQL
|
24
8
|
end
|
@@ -45,6 +29,10 @@ module Purview
|
|
45
29
|
]
|
46
30
|
end
|
47
31
|
|
32
|
+
def dialect_type
|
33
|
+
Purview::Dialects::PostgreSQL
|
34
|
+
end
|
35
|
+
|
48
36
|
def drop_index_sql(table_name, index_name, table, columns, index_opts={})
|
49
37
|
'DROP INDEX %s' % [
|
50
38
|
index_name,
|
data/lib/purview/databases.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Purview
|
2
|
+
module Dialects
|
3
|
+
class Base
|
4
|
+
def false_value
|
5
|
+
raise %{All "#{Base}(s)" must override the "false_value" method}
|
6
|
+
end
|
7
|
+
|
8
|
+
def null_value
|
9
|
+
raise %{All "#{Base}(s)" must override the "null_value" method}
|
10
|
+
end
|
11
|
+
|
12
|
+
def quoted(value)
|
13
|
+
raise %{All "#{Base}(s)" must override the "quoted" method}
|
14
|
+
end
|
15
|
+
|
16
|
+
def sanitized(value)
|
17
|
+
raise %{All "#{Base}(s)" must override the "sanitized" method}
|
18
|
+
end
|
19
|
+
|
20
|
+
def true_value
|
21
|
+
raise %{All "#{Base}(s)" must override the "true_value" method}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Purview
|
2
|
+
module Dialects
|
3
|
+
class MySQL < Base
|
4
|
+
def false_value
|
5
|
+
'0'
|
6
|
+
end
|
7
|
+
|
8
|
+
def null_value
|
9
|
+
'NULL'
|
10
|
+
end
|
11
|
+
|
12
|
+
def quoted(value)
|
13
|
+
value.nil? ? null_value : value.quoted
|
14
|
+
end
|
15
|
+
|
16
|
+
def sanitized(value)
|
17
|
+
value.nil? ? null_value : value.sanitized
|
18
|
+
end
|
19
|
+
|
20
|
+
def true_value
|
21
|
+
'1'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Purview
|
2
|
+
module Dialects
|
3
|
+
class PostgreSQL < Base
|
4
|
+
def false_value
|
5
|
+
'FALSE'
|
6
|
+
end
|
7
|
+
|
8
|
+
def null_value
|
9
|
+
'NULL'
|
10
|
+
end
|
11
|
+
|
12
|
+
def quoted(value)
|
13
|
+
value.nil? ? null_value : value.quoted
|
14
|
+
end
|
15
|
+
|
16
|
+
def sanitized(value)
|
17
|
+
value.nil? ? null_value : value.sanitized
|
18
|
+
end
|
19
|
+
|
20
|
+
def true_value
|
21
|
+
'TRUE'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/purview/exceptions.rb
CHANGED
data/lib/purview/loaders/base.rb
CHANGED
@@ -49,6 +49,18 @@ module Purview
|
|
49
49
|
table.database
|
50
50
|
end
|
51
51
|
|
52
|
+
def dialect
|
53
|
+
dialect_type.new
|
54
|
+
end
|
55
|
+
|
56
|
+
def dialect_type
|
57
|
+
raise %{All "#{Base}(s)" must override the "dialect_type" method}
|
58
|
+
end
|
59
|
+
|
60
|
+
def false_value
|
61
|
+
dialect.false_value
|
62
|
+
end
|
63
|
+
|
52
64
|
def id_in_sql(temporary_table_name)
|
53
65
|
raise %{All "#{Base}(s)" must override the "id_in_sql" method}
|
54
66
|
end
|
@@ -74,18 +86,26 @@ module Purview
|
|
74
86
|
raise %{All "#{Base}(s)" must override the "not_in_window_sql" method}
|
75
87
|
end
|
76
88
|
|
89
|
+
def null_value
|
90
|
+
dialect.null_value
|
91
|
+
end
|
92
|
+
|
77
93
|
def quoted(value)
|
78
|
-
|
94
|
+
dialect.quoted(value)
|
79
95
|
end
|
80
96
|
|
81
97
|
def row_values(row)
|
82
|
-
table.column_names.map { |column_name| quoted(row[column_name]) }.join(', ')
|
98
|
+
table.column_names.map { |column_name| quoted(sanitized(row[column_name])) }.join(', ')
|
83
99
|
end
|
84
100
|
|
85
101
|
def rows_per_slice
|
86
102
|
opts[:rows_per_slice] || 1000
|
87
103
|
end
|
88
104
|
|
105
|
+
def sanitized(value)
|
106
|
+
dialect.sanitized(value)
|
107
|
+
end
|
108
|
+
|
89
109
|
def table
|
90
110
|
opts[:table]
|
91
111
|
end
|
@@ -117,6 +137,10 @@ module Purview
|
|
117
137
|
raise %{All "#{Base}(s)" must override the "temporary_table_verify_sql" method}
|
118
138
|
end
|
119
139
|
|
140
|
+
def true_value
|
141
|
+
dialect.true_value
|
142
|
+
end
|
143
|
+
|
120
144
|
def verify_temporary_table(connection, temporary_table_name, rows, window)
|
121
145
|
with_context_logging("`verify_temporary_table` for: #{temporary_table_name}") do
|
122
146
|
rows_outside_window = connection.execute(
|