#!/bin/sh
python3 - <<'PY'
import sqlite3
for db in ('/tmp/.settings.db', '/tmp/.appliance.db'):
    print('==' * 3, db)
    c = sqlite3.connect(db)
    tabs = [r[0] for r in c.execute("select name from sqlite_master where type='table'")]
    print('tables:', tabs)
    for t in tabs:
        try:
            n = c.execute('select count(*) from "%s"' % t).fetchone()[0]
        except Exception as e:
            n = 'ERR'
        print('  %-30s %s' % (t, n))
PY
