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

Don't throw a honeybadger error on importing a blank csv #58761

Merged
merged 3 commits into from
May 22, 2024

Conversation

snickell
Copy link
Contributor

@snickell snickell commented May 20, 2024

Fixes #58754, which came from a honeybadger error

Was able to repro the honeybadger error by importing a blank CSV. After this PR, its succeeds silently.

records.insert_all(), invoked by create_records which is invoked by import_csv throws ArgumentError: Empty list of attributes passed if called with an empty list of record_json. This means importing a blank .csv file silently raises an error, when its really a reasonable thing to import (blank table). We detect this condition and successfully insert nothing.

@snickell snickell requested a review from cnbrenci May 20, 2024 10:59
@cnbrenci
Copy link
Contributor

Do we want this to be a supported path, actually? I can't imagine someone would do this on purpose, and since it's a destructive operation on the existing table content, it feels like we should throw up a modal and block the action instead?

@snickell
Copy link
Contributor Author

snickell commented May 21, 2024

I went back and forth on this, but landed here. I take it this means you disagree? I'm working on implementing the other approach, should have something in a sec.

@snickell
Copy link
Contributor Author

Now we raise this dialog on the PR, whatcha think?
image

Copy link
Contributor

@cnbrenci cnbrenci left a comment

Choose a reason for hiding this comment

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

Yaay! I think this is better, yeah. Cause then if they accidentally upload an empty file their table doesn't get wiped. Thank you for appeasing me 😁

@snickell snickell merged commit c19dd45 into staging May 22, 2024
2 checks passed
@snickell snickell deleted the datablock/import-empty-csv branch May 22, 2024 04:48
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.

import_csv: ArgumentError: Empty list of attributes passed
2 participants