purview 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +9 -0
  3. data/TODO +7 -6
  4. data/lib/purview/columns/base.rb +35 -3
  5. data/lib/purview/databases/base.rb +84 -231
  6. data/lib/purview/databases/mysql.rb +42 -108
  7. data/lib/purview/databases/postgresql.rb +45 -111
  8. data/lib/purview/exceptions/{could_not_baseline.rb → could_not_baseline_table.rb} +1 -1
  9. data/lib/purview/exceptions/{could_not_disable.rb → could_not_disable_table.rb} +1 -1
  10. data/lib/purview/exceptions/{could_not_enable.rb → could_not_enable_table.rb} +1 -1
  11. data/lib/purview/exceptions/{could_not_find_table_metadata.rb → could_not_find_metadata_for_table.rb} +1 -1
  12. data/lib/purview/exceptions/{could_not_initialize.rb → could_not_initialize_table.rb} +1 -1
  13. data/lib/purview/exceptions/{could_not_lock.rb → could_not_lock_table.rb} +1 -1
  14. data/lib/purview/exceptions/{could_not_sync.rb → could_not_sync_table.rb} +1 -1
  15. data/lib/purview/exceptions/{could_not_unlock.rb → could_not_unlock_table.rb} +1 -1
  16. data/lib/purview/exceptions/could_not_update_metadata_for_table.rb +9 -0
  17. data/lib/purview/exceptions/{database_already_assigned.rb → database_already_assigned_for_table.rb} +1 -1
  18. data/lib/purview/exceptions/{no_window.rb → no_window_for_table.rb} +1 -1
  19. data/lib/purview/exceptions/rows_outside_window_for_table.rb +18 -0
  20. data/lib/purview/exceptions/table_already_assigned_for_column.rb +17 -0
  21. data/lib/purview/exceptions/{table_already_assigned.rb → table_already_assigned_for_index.rb} +1 -1
  22. data/lib/purview/exceptions/{wrong_database.rb → wrong_database_for_table.rb} +1 -1
  23. data/lib/purview/exceptions.rb +15 -13
  24. data/lib/purview/indices/base.rb +6 -1
  25. data/lib/purview/loaders/base.rb +2 -25
  26. data/lib/purview/mixins/dialect.rb +29 -0
  27. data/lib/purview/mixins.rb +1 -0
  28. data/lib/purview/parsers/base.rb +3 -2
  29. data/lib/purview/parsers/csv.rb +13 -3
  30. data/lib/purview/pullers/base_sql.rb +6 -25
  31. data/lib/purview/structs/table_metadata.rb +0 -14
  32. data/lib/purview/tables/base.rb +28 -106
  33. data/lib/purview/tables/base_syncable.rb +113 -0
  34. data/lib/purview/tables/raw.rb +1 -1
  35. data/lib/purview/tables/table_metadata.rb +43 -0
  36. data/lib/purview/tables.rb +3 -0
  37. data/lib/purview/version.rb +1 -1
  38. metadata +20 -15
  39. data/lib/purview/exceptions/rows_outside_window.rb +0 -18
@@ -12,7 +12,7 @@ module Purview
12
12
  index.unique? ? ' UNIQUE ' : ' ',
13
13
  index_name,
14
14
  table_name,
15
- column_names(index.columns).join(', '),
15
+ column_names(index).join(', '),
16
16
  ]
17
17
  end
18
18
 
@@ -40,12 +40,12 @@ module Purview
40
40
 
41
41
  def disable_table_sql(table)
42
42
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NOT NULL' % [
43
- table_metadata_table_name,
44
- table_metadata_enabled_at_column_name,
43
+ table_metadata_table.name,
44
+ table_metadata_table.enabled_at_column.name,
45
45
  null_value,
46
- table_metadata_table_name_column_name,
46
+ table_metadata_table.table_name_column.name,
47
47
  quoted(table.name),
48
- table_metadata_enabled_at_column_name,
48
+ table_metadata_table.enabled_at_column.name,
49
49
  ]
50
50
  end
51
51
 
@@ -63,80 +63,53 @@ module Purview
63
63
 
64
64
  def enable_table_sql(table, timestamp)
65
65
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NULL' % [
66
- table_metadata_table_name,
67
- table_metadata_enabled_at_column_name,
66
+ table_metadata_table.name,
67
+ table_metadata_table.enabled_at_column.name,
68
68
  quoted(timestamp),
69
- table_metadata_table_name_column_name,
69
+ table_metadata_table.table_name_column.name,
70
70
  quoted(table.name),
71
- table_metadata_enabled_at_column_name,
71
+ table_metadata_table.enabled_at_column.name,
72
72
  ]
73
73
  end
74
74
 
75
75
  def ensure_table_metadata_absent_for_table_sql(table)
76
76
  'DELETE FROM %s WHERE %s = %s' % [
77
- table_metadata_table_name,
78
- table_metadata_table_name_column_name,
77
+ table_metadata_table.name,
78
+ table_metadata_table.table_name_column.name,
79
79
  quoted(table.name),
80
80
  ]
81
81
  end
82
82
 
83
83
  def ensure_table_metadata_exists_for_table_sql(table)
84
84
  'INSERT IGNORE INTO %s VALUES (%s, NULL, NULL, NULL, NULL)' % [
85
- table_metadata_table_name,
85
+ table_metadata_table.name,
86
86
  quoted(table.name),
87
87
  ]
88
88
  end
89
89
 
90
90
  def ensure_table_metadata_table_exists_sql
91
91
  'CREATE TABLE IF NOT EXISTS %s (%s)' % [
92
- table_metadata_table_name,
93
- table_metadata_column_definitions.join(', '),
92
+ table_metadata_table.name,
93
+ column_definitions(table_metadata_table).join(', '),
94
94
  ]
95
95
  end
96
96
 
97
97
  def initialize_table_sql(table, timestamp)
98
98
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NULL' % [
99
- table_metadata_table_name,
100
- table_metadata_max_timestamp_pulled_column_name,
99
+ table_metadata_table.name,
100
+ table_metadata_table.max_timestamp_pulled_column.name,
101
101
  quoted(timestamp),
102
- table_metadata_table_name_column_name,
102
+ table_metadata_table.table_name_column.name,
103
103
  quoted(table.name),
104
- table_metadata_max_timestamp_pulled_column_name,
104
+ table_metadata_table.max_timestamp_pulled_column.name,
105
105
  ]
106
106
  end
107
107
 
108
- def get_enabled_at_for_table_sql(table)
108
+ def get_table_metadata_value_sql(table, column)
109
109
  'SELECT %s FROM %s WHERE %s = %s' % [
110
- table_metadata_enabled_at_column_name,
111
- table_metadata_table_name,
112
- table_metadata_table_name_column_name,
113
- quoted(table.name),
114
- ]
115
- end
116
-
117
- def get_last_pulled_at_for_table_sql(table)
118
- 'SELECT %s FROM %s WHERE %s = %s' % [
119
- table_metadata_last_pulled_at_column_name,
120
- table_metadata_table_name,
121
- table_metadata_table_name_column_name,
122
- quoted(table.name),
123
- ]
124
- end
125
-
126
- def get_locked_at_for_table_sql(table)
127
- 'SELECT %s FROM %s WHERE %s = %s' % [
128
- table_metadata_locked_at_column_name,
129
- table_metadata_table_name,
130
- table_metadata_table_name_column_name,
131
- quoted(table.name),
132
- ]
133
- end
134
-
135
- def get_max_timestamp_pulled_for_table_sql(table)
136
- 'SELECT %s FROM %s WHERE %s = %s' % [
137
- table_metadata_max_timestamp_pulled_column_name,
138
- table_metadata_table_name,
139
- table_metadata_table_name_column_name,
110
+ column.name,
111
+ table_metadata_table.name,
112
+ table_metadata_table.table_name_column.name,
140
113
  quoted(table.name),
141
114
  ]
142
115
  end
@@ -147,72 +120,33 @@ module Purview
147
120
 
148
121
  def lock_table_sql(table, timestamp)
149
122
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NULL' % [
150
- table_metadata_table_name,
151
- table_metadata_locked_at_column_name,
123
+ table_metadata_table.name,
124
+ table_metadata_table.locked_at_column.name,
152
125
  quoted(timestamp),
153
- table_metadata_table_name_column_name,
126
+ table_metadata_table.table_name_column.name,
154
127
  quoted(table.name),
155
- table_metadata_locked_at_column_name,
128
+ table_metadata_table.locked_at_column.name,
156
129
  ]
157
130
  end
158
131
 
159
132
  def next_table_sql(timestamp)
160
133
  'SELECT %s FROM %s WHERE %s IS NOT NULL AND %s IS NOT NULL AND %s IS NULL ORDER BY %s IS NULL DESC, %s LIMIT 1' % [
161
- table_metadata_table_name_column_name,
162
- table_metadata_table_name,
163
- table_metadata_enabled_at_column_name,
164
- table_metadata_max_timestamp_pulled_column_name,
165
- table_metadata_locked_at_column_name,
166
- table_metadata_last_pulled_at_column_name,
167
- table_metadata_last_pulled_at_column_name,
134
+ table_metadata_table.table_name_column.name,
135
+ table_metadata_table.name,
136
+ table_metadata_table.enabled_at_column.name,
137
+ table_metadata_table.max_timestamp_pulled_column.name,
138
+ table_metadata_table.locked_at_column.name,
139
+ table_metadata_table.last_pulled_at_column.name,
140
+ table_metadata_table.last_pulled_at_column.name,
168
141
  ]
169
142
  end
170
143
 
171
- def set_enabled_at_for_table_sql(table, timestamp)
172
- 'UPDATE %s SET %s = %s WHERE %s = %s AND %s' % [
173
- table_metadata_table_name,
174
- table_metadata_enabled_at_column_name,
175
- quoted(timestamp),
176
- table_metadata_table_name_column_name,
177
- quoted(table.name),
178
- ]
179
- end
180
-
181
- def set_last_pulled_at_for_table_sql(table, timestamp)
182
- 'UPDATE %s SET %s = %s WHERE %s = %s' % [
183
- table_metadata_table_name,
184
- table_metadata_last_pulled_at_column_name,
185
- quoted(timestamp),
186
- table_metadata_table_name_column_name,
187
- quoted(table.name),
188
- ]
189
- end
190
-
191
- def set_locked_at_for_table_sql(table, timestamp)
192
- 'UPDATE %s SET %s = %s WHERE %s = %s AND %s' % [
193
- table_metadata_table_name,
194
- table_metadata_locked_at_column_name,
195
- quoted(timestamp),
196
- table_metadata_table_name_column_name,
197
- quoted(table.name),
198
- ]
199
- end
200
-
201
- def set_max_timestamp_pulled_for_table_sql(table, timestamp)
144
+ def set_table_metadata_value_sql(table, column, value)
202
145
  'UPDATE %s SET %s = %s WHERE %s = %s' % [
203
- table_metadata_table_name,
204
- table_metadata_max_timestamp_pulled_column_name,
205
- quoted(timestamp),
206
- table_metadata_table_name_column_name,
207
- quoted(table.name),
208
- ]
209
- end
210
-
211
- def table_metadata_sql(table)
212
- 'SELECT %s FROM %s WHERE %s = %s' % [
213
- table_metadata_column_names.join(', '),
214
- table_metadata_table_name,
215
- table_metadata_table_name_column_name,
146
+ table_metadata_table.name,
147
+ column.name,
148
+ quoted(value),
149
+ table_metadata_table.table_name_column.name,
216
150
  quoted(table.name),
217
151
  ]
218
152
  end
@@ -226,12 +160,12 @@ module Purview
226
160
 
227
161
  def unlock_table_sql(table)
228
162
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NOT NULL' % [
229
- table_metadata_table_name,
230
- table_metadata_locked_at_column_name,
163
+ table_metadata_table.name,
164
+ table_metadata_table.locked_at_column.name,
231
165
  null_value,
232
- table_metadata_table_name_column_name,
166
+ table_metadata_table.table_name_column.name,
233
167
  quoted(table.name),
234
- table_metadata_locked_at_column_name,
168
+ table_metadata_table.locked_at_column.name,
235
169
  ]
236
170
  end
237
171
  end
@@ -12,7 +12,7 @@ module Purview
12
12
  index.unique? ? ' UNIQUE ' : ' ',
13
13
  index_name,
14
14
  table_name,
15
- column_names(index.columns).join(', '),
15
+ column_names(index).join(', '),
16
16
  ]
17
17
  end
18
18
 
@@ -36,12 +36,12 @@ module Purview
36
36
 
37
37
  def disable_table_sql(table)
38
38
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NOT NULL' % [
39
- table_metadata_table_name,
40
- table_metadata_enabled_at_column_name,
39
+ table_metadata_table.name,
40
+ table_metadata_table.enabled_at_column.name,
41
41
  null_value,
42
- table_metadata_table_name_column_name,
42
+ table_metadata_table.table_name_column.name,
43
43
  quoted(table.name),
44
- table_metadata_enabled_at_column_name,
44
+ table_metadata_table.enabled_at_column.name,
45
45
  ]
46
46
  end
47
47
 
@@ -59,84 +59,57 @@ module Purview
59
59
 
60
60
  def enable_table_sql(table, timestamp)
61
61
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NULL' % [
62
- table_metadata_table_name,
63
- table_metadata_enabled_at_column_name,
62
+ table_metadata_table.name,
63
+ table_metadata_table.enabled_at_column.name,
64
64
  quoted(timestamp),
65
- table_metadata_table_name_column_name,
65
+ table_metadata_table.table_name_column.name,
66
66
  quoted(table.name),
67
- table_metadata_enabled_at_column_name,
67
+ table_metadata_table.enabled_at_column.name,
68
68
  ]
69
69
  end
70
70
 
71
71
  def ensure_table_metadata_absent_for_table_sql(table)
72
72
  'DELETE FROM %s WHERE %s = %s' % [
73
- table_metadata_table_name,
74
- table_metadata_table_name_column_name,
73
+ table_metadata_table.name,
74
+ table_metadata_table.table_name_column.name,
75
75
  quoted(table.name),
76
76
  ]
77
77
  end
78
78
 
79
79
  def ensure_table_metadata_exists_for_table_sql(table)
80
80
  'INSERT INTO %s (%s) SELECT %s WHERE NOT EXISTS (SELECT 1 FROM %s WHERE %s = %s)' % [
81
- table_metadata_table_name,
82
- table_metadata_table_name_column_name,
81
+ table_metadata_table.name,
82
+ table_metadata_table.table_name_column.name,
83
83
  quoted(table.name),
84
- table_metadata_table_name,
85
- table_metadata_table_name_column_name,
84
+ table_metadata_table.name,
85
+ table_metadata_table.table_name_column.name,
86
86
  quoted(table.name),
87
87
  ]
88
88
  end
89
89
 
90
90
  def ensure_table_metadata_table_exists_sql
91
91
  'CREATE TABLE IF NOT EXISTS %s (%s)' % [
92
- table_metadata_table_name,
93
- table_metadata_column_definitions.join(', '),
92
+ table_metadata_table.name,
93
+ column_definitions(table_metadata_table).join(', '),
94
94
  ]
95
95
  end
96
96
 
97
97
  def initialize_table_sql(table, timestamp)
98
98
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NULL' % [
99
- table_metadata_table_name,
100
- table_metadata_max_timestamp_pulled_column_name,
99
+ table_metadata_table.name,
100
+ table_metadata_table.max_timestamp_pulled_column.name,
101
101
  quoted(timestamp),
102
- table_metadata_table_name_column_name,
102
+ table_metadata_table.table_name_column.name,
103
103
  quoted(table.name),
104
- table_metadata_max_timestamp_pulled_column_name,
104
+ table_metadata_table.max_timestamp_pulled_column.name,
105
105
  ]
106
106
  end
107
107
 
108
- def get_enabled_at_for_table_sql(table)
108
+ def get_table_metadata_value_sql(table, column)
109
109
  'SELECT %s FROM %s WHERE %s = %s' % [
110
- table_metadata_enabled_at_column_name,
111
- table_metadata_table_name,
112
- table_metadata_table_name_column_name,
113
- quoted(table.name),
114
- ]
115
- end
116
-
117
- def get_last_pulled_at_for_table_sql(table)
118
- 'SELECT %s FROM %s WHERE %s = %s' % [
119
- table_metadata_last_pulled_at_column_name,
120
- table_metadata_table_name,
121
- table_metadata_table_name_column_name,
122
- quoted(table.name),
123
- ]
124
- end
125
-
126
- def get_locked_at_for_table_sql(table)
127
- 'SELECT %s FROM %s WHERE %s = %s' % [
128
- table_metadata_locked_at_column_name,
129
- table_metadata_table_name,
130
- table_metadata_table_name_column_name,
131
- quoted(table.name),
132
- ]
133
- end
134
-
135
- def get_max_timestamp_pulled_for_table_sql(table)
136
- 'SELECT %s FROM %s WHERE %s = %s' % [
137
- table_metadata_max_timestamp_pulled_column_name,
138
- table_metadata_table_name,
139
- table_metadata_table_name_column_name,
110
+ column.name,
111
+ table_metadata_table.name,
112
+ table_metadata_table.table_name_column.name,
140
113
  quoted(table.name),
141
114
  ]
142
115
  end
@@ -150,72 +123,33 @@ module Purview
150
123
 
151
124
  def lock_table_sql(table, timestamp)
152
125
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NULL' % [
153
- table_metadata_table_name,
154
- table_metadata_locked_at_column_name,
126
+ table_metadata_table.name,
127
+ table_metadata_table.locked_at_column.name,
155
128
  quoted(timestamp),
156
- table_metadata_table_name_column_name,
129
+ table_metadata_table.table_name_column.name,
157
130
  quoted(table.name),
158
- table_metadata_locked_at_column_name,
131
+ table_metadata_table.locked_at_column.name,
159
132
  ]
160
133
  end
161
134
 
162
135
  def next_table_sql(timestamp)
163
136
  'SELECT %s FROM %s WHERE %s IS NOT NULL AND %s IS NOT NULL AND %s IS NULL ORDER BY %s IS NULL DESC, %s LIMIT 1' % [
164
- table_metadata_table_name_column_name,
165
- table_metadata_table_name,
166
- table_metadata_enabled_at_column_name,
167
- table_metadata_max_timestamp_pulled_column_name,
168
- table_metadata_locked_at_column_name,
169
- table_metadata_last_pulled_at_column_name,
170
- table_metadata_last_pulled_at_column_name,
137
+ table_metadata_table.table_name_column.name,
138
+ table_metadata_table.name,
139
+ table_metadata_table.enabled_at_column.name,
140
+ table_metadata_table.max_timestamp_pulled_column.name,
141
+ table_metadata_table.locked_at_column.name,
142
+ table_metadata_table.last_pulled_at_column.name,
143
+ table_metadata_table.last_pulled_at_column.name,
171
144
  ]
172
145
  end
173
146
 
174
- def set_enabled_at_for_table_sql(table, timestamp)
175
- 'UPDATE %s SET %s = %s WHERE %s = %s AND %s' % [
176
- table_metadata_table_name,
177
- table_metadata_enabled_at_column_name,
178
- quoted(timestamp),
179
- table_metadata_table_name_column_name,
180
- quoted(table.name),
181
- ]
182
- end
183
-
184
- def set_last_pulled_at_for_table_sql(table, timestamp)
185
- 'UPDATE %s SET %s = %s WHERE %s = %s' % [
186
- table_metadata_table_name,
187
- table_metadata_last_pulled_at_column_name,
188
- quoted(timestamp),
189
- table_metadata_table_name_column_name,
190
- quoted(table.name),
191
- ]
192
- end
193
-
194
- def set_locked_at_for_table_sql(table, timestamp)
195
- 'UPDATE %s SET %s = %s WHERE %s = %s AND %s' % [
196
- table_metadata_table_name,
197
- table_metadata_locked_at_column_name,
198
- quoted(timestamp),
199
- table_metadata_table_name_column_name,
200
- quoted(table.name),
201
- ]
202
- end
203
-
204
- def set_max_timestamp_pulled_for_table_sql(table, timestamp)
147
+ def set_table_metadata_value_sql(table, column, value)
205
148
  'UPDATE %s SET %s = %s WHERE %s = %s' % [
206
- table_metadata_table_name,
207
- table_metadata_max_timestamp_pulled_column_name,
208
- quoted(timestamp),
209
- table_metadata_table_name_column_name,
210
- quoted(table.name),
211
- ]
212
- end
213
-
214
- def table_metadata_sql(table)
215
- 'SELECT %s FROM %s WHERE %s = %s' % [
216
- table_metadata_column_names.join(', '),
217
- table_metadata_table_name,
218
- table_metadata_table_name_column_name,
149
+ table_metadata_table.name,
150
+ column.name,
151
+ quoted(value),
152
+ table_metadata_table.table_name_column.name,
219
153
  quoted(table.name),
220
154
  ]
221
155
  end
@@ -229,12 +163,12 @@ module Purview
229
163
 
230
164
  def unlock_table_sql(table)
231
165
  'UPDATE %s SET %s = %s WHERE %s = %s AND %s IS NOT NULL' % [
232
- table_metadata_table_name,
233
- table_metadata_locked_at_column_name,
166
+ table_metadata_table.name,
167
+ table_metadata_table.locked_at_column.name,
234
168
  null_value,
235
- table_metadata_table_name_column_name,
169
+ table_metadata_table.table_name_column.name,
236
170
  quoted(table.name),
237
- table_metadata_locked_at_column_name,
171
+ table_metadata_table.locked_at_column.name,
238
172
  ]
239
173
  end
240
174
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotBaseline < BaseTable
3
+ class CouldNotBaselineTable < BaseTable
4
4
  def message
5
5
  "Could not baseline table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotDisable < BaseTable
3
+ class CouldNotDisableTable < BaseTable
4
4
  def message
5
5
  "Could not disable table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotEnable < BaseTable
3
+ class CouldNotEnableTable < BaseTable
4
4
  def message
5
5
  "Could not enable table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotFindTableMetadata < BaseTable
3
+ class CouldNotFindMetadataForTable < BaseTable
4
4
  def message
5
5
  "Could not find metadata for table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotInitialize < BaseTable
3
+ class CouldNotInitializeTable < BaseTable
4
4
  def message
5
5
  "Could not initialize table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotLock < BaseTable
3
+ class CouldNotLockTable < BaseTable
4
4
  def message
5
5
  "Could not lock table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotSync < BaseTable
3
+ class CouldNotSyncTable < BaseTable
4
4
  def message
5
5
  "Could not sync table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class CouldNotUnlock < BaseTable
3
+ class CouldNotUnlockTable < BaseTable
4
4
  def message
5
5
  "Could not unlock table: #{table.name}"
6
6
  end
@@ -0,0 +1,9 @@
1
+ module Purview
2
+ module Exceptions
3
+ class CouldNotUpdateMetadataForTable < BaseTable
4
+ def message
5
+ "Could not update metadata for table: #{table.name}"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class DatabaseAlreadyAssigned < BaseTable
3
+ class DatabaseAlreadyAssignedForTable < BaseTable
4
4
  def message
5
5
  "Database already assigned for table: #{table.name}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class NoWindow < BaseTable
3
+ class NoWindowForTable < BaseTable
4
4
  def message
5
5
  "Could not find a window for table: #{table.name}"
6
6
  end
@@ -0,0 +1,18 @@
1
+ module Purview
2
+ module Exceptions
3
+ class RowsOutsideWindowForTable < BaseTable
4
+ def initialize(table, count)
5
+ super(table)
6
+ @count = count
7
+ end
8
+
9
+ def message
10
+ "#{count} row(s) outside window for table: #{table.name}"
11
+ end
12
+
13
+ private
14
+
15
+ attr_reader :count
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ module Purview
2
+ module Exceptions
3
+ class TableAlreadyAssignedForColumn < Base
4
+ def initialize(column)
5
+ @column = column
6
+ end
7
+
8
+ def message
9
+ "Table already assigned for column: #{column.name}"
10
+ end
11
+
12
+ private
13
+
14
+ attr_reader :column
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class TableAlreadyAssigned < Base
3
+ class TableAlreadyAssignedForIndex < Base
4
4
  def initialize(index)
5
5
  @index = index
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Purview
2
2
  module Exceptions
3
- class WrongDatabase < BaseTable
3
+ class WrongDatabaseForTable < BaseTable
4
4
  def message
5
5
  "Wrong database for table: #{table.name}"
6
6
  end
@@ -1,18 +1,20 @@
1
1
  require 'purview/exceptions/base'
2
2
  require 'purview/exceptions/base_table'
3
3
 
4
- require 'purview/exceptions/could_not_baseline'
5
- require 'purview/exceptions/could_not_disable'
6
- require 'purview/exceptions/could_not_enable'
7
- require 'purview/exceptions/could_not_find_table_metadata'
8
- require 'purview/exceptions/could_not_initialize'
9
- require 'purview/exceptions/could_not_lock'
10
- require 'purview/exceptions/could_not_sync'
11
- require 'purview/exceptions/could_not_unlock'
4
+ require 'purview/exceptions/could_not_baseline_table'
5
+ require 'purview/exceptions/could_not_disable_table'
6
+ require 'purview/exceptions/could_not_enable_table'
7
+ require 'purview/exceptions/could_not_find_metadata_for_table'
8
+ require 'purview/exceptions/could_not_initialize_table'
9
+ require 'purview/exceptions/could_not_lock_table'
10
+ require 'purview/exceptions/could_not_sync_table'
11
+ require 'purview/exceptions/could_not_unlock_table'
12
+ require 'purview/exceptions/could_not_update_metadata_for_table'
12
13
 
13
- require 'purview/exceptions/database_already_assigned'
14
+ require 'purview/exceptions/database_already_assigned_for_table'
14
15
  require 'purview/exceptions/no_table'
15
- require 'purview/exceptions/no_window'
16
- require 'purview/exceptions/rows_outside_window'
17
- require 'purview/exceptions/table_already_assigned'
18
- require 'purview/exceptions/wrong_database'
16
+ require 'purview/exceptions/no_window_for_table'
17
+ require 'purview/exceptions/rows_outside_window_for_table'
18
+ require 'purview/exceptions/table_already_assigned_for_column'
19
+ require 'purview/exceptions/table_already_assigned_for_index'
20
+ require 'purview/exceptions/wrong_database_for_table'