Hi, I work in an academic setting and I found datasette always interesting to publish datasets, but it is hard to host a python web application on institutional servers (would have to convince several people who would have to maintain this). Hosting static files is very easy - time to try datassete!
Awesome! I'm really keen to see Datasette used more in academia, I hadn't thought about how much easier it would be to deploy static files in that context.
I am seriously considering adding a plugin hook to support alternative database backends - PostgreSQL and DuckDB are the two I'm most interested in for that.
How close is Python SQLite and Datasette Lite to accessing a hosted SQL database using HTTP range requests as can be done in sql.js like https://github.com/phiresky/sql.js-httpvfs?
I put together a Pyodide-based web app where users need a few indexed queries from a 600mb SQLite database but it isn't very practical for them to download the whole thing into the browser. I would datasettify it and access it by API, if I wasn't relying on a pyodide library that needs direct SQLite access.
My initial hunch is that this will be really difficult - probably require a fork of something like https://github.com/coleifer/pysqlite3 then compiled for WebAssembly.
I'm confident it's feasible, but I don't have the skills to figure it out myself.
This was also my immediate thought. Being able to statically deploy larger databases without a server process would be an absolute dream. Approaching dangerously high levels of dark magic.
My biggest issue with Pyodide (which is of course an awesome project/build on its own) is the long wait times. I haven't figured out a way around a ~5 second load time where the entire UI hangs every single time you load the page.
The datasette tools are really great. I use them for pulling GitHub statistics, such as the distribution of GitHub followers, from their REST API into an SQLite database with sqlite-utils(1).[1]
Simon is in the 99th percentile (PR=0.998, n>25,000+) of GitHub users by followers.
absolutely insane. seems like its installing pip packages and running localhost in the browser? I don't 100% grasp what is happening underneath the hood. But usually you would launch the local server, browse over to http://localhost to view it in your browser. This is running the web server inside Web Assembly inside your browser? Is it then possible to expose that local web server inside web assembly to the internet? Crazy stuff! looks like its possible to speed up the initial load time by using web workers, very much eager to see that in action.
It runs everything in a web worker at the moment, not sure if there are optimizations I could make by running more of them in parallel?
It doesn't exactly run a localhost server. It uses a mechanism from Datasette's internals that lets you simulate an HTTP request through the Datasette application and get back the result. Then it sends that result back as a message from the worker to the parent page.
Really cool idea and implementation! It is really making me think about if this can be done in a service worker so that you could expose what would look like a standard (REST?) API?
It seems like a client-side non-JS server backend would be incredibly useful. Just drop the service worker in and point it at your data source.
Or if you have a SQLite database hosted online somewhere with open CORS headers you can feed it the URL using ?url=... - like this:
https://simonw.github.io/datasette-lite/?url=https%3A%2F%2Fc...