# Task 12 — Export: SQLite ## Goal Portable single-file SQLite database conforming to the ontology. ## Input - `canonical/` snapshot, `schema/ddl_postgresql.sql`. ## Actions 1. Write `scripts/export_sqlite.py`: translate DDL to SQLite dialect (bigint→INTEGER, timestamptz→TEXT ISO, keep FKs), create `exports/sqlite/labdata.sqlite`. 2. Bulk-load in dependency order (hierarchy → lookups → headers → points); `executemany` in transactions; create indexes after load; `PRAGMA journal_mode=OFF, synchronous=OFF` during load, `ANALYZE` after. 3. Load `measurement_types`, `column_definitions`, `instruments` tables; add `lineage` table (row-range level, not per-row, to bound size). ## Intermediate Result (done when) - `labdata.sqlite` opens; per-table row counts equal canonical counts; FK integrity check passes (`PRAGMA foreign_key_check` empty). - `exports/sqlite/EXPORT_MANIFEST.json` written.