Skip to content

Feature request: export query results as CSV #354

@ramontayag

Description

@ramontayag

Thanks for maintaining this plugin! It's become essential to my workflow.

The idea

A command (e.g. :DBUIExportCSV) that exports the current query's results as CSV.

Why

Query results in the buffer are great for inspection, but sharing or importing into other tools (spreadsheets, scripts) means manually reformatting. CSV is the most universal interchange format for tabular data.

Suggested approach

Rather than parsing the ASCII table output, the adapter layer could re-run the query using the database CLI's native CSV output mode:

  • psql: -P format=csv
  • mysql: --batch --raw (produces tab-separated; trivial to convert)
  • sqlite3: -csv -header

vim-dadbod's db#adapter#dispatch() already supports additional arguments, so CSV flags could be passed through without major plumbing changes.

Related

Happy to help with implementation if this is something you'd want in the plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions