[DRAFT] Change table load to retain original header row, for improved errors #1788
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the error when you have the wrong number of columns listed is better than it was originally (relating to #1779), but it still makes no reference to the headers in the source itself.
In the case that we are loading from a CSV (or, google sheets?) it seems like we should show that header row when we display the error, ideally in a form that could be copied and pasted.
This is definitely a draft -- it doesn't touch the google sheet code (which I don't know where lives -- CPO?), and I'm not sure if this is the right way to retain that info, but throwing out the header row immediately makes it impossible to report a good error.
With this change, mismatches report the header columns that showed up in the CSV (if present), as well as the first data row (as an example). The
c-str
s aren't ideal, but I didn't want to spend time refining in case there is another approach that would be better (also, they were already there with current behavior).