Changeset 4912
- Timestamp:
- 27 Jan 2010, 21:12:02 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/trunk/src/waeup/utils/batching.txt
r4903 r4912 337 337 >>> shutil.rmtree(os.path.dirname(result[2])) 338 338 339 340 We can also tell to ignore some cols from input by passing 341 ``--IGNORE--`` as col name: 342 343 >>> result = processor.doImport('newcomers.csv', ['name', 344 ... '--IGNORE--', '--IGNORE--'], 345 ... mode='update', user='Bob') 346 >>> result 347 (4, 0, '...', None) 348 349 Clean up: 350 351 >>> shutil.rmtree(os.path.dirname(result[2])) 352 353 If something goes wrong during processing, the respective --IGNORE-- 354 cols will be populated correctly in the resulting pending file: 355 356 >>> result = processor.doImport('newcomers.csv', ['name', 'dinoports', 357 ... '--IGNORE--', '--IGNORE--'], 358 ... mode='create', user='Bob') 359 >>> result 360 (4, 4, '...', '...') 361 362 >>> print open(result[3], 'rb').read() 363 --IGNORE--,name,--IGNORE--,dinoports,--ERRORS-- 364 Barney,Barneys Home,1,2,This object already exists. Skipping. 365 Wilma,Wilmas Asylum,1,1,This object already exists. Skipping. 366 Fred,Freds Dinoburgers,0,10,This object already exists. Skipping. 367 Joey,Joeys Drive-in,0,110,This object already exists. Skipping. 368 369 The first ignored column ('owner') provides different contents than 370 the second one ('taxpayer'). 371 372 Clean up: 373 374 >>> shutil.rmtree(os.path.dirname(result[2])) 375 376 377 378 339 379 Updating entries 340 380 ----------------
Note: See TracChangeset for help on using the changeset viewer.