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

Full query result export, e.g. as CSV #144

Open
JohannesFKnauf opened this issue Oct 21, 2020 · 1 comment
Open

Full query result export, e.g. as CSV #144

JohannesFKnauf opened this issue Oct 21, 2020 · 1 comment

Comments

@JohannesFKnauf
Copy link

Quite often, when doing interactive analysis, I want to save all results into a file for later use, e.g. as CSV. This is similar to what you get in Oracle's SQL Developer when you right-click on the result browser and choose "Export".

I could not find this feature in EJC's documentation. I would also be happy to implement it and contribute it, if somebody gives me a bit of guidance how to start.

@kostafey
Copy link
Owner

kostafey commented Oct 21, 2020

Hello, @JohannesFKnauf! That is pretty easy. The actual behavior of ejc-sql is to print the result dataset to the file (in pain text table format). Then JVM notifies Emacs: "data printed into filepath, please refresh the output buffer".

So, all you need is to provide your own ResultSet printer for any desired format like for plain text table here:
https://github.com/kostafey/ejc-sql/blob/master/src/ejc_sql/output.clj#L182

Then, the actual output format can be customized as an optional parameter the same way as add-outside-borders do:

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

2 participants