How to make .sqliterc commands be quiet? How to make .sqliterc commands be quiet? sqlite sqlite

How to make .sqliterc commands be quiet?


The answer is yes! This is the best way I found, at least.

Warning! This is a bit hackish, and hides some of the reminder "warnings" you might see if you do the non-recommended practice of putting PRAGMA commands in .sqliterc, in the first place!

Sidebar: When researching this, you might get mislead by .echo on and .echo off but that doesn't do what we want. Echo is OFF by default, and that's fine. The .echo setting is left as an exercise for the reader.

Answer: Use the .output setting. Set /dev/null as the output for all commands, and then set the output back to the default stdout at the end. (Or use /tmp/somefile or whatever you want, if you want some record of what you junked.)

Fixed .sqliterc file:

.output /dev/nullPRAGMA synchronous = OFF;PRAGMA foreign_keys = ON;PRAGMA journal_mode = MEMORY;PRAGMA locking_mode = EXCLUSIVE;PRAGMA cache_size = -500000;.output stdout

Now you can wrap as many .dot and PRAGMA commands as you want inside that output "wrapper", and you will never be bothered by their uncontrollable verbosity!

P.S. As a bonus, you now have my recommended 5 performance PRAGMA lines for using sqlite3, with props to Improve INSERT-per-second performance of SQLite? . (Mine has a 500 MB cache size; season to taste.)