datasette/docs
Claude 1bc15caef7
Connection budget: pages, startup and sweeps only touch the databases they need
Adds tests/connection_budget.py, a helper that records which databases a
block of code opens, reads, writes or ATTACHes, and tests/test_connection_budget.py
which asserts budgets for ~60 endpoints, startup, sweeps and telemetry with
50 attached databases.

Fixes for every all-database loop it found:

- Index page: tables, views, hidden tables, columns, primary keys, FTS
  tables and foreign-key relationship counts come from the _internal
  catalog (a few queries for any number of databases). Row counts are only
  run when at most 20 databases need counting (COUNT_MAX_DATABASES);
  above that the page shows table counts plus counts already known.
- Derived-table permissions: allowed_resources() no longer queries every
  database per page; dependency maps are computed by the SchemaWatcher from
  the rows it scans, cached per database, and read back from the catalog
  for databases restored from a persisted catalog.
- catalog_tables gains a type column (PRAGMA table_list: table, virtual,
  shadow) so hidden shadow tables can be identified without a connection.
- PaginatedResources.all() fetches pages of 1000 after the first.
- /-/api and /-/debug/autocomplete use the catalog; /-/schema does one
  permission query and skips databases with nothing visible.
- /-/versions computes SQLite details once per instance, without crossdb
  ATTACHes; detect_json1() caches its answer.
- /-/databases only stats/hashes databases the actor can see.
- Immutable table counts are computed when first needed, not at startup.
- check_databases() (serve, --get) reuses the catalog scan instead of
  opening every database a second time, and reports "file is not a
  database" as a usage error.
- SchemaWatcher: failed scans are retried when the file changes, not on
  every sweep; scan connections skip crossdb ATTACH; catalog_generation
  counter for caches.
- The SQL write UI no longer forces a stat sweep of every database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EwkLo2rJWidpkDVT3HkvNv
2026-10-04 05:58:31 +00:00
..
_static Add favicon to documentation (#1967) 2022-12-31 11:00:31 -08:00
_templates Drop jQuery dependency 2023-03-26 16:38:58 -07:00
images Screenshots for reusable modal dialogs docs, plus just shots (#2958) 2026-09-24 15:06:57 -07:00
shots Screenshots for reusable modal dialogs docs, plus just shots (#2958) 2026-09-24 15:06:57 -07:00
.gitignore Added initial docs, including a changelog 2017-11-16 07:11:00 -08:00
authentication.rst Limit derived-table permissions to one source hop 2026-09-10 16:52:52 -07:00
auto-build.sh Added --load-extension argument to datasette serve 2017-11-16 08:48:49 -08:00
binary_data.rst Support BLOB values in row edit UI 2026-07-03 16:09:27 -07:00
changelog.rst Typo fixes 2026-09-24 12:09:29 -07:00
cli-reference.rst Merge spike/schema-watcher into spike/integrated, reconciling the three spikes 2026-10-04 04:49:04 +00:00
codespell-ignore-words.txt Move Metadata to --internal database 2024-06-11 09:33:23 -07:00
conf.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
configuration.rst textarea column type 2026-06-13 22:18:45 -07:00
contributing.rst Screenshots for reusable modal dialogs docs, plus just shots (#2958) 2026-09-24 15:06:57 -07:00
csv_export.rst Use shot-scraper images from datasette-screenshots repo, closes #1844 2022-10-14 12:57:00 -07:00
custom_templates.rst Document customizing breadcrumbs (#2885) 2026-09-15 12:45:01 -07:00
datasette-0.51.png Release 0.51 2020-10-31 15:21:49 -07:00
datasette-logo.svg Added new logo to the documentation 2020-07-12 12:53:29 -07:00
deploying.rst Add test for RST heading underline lengths, closes #2544 2025-10-26 09:49:49 -07:00
ecosystem.rst Shrunk ecosystem docs in favour of datasette.io, closes #1182 2021-01-09 14:17:18 -08:00
events.md RenameTableEvent, plus write connection track_event() mechanism (#2682) 2026-03-30 11:20:46 -07:00
facets.rst Fix some broken links in docs 2026-09-15 12:31:55 -07:00
full_text_search.rst Fix some broken links in docs 2026-09-15 12:31:55 -07:00
getting_started.rst Replace Glitch with Codespaces, closes #2488 2025-05-28 19:17:22 -07:00
index.rst Add a plugin telemetry kit: public registry API, linked_root_span_kwargs, test helpers, docs 2026-09-24 09:58:58 -07:00
installation.rst Remove Datasette Desktop from installation guide 2026-07-07 14:04:46 -07:00
internals.rst Connection budget: pages, startup and sweeps only touch the databases they need 2026-10-04 05:58:31 +00:00
introspection.rst Fix some broken links in docs 2026-09-15 12:31:55 -07:00
javascript_plugins.rst Screenshots for reusable modal dialogs docs, plus just shots (#2958) 2026-09-24 15:06:57 -07:00
json_api.rst Add /-/tasks introspection endpoint for supervised background tasks (#2892) 2026-09-15 11:56:53 -07:00
json_api_doc.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
Makefile Document custom json encoder (#1996) 2026-06-23 16:24:03 -07:00
metadata.rst Move table configuration docs from metadata.rst to configuration.rst (#2668) 2026-03-17 08:47:04 -07:00
metadata_doc.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
pages.rst Unify page-size parameters on _size with table semantics 2026-07-04 17:54:03 +00:00
performance.rst Release 0.63a1 2022-10-23 20:07:09 -07:00
plugin_hooks.rst Docs and telemetry descriptions for the integrated connection model 2026-10-04 04:53:50 +00:00
plugin_telemetry.rst Simplify code comments added since 1.0a40 (#2957) 2026-09-24 13:52:29 -07:00
plugins.rst Limit derived-table permissions to one source hop 2026-09-10 16:52:52 -07:00
publish.rst Remove all remaining "$ " prefixes from docs, closes #2140 2023-08-11 10:44:34 -07:00
settings.rst Merge spike/schema-watcher into spike/integrated, reconciling the three spikes 2026-10-04 04:49:04 +00:00
settings_doc.py Use cog to show default values in settings.rst 2026-09-17 12:30:47 -07:00
shots.yml Screenshots for reusable modal dialogs docs, plus just shots (#2958) 2026-09-24 15:06:57 -07:00
spatialite.rst Renamed canned queries to queries / stored queries in docs 2026-05-26 15:17:51 -07:00
sql_queries.rst Return 400 for write canned-query SQL failures 2026-07-04 14:35:54 +00:00
telemetry_doc.py Simplify code comments added since 1.0a40 (#2957) 2026-09-24 13:52:29 -07:00
template_context.rst Remove the next_url extra - the key is always present 2026-07-06 23:59:53 +00:00
template_context_doc.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
testing_plugins.rst Simplified testing docs 2026-09-24 11:45:02 -07:00
upgrade-1.0a20.md Renamed canned queries to queries / stored queries in docs 2026-05-26 15:17:51 -07:00
upgrade_guide.md Replace token-based CSRF with Sec-Fetch-Site header protection (#2689) 2026-04-14 17:11:36 -07:00
writing_plugins.rst How to use crumbs for plugin authors, closes #1902 2026-09-15 12:53:02 -07:00