Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for case where CSV Row has too many columns #594

Merged
merged 2 commits into from
Jan 27, 2022

Conversation

prescod
Copy link
Contributor

@prescod prescod commented Jan 27, 2022

Better error checking for the case where a CSV Row has too many columns.

@prescod prescod requested a review from a team as a code owner January 27, 2022 21:37
Copy link
Contributor

@jofsky jofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add docstrings!

@prescod prescod merged commit f04205b into main Jan 27, 2022
@prescod prescod deleted the feature/check-csv-not-too-many-columns branch January 27, 2022 22:03
def plugin_result(self, row):
if None in row:
raise DataGenError(
f"Your CSV row has more columns than the CSV header: {row[None]}, {self.datasource}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be helpful to indicate which row had the problem

@prescod
Copy link
Contributor Author

prescod commented Jan 28, 2022 via email

@davisagli
Copy link
Contributor

@prescod Yeah I understand what it does, and it doesn't sound as helpful as a line number if the extra values happen to also appear in legitimate column positions.

@prescod
Copy link
Contributor Author

prescod commented Jan 28, 2022 via email

@davisagli
Copy link
Contributor

It's hard to imagine that incrementing a counter would affect performance noticeably, but the concern with performance here seems fair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants