datasette-upload-dbs 0.5a0 adds a formal swap API
The datasette-upload-dbs plugin, which lets users upload a brand new SQLite database to a hosted Datasette instance and have that database immediately start being served, has shipped version 0.5a0. The plugin has existed for a while and already supported one related trick: atomically swapping an existing database for a newer version. In that flow, the uploaded database is saved to a file, verified, then swapped in so the corresponding endpoint starts serving the new data.
What is new in 0.5a0 is a formalized API for both operations, in place of whatever ad hoc mechanism existed before. Replacing an existing database, or adding a new one, now works as a plain HTTP POST: an Authorization header carrying a bearer token, an Accept header requesting a JSON response, the database file attached as db, and a db_name field naming it, sent to a /-/upload-dbs path on the instance.
The practical use case is CI-driven deployment: a fresh SQLite database can be built in an environment such as GitHub Actions and then swapped into production as soon as that build finishes, without a human uploading the file by hand.
Key facts
- datasette-upload-dbs 0.5a0 adds a formalized HTTP API for uploading or replacing a database on a hosted Datasette instance.
- The API is a POST request to /-/upload-dbs, carrying a bearer token, the database file, and a db_name field.
- An uploaded database is saved to a file, verified, then atomically swapped in to start serving live traffic.
- The plugin already supported uploading new databases and swapping existing ones; 0.5a0 formalizes the interface for doing so.
- Intended use case: build a database in a CI environment such as GitHub Actions, then swap it into production right after the build completes.
Why it matters
Formalizing the upload and swap operation into a documented HTTP API turns a database refresh from an ad hoc step into something a CI pipeline can call directly. That fits a pattern for SQLite-backed sites and dashboards: rebuild the database from source data on a schedule, then push it live automatically instead of uploading it by hand.
Who it affects
Anyone running a hosted Datasette instance with this plugin installed, particularly setups where the underlying data (a scraped dataset, a generated report, a content database) changes on a regular cadence and needs to reach the live instance without downtime or manual intervention.
How to use it
Send a POST request to /-/upload-dbs with an Authorization: Bearer $API_TOKEN header, an Accept: application/json header, the database file attached as db, and a db_name field naming which database it replaces or creates, for example via curl -F "db=@content.db" -F "db_name=content". This requires a Datasette instance with the plugin installed and an API token already configured; the source gives no detail on how that token is set up.
How solid is it
This is an alpha release, version 0.5a0, of a plugin that the source describes as having been around for a while. The upload-and-swap mechanism itself is not new; what changed in this release is the formalized API surface for it. The source text does not name who wrote or maintains the plugin, does not give a prior version number to compare against, and states no release date.
Risks and caveats
The 0.5a0 version number signals an alpha build, so the API could still change before a stable release. The source gives no performance or timing figures for the upload or swap operation, no detail on authentication setup beyond the bearer token in the example, and no mention of error handling or rollback behavior if a swap fails partway through.