Files
wiki/diag.py
T
Sorin Savu dcc6bba61b upgrades
2026-07-13 09:51:28 +03:00

26 lines
880 B
Python

"""One-shot diagnostic for the truncated-import bug.
Run in the same shell where WIKI_DB_* are exported: python diag.py
"""
from pathlib import Path
import db
src = Path("work-notes.md").read_text()
print(f"source file: {len(src)} chars")
conn = db.connect()
with conn.cursor() as cur:
cur.execute("SHOW COLUMNS FROM notes LIKE 'body_md'")
col = cur.fetchone()
print(f"body_md column type: {col['Type']!r} <-- should be 'mediumtext'")
cur.execute("SELECT slug, CHAR_LENGTH(body_md) AS n, body_md FROM notes WHERE slug='work-notes'")
row = cur.fetchone()
if not row:
print("no 'work-notes' note found")
else:
print(f"stored body: {row['n']} chars")
if row["n"] < len(src):
print(f"TRUNCATED by {len(src) - row['n']} chars")
print("...last 80 stored chars:", repr(row["body_md"][-80:]))
conn.close()