

Discover more from hrbrmstr's Daily Drop
As I noted on the Twitters, yesterday was consumed by one all-day culinary activity and $WORK. As a result, you get two editions today!
The first one (i.e. this one) has a Democratization theme centered around making learning and using database technology more accessible to everyone.
Chances are you, dear reader, have a robust personal compute platform at-the-ready and can comfortably spin up a local database. If not that, then you are likely knowledgeable and frugal enough to be able to do the same in a cloud or virtual private server (VPS) provider.
Tragically, this is not the case for most humans on the planet. Many are stuck with a tiny (albeit likely powerful) glowing rectangle as their sole compute device. Others may have under-powered setups, like a cheap Windows box or Chromebook. But most do not have the tools you and I have, and I believe it is incredibly important to give all humans the chance to change the world. While there are many ways to do that, I also believe using "Data Science" is one of the best ways to affect said change, and a fundamental Data Science skill is how to effectively use databases/SQL.
So, today, we'll look at how to use three different databases in your browser thanks to Web Assembly (Wasm).
SQLite In Your Browser
SQLite is everywhere (I hope that talk gets recorded). A big reason for the ubiquity of SQLite is the Public Domain license. Another is that the SQLite codebase is clean, small, and designed with cross-platform compatibility in mind.
Sql.js [GH] is a javascript-or-Wasm (depending on the robustness of your browser) SQL database. It allows you to create a relational database and query it entirely in the browser, and uses a virtual database file stored in memory. This means the data changes are not persistent (i.e. don't refresh the tab!). But, you can import any existing SQLite file and export the full database at any time. Note that there are ways
While web application development is a chief goal of sql.js
, a side effect of said goals is a full in-browser SQLite interpreter.
While that interpreter has just a basic UI, imagine framing a whole tutorial or course on working with databases around it.
While this post is focused on Democratization, Sql.js
it is no mere learning "toy". Via some quiet clever tech, you can use it to perform real work with HTTP-based databases.
DuckDB In Your Browser
I've blathered sufficiently in the intro and first section to enable avoiding reader fatigue for this and the last section. The same posits and principles still hold, but there's no need to repeat them.
DuckDB is super cool tech, and it's super-er cool-er that it can also run fully in browser thanks, again, to Wasm.
Here's their setup:
TLDR: DuckDB-Wasm is an in-process analytical SQL database for the browser. It is powered by WebAssembly, speaks Arrow fluently, reads Parquet, CSV and JSON files backed by Filesystem APIs or HTTP requests and has been tested with Chrome, Firefox, Safari and Node.js.
Hit up their example DuckDB shell, and have even more fun over at ObservableHQ.
Postgres In Your Browser
Wasm is truly eating the planet when you see Postgres fully embedded in-browser.
The folks at Crunchy Data did what I posited in the first section and provide a series of Postgres tutorials, and do an incredible job explaining all this at the link in the first ❡.
FIN
Catch y'all later today for the second edition! ☮