@@ -128,7 +128,7 @@ def test_read_state_info(self):
128
128
"DROP TABLE IF EXISTS test_new_20210303;" ,
129
129
"CREATE TABLE test_new_20210303 LIKE test;" ,
130
130
"ALTER TABLE test_new_20210303 REMOVE PARTITIONING;" ,
131
- "ALTER TABLE test_new_20210303 PARTITION BY RANGE(id) (" ,
131
+ "ALTER TABLE test_new_20210303 PARTITION BY RANGE (id) (" ,
132
132
"\t PARTITION p_start VALUES LESS THAN MAXVALUE" ,
133
133
");" ,
134
134
"ALTER TABLE `test_new_20210303` REORGANIZE PARTITION `p_start` "
@@ -152,22 +152,22 @@ def test_read_state_info(self):
152
152
def test_read_state_info_map_table (self ):
153
153
self .maxDiff = None
154
154
conf = Config ()
155
- conf .assume_partitioned_on = ["order " , "auth " ]
155
+ conf .assume_partitioned_on = ["orderID " , "authzID " ]
156
156
conf .curtime = datetime (2021 , 3 , 3 )
157
157
conf .dbcmd = MockDatabase ()
158
- conf .dbcmd ._select_response = [[{"auth " : 22 }], [{"order " : 11 }]]
158
+ conf .dbcmd ._select_response = [[{"authzID " : 22 }], [{"orderID " : 11 }]]
159
159
conf .dbcmd ._response = [
160
160
[
161
- {"Field" : "order " , "Type" : "bigint UNSIGNED" },
162
- {"Field" : "auth " , "Type" : "bigint UNSIGNED" },
161
+ {"Field" : "orderID " , "Type" : "bigint UNSIGNED" },
162
+ {"Field" : "authzID " , "Type" : "bigint UNSIGNED" },
163
163
]
164
164
]
165
165
conf .tables = [Table ("map_table" ).set_partition_period (timedelta (days = 30 ))]
166
166
167
167
state_fs = io .StringIO ()
168
168
yaml .dump (
169
169
{
170
- "tables" : {"map_table" : {"order " : 11 , "auth " : 22 }},
170
+ "tables" : {"map_table" : {"orderID " : 10 , "authzID " : 20 }},
171
171
"time" : (conf .curtime - timedelta (days = 1 )),
172
172
},
173
173
state_fs ,
@@ -183,20 +183,21 @@ def test_read_state_info_map_table(self):
183
183
"DROP TABLE IF EXISTS map_table_new_20210303;" ,
184
184
"CREATE TABLE map_table_new_20210303 LIKE map_table;" ,
185
185
"ALTER TABLE map_table_new_20210303 REMOVE PARTITIONING;" ,
186
- "ALTER TABLE map_table_new_20210303 PARTITION BY RANGE(order, auth) (" ,
187
- "\t PARTITION p_assumed VALUES LESS THAN MAXVALUE" ,
186
+ "ALTER TABLE map_table_new_20210303 PARTITION BY RANGE "
187
+ + "COLUMNS (orderID, authzID) (" ,
188
+ "\t PARTITION p_assumed VALUES LESS THAN (MAXVALUE, MAXVALUE)" ,
188
189
");" ,
189
190
"ALTER TABLE `map_table_new_20210303` REORGANIZE PARTITION "
190
191
+ "`p_assumed` INTO (PARTITION `p_20210303` VALUES LESS THAN "
191
192
+ "(11, 22), PARTITION `p_20210402` VALUES LESS THAN "
192
- + "(11, 22 ), PARTITION `p_20210502` VALUES LESS THAN "
193
- + "MAXVALUE, MAXVALUE);" ,
193
+ + "(41, 82 ), PARTITION `p_20210502` VALUES LESS THAN "
194
+ + "( MAXVALUE, MAXVALUE) );" ,
194
195
"CREATE OR REPLACE TRIGGER copy_inserts_from_map_table_"
195
196
+ "to_map_table_new_20210303" ,
196
197
"\t AFTER INSERT ON map_table FOR EACH ROW" ,
197
198
"\t \t INSERT INTO map_table_new_20210303 SET" ,
198
- "\t \t \t `auth ` = NEW.`auth `," ,
199
- "\t \t \t `order ` = NEW.`order `;" ,
199
+ "\t \t \t `authzID ` = NEW.`authzID `," ,
200
+ "\t \t \t `orderID ` = NEW.`orderID `;" ,
200
201
]
201
202
},
202
203
)
@@ -242,7 +243,7 @@ def test_generate_sql_copy_commands(self):
242
243
"DROP TABLE IF EXISTS new;" ,
243
244
"CREATE TABLE new LIKE old;" ,
244
245
"ALTER TABLE new REMOVE PARTITIONING;" ,
245
- "ALTER TABLE new PARTITION BY RANGE(id) (" ,
246
+ "ALTER TABLE new PARTITION BY RANGE (id) (" ,
246
247
"\t PARTITION p_assumed VALUES LESS THAN MAXVALUE" ,
247
248
");" ,
248
249
"STRAIGHT_UP_INSERTED" ,
0 commit comments