mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
The execute_write_script() method was causing SQLite database locking errors when multiple executescript() calls ran in quick succession. Root cause: SQLite's executescript() method has special behavior - it implicitly commits any pending transaction and operates in autocommit mode. However, execute_write_script() was passing these calls through execute_write_fn() with the default transaction=True, which wrapped the executescript() call in a transaction context (with conn:). This created a conflict where sequential executescript() calls would cause the second call to fail with "OperationalError: database table is locked: sqlite_master" because the sqlite_master table was still locked from the first operation's implicit commit. Fix: Pass transaction=False to execute_write_fn() since executescript() manages its own transactions and should not be wrapped in an additional transaction context. This was causing test_hook_extra_body_script to fail because the internal database initialization (which calls executescript twice in succession) would fail, preventing the application from rendering pages correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| publish | ||
| static | ||
| templates | ||
| utils | ||
| views | ||
| __init__.py | ||
| __main__.py | ||
| actor_auth_cookie.py | ||
| app.py | ||
| blob_renderer.py | ||
| cli.py | ||
| database.py | ||
| default_actions.py | ||
| default_magic_parameters.py | ||
| default_menu_links.py | ||
| default_permissions.py | ||
| events.py | ||
| facets.py | ||
| filters.py | ||
| forbidden.py | ||
| handle_exception.py | ||
| hookspecs.py | ||
| inspect.py | ||
| permissions.py | ||
| plugins.py | ||
| renderer.py | ||
| resources.py | ||
| sql_functions.py | ||
| tracer.py | ||
| url_builder.py | ||
| version.py | ||