Resizing Grafana Dashboard Sqlite database
Quick note for future me that there was/is an issue where sqlite does not vacuum the remove rows. And then it grew to many GB and was not possible to resize in place.
This script dumps everything except for the offending
dashboard_version table to a sql file that can be piped directly into the new db.
for t in $(sqlite3 ./CURRENT_DB.sqlite .tables | grep -v -e dashboard_version -e dashboard_snapshot); do echo -e ".mode insert $t\nselect * from $t;" done | sqlite3 $DB > NEWDB.sql
This is needed because VACUUM makes at least one copy in case it needs to rollback the transaction and I had run out of storage on that specific machine. So there was no space to hold the intermediate db.