- Published on
Sqlite-utils 4.1
- Authors

- Name
- DeepHorus
Simon Willison released sqlite-utils 4.1 on July 11, 2026, the first dot-release following the major 4.0 update. The new version introduces several minor but practical features aimed at simplifying database operations and addressing long-standing user requests. sqlite-utils is a widely used command-line tool and Python library for manipulating SQLite databases, known for its ability to import, export, and transform data with minimal code.
The most notable addition is the --code option for the insert and upsert commands, allowing users to provide a block of Python code that defines a rows() function or iterable of rows to be inserted. This extends an existing pattern used for the convert command, enabling direct row generation from inline code. For example, users can now write sqlite-utils insert data.db creatures --code ' def rows(): yield {"id": 1, "name": "Cleo"}' --pk id without needing an external file.
Another key feature is the --type flag for insert and upsert, which overrides the automatically inferred column type when creating a table. This is particularly useful for CSV or TSV columns like ZIP codes that appear as integers but should be stored as TEXT to preserve leading zeros. Willison noted that this long-standing request turned out to be simple to implement, closing issue #131.
The release also adds a table.drop_index(name) method and a corresponding sqlite-utils drop-index command, both supporting ignore=True to silently handle missing indexes. Additionally, the query command can now read SQL from standard input by passing - as the query argument, enabling pipe-based workflows like echo "select * from dogs" | sqlite-utils query dogs.db -.
Several improvements were driven by Willison's use of Codex to review open issues and identify easy wins. For instance, sqlite-utils upsert can now infer the primary key of an existing table, making the --pk flag optional when upserting into a table that already has one. This feature was another Codex suggestion that filled an obvious gap from the 4.0 release.
A significant enhancement is support for SQLite's strict mode in table transformations. The table.transform() and table.transform_sql() methods now accept strict=True or strict=False to change a table's strict mode, while the sqlite-utils transform command adds --strict and --no-strict flags. This was inspired by Evan Hahn's article on preferring strict tables, which highlighted the inability to alter a table's strict mode directly. Willison recognized that his transform mechanism, which copies data out and recreates the table, provides a workaround.
Willison shared a transcript of his interactions with GPT-5.6 Sol xhigh Codex, noting that one of the most useful prompts was instructing the model to manually test the new strict option outside of automated tests. This uncovered two minor bugs that were fixed before release. Looking ahead, sqlite-utils continues to evolve through community feedback and clever use of AI assistance, promising further refinements in upcoming releases.