Skip to content

Add web UI to edit and delete stored queries#2764

Open
simonw wants to merge 2 commits into
mainfrom
claude/canned-query-edit-delete-V4Va0
Open

Add web UI to edit and delete stored queries#2764
simonw wants to merge 2 commits into
mainfrom
claude/canned-query-edit-delete-V4Va0

Conversation

@simonw
Copy link
Copy Markdown
Owner

@simonw simonw commented Jun 1, 2026

Review recent changes, add the ability for users to edit and delete the canned queries that they saved

Private should only be editable deletable by the owning user

Non-private should allow edit and delete from any user with the necessary permissions

Claude Code output

Stored query pages now offer Edit and Delete actions in the query
actions menu, gated by the update-query and delete-query permissions.

  • New QueryEditView (GET/POST at ///-/edit) renders a
    pre-filled form for editing a query's title, description, SQL and
    privacy, reusing the create-query analysis UI. Changing the SQL still
    requires execute-sql; metadata-only edits do not.
  • QueryDeleteView gains a GET confirmation page and HTML form POST that
    redirects to the query list, while keeping the existing JSON API.
  • New default query_actions hook adds the Edit/Delete links for stored
    (non-config, non-trusted) queries the actor is allowed to manage.

Permission semantics (already enforced by default_query_permissions_sql)
are surfaced in the UI: owners can always edit/delete their queries;
non-private queries can be edited/deleted by any actor with the relevant
permission; private queries remain owner-only.

Shared the create-query form styles into _query_form_styles.html so the
edit form can reuse them.

https://claude.ai/code/session_019GU9g3pZAERukLKYNa4uAL


📚 Documentation preview 📚: https://datasette--2764.org.readthedocs.build/en/2764/

claude added 2 commits June 1, 2026 21:00
Stored query pages now offer Edit and Delete actions in the query
actions menu, gated by the update-query and delete-query permissions.

- New QueryEditView (GET/POST at /<db>/<query>/-/edit) renders a
  pre-filled form for editing a query's title, description, SQL and
  privacy, reusing the create-query analysis UI. Changing the SQL still
  requires execute-sql; metadata-only edits do not.
- QueryDeleteView gains a GET confirmation page and HTML form POST that
  redirects to the query list, while keeping the existing JSON API.
- New default query_actions hook adds the Edit/Delete links for stored
  (non-config, non-trusted) queries the actor is allowed to manage.

Permission semantics (already enforced by default_query_permissions_sql)
are surfaced in the UI: owners can always edit/delete their queries;
non-private queries can be edited/deleted by any actor with the relevant
permission; private queries remain owner-only.

Shared the create-query form styles into _query_form_styles.html so the
edit form can reuse them.

https://claude.ai/code/session_019GU9g3pZAERukLKYNa4uAL
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 0% with 93 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (9119543) to head (6528a77).

Files with missing lines Patch % Lines
datasette/views/stored_queries.py 0.00% 66 Missing ⚠️
datasette/default_query_actions.py 0.00% 19 Missing ⚠️
datasette/views/query_helpers.py 0.00% 7 Missing ⚠️
datasette/app.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2764   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         67      68    +1     
  Lines      10295   10386   +91     
=====================================
- Misses     10295   10386   +91     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants