Today I heard about the sqlite3-rsync command, currently available in a branch in the SQLite code repository. It provides a mechanism for efficiently creating or updating a copy of a SQLite database that is running in WAL mode, either locally or via SSH to another server. …
Alex Garcia's sqlite-vec SQLite extension provides a bunch of useful functions for working with vectors inside SQLite. …
Today I learned about this: …
I continue to collect ways of tracking the history of a table of data stored in SQLite - see sqlite-history for previous experiments. …
Steampipe build software that lets you query different APIs directly from SQL databases. …
TG is an exciting new project in the world of open source geospatial libraries. It's a single C file (an amalgamation, similar to that provided by SQLite) which implements the subset of geospatial operations that I most frequently find myself needing: …
cr-sqlite is fascinating. It's a loadable SQLite extension by Matt Wonlaw that "allows merging different SQLite databases together that have taken independent writes". …
I've been trying to figure this out for years. Previous notes include Using LD_PRELOAD to run any version of SQLite with Python (Linux only), and Building a specific version of SQLite with pysqlite on macOS/Linux and Using pysqlite3 on macOS (both using the pysqlite3
package). But the dream was always to find a way to let me easily run a different SQLite version with the sqlite3
module from the Python standard library directly on my Mac. …
I learned this trick today while browsing the code of Blacklite, a neat Java library for writing diagnostic logs to a SQLite database. …
In investigating llm/issues/164 I found myself needing to know more precise details of the Python SQLite environment used by the reporter of the bug. …
WizardLM is "an Instruction-following LLM Using Evol-Instruct". It's a fine-tuned model on top of Meta's LLaMA. The fine-tuning uses 70,000 instruction-output pairs from this JSON file: …
I wanted to retrieve the time in milliseconds since the Unix epoch in SQLite. …
I was messing around in Python with an in-memory SQLite database, when I decided I actually wanted to save my experimental database to a file so I could explore it using Datasette. …
I figured out a pattern for doing this today using the sqlite3
CLI tool - given two SQLite databases in the current folder, called tils.db
and simonwillisonblog.db
: …
I figured out a single SQL query for the following today. Given a table of GitHub repositories, for each repository return: …
I stumbled across an interesting little detail of SQLite today, running the following query: …
Here's how to use SQLite's VALUES
syntax with a CTE to create a temporary table that you can then perform joins against in a query: …
The SQLite pragma_function_list()
table-valued function returns a list of functions that have been registered with SQLite, including functions that were added by extensions. …
I finally found a workaround for this error when attempting to load a SQLite extension in Python on macOS: …
I noticed this morning that one of my Datasette installations had the Geopoly SQLite extension enabled. I don't know how it got there - it has to be compiled specifically - but since it was there I decided to try it out. …
Here's a trick I've been using to compare the rows in a table before and after I perform an operation against it. It works well for a few hundred (and maybe a few thousand) rows. …
I was trying to figure out if SQLite has the ability to use more than one index as part of executing a single query, or if it only ever picks a single index that it thinks will give the best performance. …
Google Chrome still includes support for Web SQL, the long since abandoned proposed standard for shipping a SQL engine in browser JavaScript. I was reminded of its existence today while reading about the new official sqlite3 wasm build. …
When building database-backed applications you'll often find yourself wanting to return a row from the database along with its related rows. …
I was trying to run VACUUM
against a large SQLite database file (~7GB) using sqlite-utils vacuum data.db
and I got this error: …
In reading Scraping JSON, HTML, and ZIP Files with Pure SQLite by Alex Garcia I got curious to see a full list of functions he had registered in his sqlite-extension-examples.fly.dev Datasette instance that weren't available in a regular Datasette. …
This post on Reddit asked how to run a query that takes a list of items (in this case ingredients) as the input and returns all rows with at least one of those items in a JSON list, ordered by the most matches. …
Alex Garcia has been building some really cool new custom extensions for SQLite, working in C and Go. So far he's released two: …
Today I added "related TILs" to this TIL website - so each TIL now shows five related TILs at the bottom of the page. …
I figured out how to run a SQL query directly against a CSV file using the sqlite3
command-line utility: …
When SQLite executes a query, it does so by executing a sequence of virtual machine operations. …
I found this really simple recursive CTE useful for ensuring I understood how to write recursive CTEs. …
Derek Willis has a Datasette instance full of political campaign emails running on Heroku. …
I was trying to use group_concat()
to glue together some column values into a stiched together Markdown document. My first attempt looked like this: …
Several of the SQLite JSON functions, such as json_extract()
and json_array_length()
, take a path argument. This uses custom syntax along the lines of $.a[2].b
, as described in the documentation here. …
This is more of a "today I figured out" than a TIL. …
I wanted the ability to test my Python software against specific version of SQLite on macOS. I found a way to do that using pysqlite3. …
SQLite supports aggregate filter clauses (as of 3.30.0, released 2019-10-04), as described in this SQL Pivot in all databases tutorial. …
I usually use my sqlite-utils insert blah.db tablename file.csv --csv
command to import CSV data into SQLite, but for large CSV files (like a 750MB one) this can take quite a long time - over half an hour in this case. …
While trying to use pysqlite3 on macOS I got the following error: …
This came up as a question on Hacker News. How can you query a SQLite database for items that were created on a Thursday in PST, when the data is stored in UTC? …
I had an input string in x,y,z
format and I needed to split it into three separate values in SQLite. I managed to do it using a confusing combination of the instr()
and substr()
functions. …
I was working with a database table that included values that were clearly in the wrong character encoding - values like this: …
Given a large, heterogeneous table I wanted to identify patterns in the rows in terms of which columns were not null. …
I tried out rqlite today, a "lightweight, distributed relational database, which uses SQLite as its storage engine". It uses the Raft consensus algorithm to allow multiple SQLite instances to elect a leader and replicate changes amongst themselves. …
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). …
I wanted to browse a backup copy of my Plex database, which is a SQLite file. I tried this: …
I was getting occasional Error: database is locked
messages from a Datasette instance that was running against a bunch of different SQLite files that were updated by cron scripts (my personal Dogsheep). …
I wanted to construct a string of SQL that would return a blob value: …
I've been wanting to figure this out for ages. This thread on Hacker News plus this Stackoverflow post gave me some initial clues. …
Here's a devious trick for listing ALL columns in a SQLite database, using a SQL query that generates another SQL query. …
I wanted to try the vacuum into
backup command that was released in SQLite3 3.27.0 on 2019-02-07. …
I wanted to say "output this transformed value if it's not null, otherwise nothing". The recipe I figured out was: …
Here's how to use a lag window function to calculate new cases per day when the table just has total cases over time on different dates. …