Changeset 4895 for waeup/trunk/src
- Timestamp:
- 27 Jan 2010, 11:30:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/trunk/src/waeup/utils/batching.txt
r4890 r4895 229 229 ... ['name', 'dinoports', 'owner', 'taxpayer'], 230 230 ... mode='create', user='Bob', logger=logger) 231 (4, 0 )231 (4, 0, '/.../newcomers.finished.csv', None) 232 232 233 233 The result means: four entries were processed and no warnings 234 occured. Let's check: 234 occured. Furthermore we get filepath to a CSV file with successfully 235 processed entries and a filepath to a CSV file with erraneous entries. 236 As everything went well, the latter is ``None``. Let's check: 235 237 236 238 >>> sorted(stoneville.keys()) … … 278 280 ... ['name', 'dinoports', 'owner', 'taxpayer'], 279 281 ... mode='create', user='Bob', logger=logger) 280 (4, 4) 282 (4, 4, '/.../newcomers.finished.csv', '/.../newcomers.pending.csv') 283 284 This time we also get a path to a .pending file. 281 285 282 286 The log file will tell us this in more detail: … … 291 295 Bob: Mode: create 292 296 Bob: User: Bob 293 Bob: Failed datasets: newcomers. create.pending.csv297 Bob: Failed datasets: newcomers.pending.csv 294 298 Bob: Processing time: ... s (... s/item) 295 299 Bob: Processed: 4 lines (0 successful/ 4 failed) … … 299 303 process and an additional column with error messages: 300 304 301 >>> print open('newcomers. create.pending.csv').read()305 >>> print open('newcomers.pending.csv').read() 302 306 owner,name,taxpayer,dinoports,--ERRORS-- 303 307 Barney,Barneys Home,1,2,This object already exists. Skipping. … … 322 326 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 323 327 ... mode='update', user='Bob') 324 (4, 0 )328 (4, 0, '...', None) 325 329 326 330 Now we want to tell, that Wilma got an extra port for her second dino: … … 339 343 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 340 344 ... mode='update', user='Bob') 341 (1, 0 )345 (1, 0, '...', None) 342 346 343 347 >>> wilma = stoneville['Wilmas Asylum'] … … 356 360 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 357 361 ... mode='update', user='Bob') 358 (1, 1 )362 (1, 1, '/.../newcomers.finished.csv', '/.../newcomers.pending.csv') 359 363 360 364 Also invalid values will be spotted: … … 367 371 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 368 372 ... mode='update', user='Bob') 369 (1, 1 )373 (1, 1, '...', '...') 370 374 371 375 We can also update only some cols, leaving some out. We skip the … … 379 383 >>> processor.doImport('newcomers.csv', ['name', 'owner'], 380 384 ... mode='update', user='Bob') 381 (1, 0 )385 (1, 0, '...', None) 382 386 383 387 >>> wilma.owner … … 410 414 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 411 415 ... mode='update', user='Bob') 412 (1, 0 )416 (1, 0, '...', None) 413 417 414 418 >>> wilma.dinoports is None … … 424 428 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 425 429 ... mode='update', user='Bob') 426 (1, 0 )430 (1, 0, '...', None) 427 431 428 432 >>> wilma.dinoports is None … … 442 446 >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'], 443 447 ... mode='remove', user='Bob') 444 (1, 0 )448 (1, 0, '...', None) 445 449 446 450 >>> sorted(stoneville.keys()) … … 454 458 >>> import os 455 459 >>> os.unlink('newcomers.csv') 456 >>> os.unlink('newcomers. create.pending.csv')460 >>> os.unlink('newcomers.finished.csv') 457 461 >>> os.unlink('stoneville.log')
Note: See TracChangeset for help on using the changeset viewer.