sqlite-utils csv data.db "select ..." command

This commit is contained in:
Simon Willison 2019-01-25 07:50:20 -08:00
commit c83dd8a5eb
3 changed files with 55 additions and 0 deletions

View file

@ -6,6 +6,17 @@
The ``sqlite-utils`` command-line tool can be used to manipulate SQLite databases in a number of different ways.
Running queries and returning CSV
=================================
You can execute a SQL query against a database and get the results back as CSV like this::
$ sqlite-utils csv docs.db "select id, title, author from documents"
This will default to including the column names as a header row. To exclude the headers, use ``--no-headers``:
$ sqlite-utils csv docs.db "select id, title, author from documents" --no-headers
Listing tables
==============