Track timestamped changes to a SQLite table using triggers
This is more of a "today I figured out" than a TIL. I have an idea to implement the Denormalized Query Engine design pattern using SQLite triggers.
Notes on software engineering
421–440 of 550 posts, newest first.
This is more of a "today I figured out" than a TIL. I have an idea to implement the Denormalized Query Engine design pattern using SQLite triggers.
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…
My tools.simonwillison.net site is a growing collection of small HTML and JavaScript applications hosted as static files on GitHub Pages.
I decided to make a GitHub repository public today that had previously been private. Unfortunately the revision history of that repository included some secret values, one of which I could not figure…
You can search for a string in any resource loaded by a page (including across HTML, JavaScript and CSS) in the Debugger pane by hitting Command+Shift+F.
Inspired by this tweet by Mike Driscoll I decided to try using Fabric to run commands over SSH from a Python script, using a public key for authentication.
I wanted to browse a backup copy of my Plex database, which is a SQLite file. I tried this: The module is an optional module for SQLite.
I tried using a gin index to speed up queries against a column. PostgreSQL: More performance for LIKE and ILIKE statements provided useful background.
I ran a Google search this morning for and when I clicked on the top result it jumped me to a highlighted snippet of text on the page, despite that page not having relevant anchor links.
For complicated reasons I found myself wanting to write Python code to resolve a graph of dependencies and produce a plan for efficiently executing them, in parallel where possible.
The GitHub Code Search beta is really powerful - it allows advanced search - including regular expression matches - against every public repo on GitHub.
I wanted to include some example Python tests in the Datasette documentation - but since they were tests, I also wanted to execute them as part of my test suite to make sure they worked correctly.
Via Brian LeRoux I found single-file-web-component.html by Kristofer Joseph. It's really clever! It demonstrates how to build a custom Web Component in a single HTML file, using some neat tricks.
I wanted to use the GitHub GraphQL API to return all of the repositories on the https://github.com/topics/git-scraping page.
David Beazley on Twitter: So, I just published this deliciously evil spin on dataclasses. It's tiny and the resulting classes import about 15-20 faster than dataclasses.
I had a long-running process and I wanted to check that it was at least doing something . I know its PID (32425 in this case) - here's how to use to see what it's doing right now.
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 say "output this transformed value if it's not null, otherwise nothing". The recipe I figured out was: Full query example: This uses datasette-rure for the function.
For my git-history live demos I needed to store quite large files ( 200MB SQLite databases) in between GitHub Actions runs, to avoid having to recreate the entire file from scratch every time.
I figured out a pattern for doing this today using the CLI tool - given two SQLite databases in the current folder, called and : I'm using that in this GitHub Actions workflow.