Simon Willison’s Weblog

Newsletter
Atom feed for sqlite Random

885 posts tagged “sqlite”

2020

Bedrock: The SQLitening (via) Back in March 2018 www.mozilla.org switched over to running on Django using SQLite! They’re using the same pattern I’ve been exploring with Datasette: their SQLite database is treated as a read-only cache by their frontend servers, and a new SQLite database is built by a separate process and fetched onto the frontend machines every five minutes by a scheduled task. They have a healthcheck page which shows the latest version of the database and when it was fetched, and even lets you download the 25MB SQLite database directly (I’ve been exploring it using Datasette).

# 7th October 2020, 11:47 pm / django, mozilla, sqlite, datasette, baked-data

None
TIL Figuring out if a text value in SQLite is a valid integer or float — Given a table with a `TEXT` column in SQLite I want to figure out if every value in that table is actually the text representation of an integer or floating point value, so I can decide if it's a good idea to change the type of the column (using [sqlite-utils transform](https://sqlite-utils.datasette.io/en/stable/python-api.html#transforming-a-table)).

Weeknotes: software carpentry, compiling modules for SQLite

Visit Weeknotes: software carpentry, compiling modules for SQLite

This week I completed the Software Carpentry instructor training course, added two foundational features to sqlite-utils and learned how to compile modules for SQLite.

[... 805 words]

Release sqlite-utils 2.21 — Python CLI utility and library for manipulating SQLite databases

Refactoring databases with sqlite-utils extract

Visit Refactoring databases with sqlite-utils extract

Yesterday I described the new sqlite-utils transform mechanism for applying SQLite table transformations that go beyond those supported by ALTER TABLE. The other new feature in sqlite-utils 2.20 builds on that capability to allow you to refactor a database table by extracting columns into separate tables. I’ve called it sqlite-utils extract.

[... 1,345 words]

Executing advanced ALTER TABLE operations in SQLite

Visit Executing advanced ALTER TABLE operations in SQLite

SQLite’s ALTER TABLE has some significant limitations: it can’t drop columns (UPDATE: that was fixed in SQLite 3.35.0 in March 2021), it can’t alter NOT NULL status, it can’t change column types. Since I spend a lot of time with SQLite these days I’ve written some code to fix this—both from Python and as a command-line utility.

[... 689 words]

Release sqlite-utils 2.20 — Python CLI utility and library for manipulating SQLite databases
Release dogsheep-beta 0.9a0 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release sqlite-utils 2.19 — Python CLI utility and library for manipulating SQLite databases

DuckDB (via) This is a really interesting, relatively new database. It’s kind of a weird hybrid between SQLite and PostgreSQL: it uses the PostgreSQL parser but models itself after SQLite in that databases are a single file and the code is designed for use as an embedded library, distributed in a single amalgamation C++ file (SQLite uses a C amalgamation). It features a “columnar-vectorized query execution engine” inspired by MonetDB (also by the DuckDB authors) and is hence designed to run analytical queries really quickly. You can install it using “pip install duckdb”—the resulting module feels similar to Python’s sqlite3, and follows roughly the same DBAPI pattern.

# 19th September 2020, 11:43 pm / databases, postgresql, sqlite, duckdb

Release dogsheep-beta 0.8 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.7.1 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.7 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release github-to-sqlite 2.6 — Save data from GitHub to a SQLite database

Weeknotes: datasette-dump, sqlite-backup, talks

I spent some time this week digging into Python’s sqlite3 internals. I also gave two talks and recorded a third, due to air at PyGotham in October.

[... 928 words]

Release dogsheep-beta 0.7a0 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release sqlite-utils 2.18 — Python CLI utility and library for manipulating SQLite databases
Release sqlite-utils 2.17 — Python CLI utility and library for manipulating SQLite databases
Release sqlite-dump 0.1.1 — An improved version of .iterdump() for sqlite3
Release sqlite-dump 0.1 — An improved version of .iterdump() for sqlite3
Release sqlite-dump 0.1a — An improved version of .iterdump() for sqlite3
Release dogsheep-beta 0.6 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.5 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.4.1 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.4 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.4a1 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.4a0 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.3 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.2 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette
Release dogsheep-beta 0.1 — Build a search index across content from multiple SQLite database tables and run faceted searches against it using Datasette