dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Import-DbaCsv ignored data

Open GrumpyVader opened this issue 5 years ago • 4 comments

Is there a way to view or log bad rows of data that are encountered during a data import while using -ParseErrorAction AdvanceToNextLine option?

GrumpyVader avatar Oct 01 '20 21:10 GrumpyVader

@GrumpyVader , after looking into this issue it seems these changes are needed:

  1. The Import-DbaCsv command would need to add the 'RaiseEvent' as a valid ParseErrorAction. The ParseError event can then be registered and the events themselves can then be returned with the final custom object.
  2. The CsvReader library needs a fix so that the RaiseEvent doesn't stop processing the csv file when an error is encountered. That issue is logged here: https://github.com/phatcher/CsvReader/issues/77

CsvReader as a project appears to be going dormant, so another option is for Import-DbaCsv to use a different csv parser.

lancasteradam avatar Nov 27 '20 21:11 lancasteradam

I'm just adding my voice to the chorus of this request. Thanks for already pursuing the feature implementation and fix in the relevant projects!

jameslancaster avatar Dec 11 '20 00:12 jameslancaster

https://www.nuget.org/packages/CsvHelper/ looks good

potatoqualitee avatar Jun 23 '21 22:06 potatoqualitee

Any updates on this issue? Namely this part: The CsvReader library needs a fix so that the RaiseEvent doesn't stop processing the csv file when an error is encountered. That issue is logged here: https://github.com/phatcher/CsvReader/issues/77

mike347 avatar Jul 21 '22 23:07 mike347