Image: Pexels - Pixabay

Sqlite3 output to .csv

snippets Mar 28, 2023

Every now and then I'm in need of exporting some data from an SQLite3 database to .csv . And every time i just end up looking it up on the internet.

Below is just a quick snippet of outputting a query to a .csv file,

.headers on
.mode csv
.separator ;
.output filename.csv
select * from something;
.output stdout

And that's it :)


Riccardo B.

Riccardo is an all round Linux Systems Engineer with over 20 years of experience and a knack for Automation. Favoring acronyms like NAO, IaC, SRE and more. Also hardly ever writes in third person :)