In-Browser WASM Powered Postgres and DuckDB Fragments On the To Do List…

A quick note that I need to demo some simple educational material that shows how we can use postgres-wasm to drop a postgres-wasm PostgreSQL terminal into an IFrame and run some activities:

We can also access a wasm powered db with proxied sockets, which means:

  • we can connect to the DB from something like pandas if we are running in an environment that supports socket connections (which pyodide/JupyterLite doesn’t);
  • we only need to run a simple proxy webservice alongside the http server that delivers the WASM bundle, rather than a full PostgreSQL server. Persistence is handled via browser storage, which means if the database is large, that may be the main hurdle…

If we were just doing SQL data wrangling, it would possibly make more sense to use something like DuckDB. In passing, I note an experimental package that supports DuckDB inside JupyterLite — iqmo-org/jupylite_duckdb — to complement the “full fat” duckdb Python package:

However, for playing with things like roles and permissions, or more of the basic DB management functions, having a serverless PostgreSQL database is really handy. One thing it can’t (currently?) do, though, is support multiple concurrent connections, which means no playing with transactions? Although – maybe the proxied version can?! One to try…

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: