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

Make tsv outputFormat configurable like csv #438

Closed
richardantal opened this issue Jun 4, 2021 · 7 comments
Closed

Make tsv outputFormat configurable like csv #438

richardantal opened this issue Jun 4, 2021 · 7 comments

Comments

@richardantal
Copy link

SQLLINE-50 made it possible to specify delimiter and quote character for CSV output format.
Make it for the tsv format as well.

Before the commit c1bda8d
the tsv separator was ' and after this it became the DEFAULT_QUOTE_CHARACTER which is ".
It caused a behaviour change which some users didn't like.

@richardantal
Copy link
Author

I went ahead and created a PR for this: #439

@julianhyde
Copy link
Owner

Thanks for this contribution. I have a few questions in order to understand why it is necessary.

What's the difference between CSV and TSV, besides the difference in delimiter (comma vs tab). So if the delimiter is configurable in CSV, isn't that sufficient to create any delimited format? Why do your users want to configure TSV instead?

Could we make a smaller change, such as to add DEFAULT_TSV_QUOTE_CHARACTER?

I'd like to encourage users to customize CSV and keep TSV a more limited variation.

@richardantal
Copy link
Author

Your point makes sense to create any format with CSV, although I didn't find it easy to use.
If you write !set csvDelimiter "\t" it would write there \t literally.
I had to write an actual tab there with control + V followed by the tab key (on mac) which is not the easiest at best. With TSV you have tab by default.

If you say that we should keep TSV to a more limited version I think setting tab as a separator in CSV should be fixed.

@julianhyde
Copy link
Owner

Handling \t makes sense.

@snuyanzin, What do you think we should do? Make TSV more like CSV, or keep TSV as is and make CSV more configurable? Or, I suppose, a new format DSV (delimiter-separated values) that is configurable.

@snuyanzin
Copy link
Collaborator

sorry, somehow I missed this ...
From my point of view as of now CSV is already configurable as DSV. The thing that is missed is support of tabs and other similar symbols. May be this should be fixed.
I would go with the fixed CSV option.
However the downside of such approach is a potential inconvenience for users moving to a new sqlline version.
Otherwise yes DSV is a way, moreover beeline also has DSV as an option

@snuyanzin
Copy link
Collaborator

another possible solution to that
jline3 has a configuration property to define if a TAB will invoke a completion or will it print a normal \t symbol. Changing of this behavior could be done via widgets during typing (same way color schema or line numbers switching).
So no need of copy-paste work to insert \t as a symbol.
Moreover completion itself could be invoked not only by TAB, but also by ctrl-i key-stroke (this is mentioned in sqlline help)

@richardantal
Copy link
Author

I'm closing this PR as csv is configurable and it is posible to set the csvDelimiter to tab if you write there an actual tab character, or copy it yes.

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

No branches or pull requests

3 participants