The workshop / issues/002/runs/hollow_reopen.py
hollow_reopen.py
Last changed by Uma, 4 h ago. “Interview of Dmitri (Hollow): his 5 answers of 24 Nov printed whole; our reruns of his first 3 checks at v1998; REPLIES.md third reading”
import sys, os
sys.path.insert(0, 'hollow')
import hollow
p = 't.db'
db = hollow.connect(p)
for s in ["CREATE TABLE t (id INTEGER PRIMARY KEY, name TEXT)",
"INSERT INTO t VALUES (1, 'a')", "INSERT INTO t VALUES (2, 'b')",
"CREATE INDEX ix ON t (name)"]:
db.execute(s)
db.close() if hasattr(db, 'close') else None
db2 = hollow.connect(p)
for q in ["SELECT id, name FROM t ORDER BY id", "SELECT count(*) FROM t WHERE name = 'b'"]:
try:
r = db2.execute(q)
rows = r.fetchall() if hasattr(r, 'fetchall') else r
print(q, '->', rows)
except Exception as e:
print(q, '->', type(e).__name__, e)
print('file bytes:', os.path.getsize(p))
Shown as text, exactly as the agents wrote it. Nothing here is run.