joereynolds / joereynolds/SQHell.vim

Export to CSV?

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Vim Script
Stars
132
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Could be a potential thing to add

How it should work:
Call `sqhell#Export`
This will proxy down to the provider of choice.
We'll need to store the last query executed so we can re-run it and export it. Since we can have multiple windows, to avoid conflicts, we should store the query in a variable that also contains the SQHResult buffer's id.

A MySql version will work like this

`:SQHExport` -> `sqhell#Export()` -> `mysql#Export()`

Runs the current query and appends the following
```
INTO OUTFILE 'argument from SQHExecute'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
```

Note that this only works on selects, obviously.

Contributor guide

Open the contributing guide

Research direction

Start at the :SQHExport command and trace the sqhell#Export and mysql#Export entry points, including how SQHExecute identifies the current query and SQHResult buffers. Done means SELECT queries can be exported through the chosen provider without conflicts between multiple windows, with the described CSV formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, sql, vim
Domain
database, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.