You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously the csv/tsv output would output the total row count at the beginning, now it does at the end.
@bdarnell suggests: having the row count at the end makes parsing difficult. Do we really need it?
Initially I thought that the row count was useful at least for humans so that a csv/tsv output on the screen can be easily sized (humans are not good at counting manually). So Ben suggested we only display the row count when interactive, which is indeed a simple change.
However after thinking this some more I realized that we have another need: when a client issues multiple queries one after another, we also need a delimiter to separate result batches. This is especially true for csv/tsv where otherwise there would be no delimiter and no way to distinguish the column header of a new result batch from an extra row in the previous batch.
That said, the row count is not a very good delimiter either -- it is a variable string and thus difficult to match.
So instead I propose to do the following:
make the row count only appear on interactive shells by default (perhaps with an option to hide/show it)
add two new options "footer" and "header", with footer set to "--" by default, to be printed before and after result batches
The common case is a single query; this should not print a header/footer/delimiter by default. I think a delimiter (printed in between results) makes more sense than a header/footer (printed with every result), but I'd be OK with a header/footer as long as it's only used when there are multiple queries (or maybe if the footer is a blank line - something that CSV parsers won't choke on)
I like the blank line the best. It is visually unintrusive while being extremely reliable (you can't have a blank line as part of a field without quotes). I will do that and avoid the feature bloat altogether.
Previously the csv/tsv output would output the total row count at the beginning, now it does at the end.
@bdarnell suggests: having the row count at the end makes parsing difficult. Do we really need it?
Initially I thought that the row count was useful at least for humans so that a csv/tsv output on the screen can be easily sized (humans are not good at counting manually). So Ben suggested we only display the row count when interactive, which is indeed a simple change.
However after thinking this some more I realized that we have another need: when a client issues multiple queries one after another, we also need a delimiter to separate result batches. This is especially true for csv/tsv where otherwise there would be no delimiter and no way to distinguish the column header of a new result batch from an extra row in the previous batch.
That said, the row count is not a very good delimiter either -- it is a variable string and thus difficult to match.
So instead I propose to do the following:
@bdarnell would this be adequate?
The text was updated successfully, but these errors were encountered: