datasette/tests/plugins
Simon Willison 7f93353549
Fix startup hook to fire after metadata and schema tables are populated (#2666)
* Fix startup hook to fire after metadata and schema tables are populated

Previously, the startup() plugin hook fired before internal database
tables were populated from metadata.yaml and before catalog schema
tables were filled. This meant plugins couldn't read or modify metadata
during startup. Now invoke_startup() calls refresh_schemas() before
firing startup hooks, ensuring metadata and catalog tables are available.

* Fix startup hook to fire after metadata and schema tables are populated

Previously, the startup() plugin hook fired before internal database
tables were populated from metadata.yaml and before catalog schema
tables were filled. This meant plugins couldn't read or modify metadata
during startup. Now invoke_startup() calls _refresh_schemas() before
firing startup hooks, ensuring metadata and catalog tables are available.

Updated test_tracer to reflect that internal DB creation SQL now runs
during startup rather than during the first traced request.

* Move check_databases before invoke_startup in CLI serve

Since invoke_startup now calls _refresh_schemas() which queries each
database, the spatialite connection check must run first to provide
the friendly error message instead of a raw OperationalError.

https://claude.ai/code/session_01KL4t5FZYb32rZY7xaqrrZU
2026-03-16 17:56:40 -07:00
..
messages_output_renderer.py Flash messages mechanism, closes #790 2020-06-02 14:12:18 -07:00
my_plugin.py register_token_handler() plugin hook for custom API token backends (#2650) 2026-02-25 16:32:45 -08:00
my_plugin_2.py Fix startup hook to fire after metadata and schema tables are populated (#2666) 2026-03-16 17:56:40 -07:00
register_output_renderer.py register_output_renderer can now return Response, closes #953 2020-08-27 21:02:50 -07:00
sleep_sql_function.py Remove undocumented sqlite_functions mechanism, closes #1567 2021-12-17 17:54:39 -08:00
view_name.py Refactored test plugins into tests/plugins, closes #775 2020-05-27 17:57:25 -07:00