datasette-scan
Datasette plugin that scans directories for SQLite database files and serves them.
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-scan
Usage
Scan the current directory for SQLite files and serve them:
datasette scan
Scan a specific directory:
datasette scan /path/to/directory
Scan multiple directories and include explicit database files:
datasette scan /data/projects /data/archives extra.db
Specify a port (or any other datasette serve option):
datasette scan -p 8001
All options accepted by datasette serve are also accepted by datasette scan -- these are introspected at runtime, so new options added to future versions of Datasette will be picked up automatically.
How it works
- Positional arguments that are directories are scanned recursively for SQLite files using the sqlite-scanner binary, which identifies SQLite files by their magic bytes rather than file extension.
- Positional arguments that are files are passed through directly as database files.
- If no positional arguments are given, the current directory (
.) is scanned. - Discovered files are then served as if you had run
datasette serve file1.db file2.db ....
Continuous scanning
Use --scan-interval to periodically re-scan directories for new SQLite files while the server is running. New databases will be added automatically.
datasette scan /data --scan-interval 5
This re-scans every 5 seconds. Any new SQLite files that appear in the scanned directories will be added to the running Datasette instance without a restart.
Corrupted and locked files
Since datasette scan discovers files automatically, it takes precautions against problematic databases:
- Corrupted files are skipped. Each discovered file is validated by running
SELECT * FROM sqlite_masterbefore it is served. Files that fail this check are skipped with a warning to stderr. - Locked files are handled safely. Databases locked by another process are opened in read-only mode instead of causing the server to fail. (The
--nolockoption fromdatasette serveis always enabled and not exposed as a separate flag.)
These protections apply to files discovered by scanning directories. Explicit file arguments are passed through to datasette serve without validation.
Examples
Scan the current directory and open in a browser:
datasette scan -o
Scan with CORS enabled on a custom port:
datasette scan /data --cors -p 9000
Use --get to test without starting a server:
datasette scan /data --get /.json
Development
To set up this plugin locally, first checkout the code. You can confirm it is available like this:
cd datasette-scan
# Confirm the plugin is visible
uv run datasette plugins
To run the tests:
uv run pytest
Release files for datasette-scan 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datasette_scan-0.1.1.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datasette_scan-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / datasette_scan-0.1.1.tar.gz
| Download URL | datasette_scan-0.1.1.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1bb466856e2dfc791923d18960515bbf67e60afc1415255a64701a8254f6ee8
|
|
BLAKE2b-256 checksum How to use checksums |
ce70564aafe9fb96b64bb8a9865dd9f9aac6d94df8c8a196c1124c1a368bbee0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 4, 2026.
Transparency logRelease files / datasette_scan-0.1.1-py3-none-any.whl
| Download URL | datasette_scan-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
344256515fded26d01fa403f306b3824c90aaac62314eefad4c1bc466e698bde
|
|
BLAKE2b-256 checksum How to use checksums |
28510771b08bf17f273556ccde856952ef0003bbcb305257343d9bb2e3bf07d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 4, 2026.
Transparency log