Mapping SQLite Result Columns Back to Their Source table.column
Simon Willison's Weblog·6 hours ago·Tutorial
Simon Willison explored how to programmatically map SQLite query result columns back to their source table and column names — a capability that would let Datasette enrich query results with contextual metadata. He tasked Claude Code (Opus 4.8) with finding solutions, which surfaced three approaches: using the apsw library, calling SQLite's sqlite3_column_table_name() C function via Python ctypes, and parsing EXPLAIN bytecode output. The research is published as a GitHub README and covers the tradeoffs of each technique.