Add new --internal internal.db option, deprecate legacy _internal database

Refs:
- #2157 
---------

Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
Alex Garcia 2023-08-28 20:24:23 -07:00 • committed by GitHub
commit 92b8bf38c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 108 additions and 90 deletions

View file

@ -148,9 +148,6 @@ async def inspect_(files, sqlite_extensions):
app = Datasette([], immutables=files, sqlite_extensions=sqlite_extensions)
data = {}
for name, database in app.databases.items():
if name == "_internal":
# Don't include the in-memory _internal database
continue
counts = await database.table_counts(limit=3600 * 1000)
data[name] = {
"hash": database.hash,
@ -476,6 +473,11 @@ def uninstall(packages, yes):
"--ssl-certfile",
help="SSL certificate file",
)
@click.option(
"--internal",
type=click.Path(),
help="Path to a persistent Datasette internal SQLite database",
)
def serve(
files,
immutable,
@ -507,6 +509,7 @@ def serve(
nolock,
ssl_keyfile,
ssl_certfile,
internal,
return_instance=False,
):
"""Serve up specified SQLite database files with a web UI"""
@ -570,6 +573,7 @@ def serve(
pdb=pdb,
crossdb=crossdb,
nolock=nolock,
internal=internal,
)
# if files is a single directory, use that as config_dir=