Re:SQLite in Production: Optimizing WAL Mode, Concurrency, a...
by simonw on Wednesday July 29, 2026 @12:37PM
(#49099725)
Correction to the above: it should use
json_type(data, '$.name') IS 'text'
Using = fails because a missing key returns null and in SQLite null = 'text' is null: https://latest.datasette.io/_memory/-/query?sql=select+null%...A CHECK constraint only fails when the expression is false, NULL counts as passing.
You can define constraints on a column that ensure it is text that's valid JSON for example:
Or to ensure specific keys: You can even use this for things like enforcing a valid YYYY-MM-DD date, though that gets a bit convoluted: