test the full logging for insertmanyvalues added for #6047. to make it as clear as possible what's going on, the "insertmanyvalues" execute is noted explicitly and includes total number of batches, batch count. The long SQL string as well as the long parameter list
(self)
| 239 | |
| 240 | @testing.requires.insertmanyvalues |
| 241 | def test_log_insertmanyvalues(self): |
| 242 | """test the full logging for insertmanyvalues added for #6047. |
| 243 | |
| 244 | to make it as clear as possible what's going on, the "insertmanyvalues" |
| 245 | execute is noted explicitly and includes total number of batches, |
| 246 | batch count. The long SQL string as well as the long parameter list |
| 247 | is now truncated in the middle, which is a new logging capability |
| 248 | as of this feature (we had only truncation of many separate parameter |
| 249 | sets and truncation of long individual parameter values, not |
| 250 | a long single tuple/dict of parameters.) |
| 251 | |
| 252 | """ |
| 253 | t = Table( |
| 254 | "t", |
| 255 | MetaData(), |
| 256 | Column("id", Integer, primary_key=True), |
| 257 | Column("data", String), |
| 258 | ) |
| 259 | |
| 260 | with self.eng.begin() as connection: |
| 261 | t.create(connection) |
| 262 | |
| 263 | connection.execute( |
| 264 | t.insert().returning(t.c.id), |
| 265 | [{"data": f"d{i}"} for i in range(327)], |
| 266 | ) |
| 267 | |
| 268 | full_insert = ( |
| 269 | "INSERT INTO t (data) VALUES (?), (?), " |
| 270 | "(?), (?), (?), (?), (?), " |
| 271 | "(?), (?), (?), (?), (?), (?), (?), (?), " |
| 272 | "(?), (?), (?), (?), (?), " |
| 273 | "(?), (?), (?), (?), (?), (?), (?), (?), " |
| 274 | "(?), (?), (?), (?), (?), " |
| 275 | "(?), (?), (?), (?), (?), (?), (?), (?), (?), (?), (?), " |
| 276 | "(? ... 439 characters truncated ... ?), (?), (?), (?), (?), " |
| 277 | "(?), (?), (?), (?), (?), (?), (?), (?), " |
| 278 | "(?), (?), (?), (?), (?) " |
| 279 | "RETURNING id" |
| 280 | ) |
| 281 | eq_(self.buf.buffer[3].message, full_insert) |
| 282 | |
| 283 | eq_regex( |
| 284 | self.buf.buffer[4].message, |
| 285 | r"\[generated in .* \(insertmanyvalues\) 1/3 " |
| 286 | r"\(unordered\)\] \('d0', 'd1', " |
| 287 | r"'d2', 'd3', 'd4', 'd5', 'd6', 'd7', " |
| 288 | r"'d8', 'd9', 'd10', 'd11', 'd12', 'd13', 'd14', 'd15', " |
| 289 | r"'d16', 'd17', 'd18', 'd19', 'd20', 'd21', 'd22', 'd23', " |
| 290 | r"'d24', 'd25', 'd26', 'd27', 'd28', 'd29', 'd30', " |
| 291 | r"'d31', 'd32', 'd33', 'd34', 'd35', 'd36', 'd37', 'd38', " |
| 292 | r"'d39', 'd40', 'd41', 'd42', 'd43', 'd44', 'd45', 'd46', " |
| 293 | r"'d47', 'd48', " |
| 294 | r"'d49' ... 50 parameters truncated ... " |
| 295 | r"'d100', 'd101', 'd102', 'd103', 'd104', 'd105', 'd106', " |
| 296 | r"'d107', 'd108', 'd109', 'd110', 'd111', 'd112', 'd113', " |
| 297 | r"'d114', 'd115', 'd116', 'd117', 'd118', 'd119', 'd120', " |
| 298 | r"'d121', 'd122', 'd123', 'd124', 'd125', 'd126', 'd127', " |