Get the latest tech news

Supercharge SQLite with Ruby Functions


An interesting twist in my recent usage of SQLite was the fact that I noticed my research scripts and the database intertwine more. SQLite is unique in that it really lives in-process, unlike standalone database servers. There is a feature to that which does not get used very frequently, but can be indispensable in some situations. By the way, the talk about the system that made me me to explore SQLite in anger can now be seen here. Normally it is your Ruby (or Python, or Go, or whatever) program which calls SQLite to make it “do stuff”. Most calls will be mapped to a native call like sqlite3_exec() which will do “SQLite things” and return you a result, converted into data structures accessible to your runtime. But there is another possible direction here - SQLite can actually call your code instead.

· 23 Jan 2025An interesting twist in my recent usage of SQLite was the fact that I noticed my research scripts and the database intertwine more. When you open a database in sqlite or using your favourite GUI editor (I use SQLPro) you will be greeted with an error if you try to SELECT from that view or examine it. It would, of course, be wonderful to be able to “talk” to the SQLite database with the custom UDFs attached using a familiar GUI – but since the functions live in Ruby-land, it will be impractical.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Ruby Functions

Ruby Functions

Photo of Supercharge SQLite

Supercharge SQLite