# Read-only inspection of the fresh server database supplied as the argument. import sqlite3,sys,json,datetime,pathlib connection=sqlite3.connect('file:'+str(pathlib.Path(sys.argv[1]).resolve())+'?mode=ro',uri=True) rows=connection.execute("select t.title,m.role,json_extract(m.payload_json,'$.text') from orchestration_v2_projection_threads t join orchestration_v2_projection_messages m using(thread_id) where t.title like '%control' or t.title like '%bookkeeping%' order by t.title,m.role").fetchall() print(json.dumps([dict(title=t,role=r,text=x) for t,r,x in rows],indent=2))