-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show errors for Csvlint-valid files CSV library can't parse
Currently, you are allowed to proceed to run the pre-processing job with such a file, but the job fails when processing hits a row that causes a CSV::MalformedCSVError. Unfortunately, this often occurs at the very end of the file. This commit adds a separate `csv_parse_validator_for(batch)` method that is only called if Csvlint reports the file is valid. CSV-Parsing the whole file before creating the batch may seem like overkill, but (a) I can't come up with a better way to catch all possible issues; and (b) it seems better than using system resources/user time to pre-process a whole batch that is only going to fail at the end. Thinking forward: If we are eventually moving to using the database to store information about each row and its state/status, then this step can be reworked to serve a dual purpose: (1) prepare each row to be added to database if we are able to prepare all rows successfully; and (2) if not able to prepare all rows successfully, show error messages and destroy batch. Show errors for Csvlint-valid files CSV library can't parse Currently, you are allowed to proceed to run the pre-processing job with such a file, but the job fails when processing hits a row that causes a CSV::MalformedCSVError. Unfortunately, this often occurs at the very end of the file. This commit adds a separate `csv_parse_validator_for(batch)` method that is only called if Csvlint reports the file is valid. CSV-Parsing the whole file before creating the batch may seem like overkill, but (a) I can't come up with a better way to catch all possible issues; and (b) it seems better than using system resources/user time to pre-process a whole batch that is only going to fail at the end. Thinking forward: If we are eventually moving to using the database to store information about each row and its state/status, then this step can be reworked to serve a dual purpose: (1) prepare each row to be added to database if we are able to prepare all rows successfully; and (2) if not able to prepare all rows successfully, show error messages and destroy batch.
- Loading branch information
Showing
6 changed files
with
183 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
obj,note | ||
val,val | ||
val,val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
obj,note | ||
val,val | ||
val,val | ||
|