Changeset 4879
- Timestamp:
- 23 Jan 2010, 08:33:46 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/trunk/src/waeup/utils/batching.txt
r4877 r4879 41 41 '.pending'. So, when the input file is named 'foo.csv' and something 42 42 went wrong during processing, then a file 'foo.csv.create.pending' 43 will be generated (if the operation mode was 'create'). The log files 44 tells why these lines could not be processed. 43 will be generated (if the operation mode was 'create'). The .pending 44 file is a CSV file that contains the failed rows appended by a column 45 ``--ERRROR--`` in which the reasons for processing failures are 46 listed. 45 47 46 48 It looks like this:: … … 217 219 ... ['name', 'dinoports', 'owner', 'taxpayer'], 218 220 ... mode='create', user='Bob') 219 (4, {})221 (4, 0) 220 222 221 223 The result means: four entries were processed and no warnings … … 257 259 Processing time: ... s (... s/item) 258 260 Processed: 4 lines (4 successful/ 0 failed) 259 ------------------------------------------------------------...260 261 <BLANKLINE> 261 262 … … 266 267 ... ['name', 'dinoports', 'owner', 'taxpayer'], 267 268 ... mode='create', user='Bob') 268 (4, {1: 'This object already exists...})269 (4, 4) 269 270 270 271 The log file will tell us this in more detail: … … 278 279 Processing time: ... s (... s/item) 279 280 Processed: 4 lines (0 successful/ 4 failed) 280 ----------------------------------------------------------------------281 line 1 (1): This object already exists. Skipping.282 line 2 (2): This object already exists. Skipping.283 line 3 (3): This object already exists. Skipping.284 line 4 (4): This object already exists. Skipping.285 281 286 282 This time a new file was created, which keeps all the rows we could not … … 310 306 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 311 307 ... mode='update', user='Bob') 312 (4, {})313 314 No we want to tell, that Wilma got an extra port for her second dino:308 (4, 0) 309 310 Now we want to tell, that Wilma got an extra port for her second dino: 315 311 316 312 >>> open('newcomers.csv', 'wb').write( … … 327 323 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 328 324 ... mode='update', user='Bob') 329 (1, {})325 (1, 0) 330 326 331 327 >>> wilma = stoneville['Wilmas Asylum'] … … 344 340 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 345 341 ... mode='update', user='Bob') 346 (1, {1: 'Cannot update: no such entry.'})342 (1, 1) 347 343 348 344 Also invalid values will be spotted: … … 355 351 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 356 352 ... mode='update', user='Bob') 357 (1, {1: 'conversion error: ... dinoports: ValueError...NOT-A-NUMBER...353 (1, 1) 358 354 359 355 We can also update only some cols, leaving some out. We skip the … … 367 363 >>> processor.doImport('newcomers.csv', ['name', 'owner'], 368 364 ... mode='update', user='Bob') 369 (1, {})365 (1, 0) 370 366 371 367 >>> wilma.owner … … 398 394 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 399 395 ... mode='update', user='Bob') 400 (1, {})396 (1, 0) 401 397 402 398 >>> wilma.dinoports is None … … 412 408 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 413 409 ... mode='update', user='Bob') 414 (1, {})410 (1, 0) 415 411 416 412 >>> wilma.dinoports is None … … 430 426 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 431 427 ... mode='remove', user='Bob') 432 (1, {})428 (1, 0) 433 429 434 430 >>> sorted(stoneville.keys())
Note: See TracChangeset for help on using the changeset viewer.