(This was originally a reply to https://news.ycombinator.com/item?id=41339138 but I detached it so the useful link could float higher in the thread - thanks!)
I wrote up a few extra notes about how I did this here: https://simonwillison.net/2024/Aug/24/pipe-syntax-in-sql/
https://static.simonwillison.net/static/2024/Pipe-Syntax-In-...