Use $DATASETTE_INTERNAL in absence of --internal (#2174)

This commit is contained in:
Alex Garcia 2026-09-15 15:39:39 -07:00 committed by GitHub
commit 4bf30aaf8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View file

@ -76,6 +76,8 @@ Or since this is the default command you can run this instead::
Once started you can access it at ``http://localhost:8001``
Use ``--internal PATH`` or the ``DATASETTE_INTERNAL`` environment variable to persist :ref:`Datasette's internal database <internals_internal>` to a SQLite file.
.. [[[cog
help(["serve", "--help"])
.. ]]]

View file

@ -2473,7 +2473,20 @@ No token, cookie, or hidden form field is needed. Any ``<form method="POST">`` i
Datasette's internal database
=============================
Datasette maintains an "internal" SQLite database used for configuration, caching, and storage. Plugins can store configuration, settings, and other data inside this database. By default, Datasette will use a temporary in-memory SQLite database as the internal database, which is created at startup and destroyed at shutdown. Users of Datasette can optionally pass in a ``--internal`` flag to specify the path to a SQLite database to use as the internal database, which will persist internal data across Datasette instances.
Datasette maintains an "internal" SQLite database used for configuration, caching, and storage. Plugins can store configuration, settings, and other data inside this database. By default, Datasette will use a temporary in-memory SQLite database as the internal database, which is created at startup and destroyed at shutdown.
To persist internal data across Datasette instances, use the ``--internal`` option to specify the path to a SQLite database:
.. code-block:: bash
datasette mydatabase.db --internal internal.db
You can also set the ``DATASETTE_INTERNAL`` environment variable to specify this path without passing ``--internal`` each time:
.. code-block:: bash
export DATASETTE_INTERNAL=/path/to/internal.db
datasette mydatabase.db
Datasette maintains tables called ``catalog_databases``, ``catalog_tables``, ``catalog_views``, ``catalog_columns``, ``catalog_indexes``, ``catalog_foreign_keys`` with details of the attached databases and their schemas. These tables should not be considered a stable API - they may change between Datasette releases.