# sqlite-utils

> Python CLI tool and library for creating, populating, querying and transforming SQLite databases.

sqlite-utils is an open-source Python command-line utility and library for manipulating SQLite databases, created by Simon Willison as a complement to Datasette. The current stable release documented is 4.2.1, published 2026-08-13. Most functionality is available through both the `sqlite-utils` CLI and the `sqlite_utils` Python API.

## What It Is

sqlite-utils helps create SQLite databases from existing collections of data and populate them productively. The documentation states it is not intended to be a full ORM; the focus is on utility helpers for building the initial database and loading data into it.

## Workflow and Outputs

Users can pipe JSON, CSV or TSV into a new database file, with a table and schema created automatically. The `memory` command loads CSV or JSON into an in-memory database so SQL queries, including joins, can run in a single command. Query results can be returned as JSON, CSV, TSV or formatted tables. The Python library offers equivalent operations such as bulk inserts, upserts, and table creation with primary and foreign keys.

## Schema and Maintenance Tools

The tool supports table transformations for changes SQLite's ALTER TABLE does not directly support, such as changing a column type. It can extract columns into separate lookup tables for normalization, configure full-text search, enable WAL mode, cache table counts, and dump databases to SQL. SpatiaLite helpers are included, and database migrations can be defined in Python files and applied with `sqlite-utils migrate`.

## Extensibility and Setup

Plugins can add custom SQL functions and additional commands through the register_commands and prepare_connection hooks. Installation is via pip, pipx or Homebrew. A 4.0 upgrade guide covers changes from 3.x.

## Features
- Insert JSON, CSV or TSV data into SQLite with automatic schema creation
- In-memory SQL queries against CSV, TSV or JSON files
- Full-text search configuration and search queries
- Table transformations beyond ALTER TABLE
- Extract columns into separate lookup tables
- Database migrations via Python files
- Plugin system for custom SQL functions and commands
- SpatiaLite helpers
- Python library API
- JSON, CSV and table output formats

## Integrations
Datasette, SpatiaLite, Homebrew, pip, pipx

## Platforms
WINDOWS, MACOS, LINUX, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
4.2.1

## Links
- Website: https://sqlite-utils.datasette.io
- Documentation: https://sqlite-utils.datasette.io/en/stable/
- Repository: https://github.com/simonw/sqlite-utils
- EveryDev.ai: https://www.everydev.ai/tools/sqlite-utils
