Commit graph

3,096 commits

Author SHA1 Message Date
Simon Willison
3c29b002ca Do not document unstable JSON APIs for stored queries 2026-05-26 16:07:53 -07:00
Simon Willison
cef52b1ffc Break up giant views/database.py into smaller modules 2026-05-26 16:06:14 -07:00
Simon Willison
7214cc3761 Remove obsolete label 2026-05-26 15:52:44 -07:00
Simon Willison
d6de8e7520 Link to save query from /-/execute-write 2026-05-26 15:52:16 -07:00
Simon Willison
c3ceabae03 Ran Black 2026-05-26 15:51:40 -07:00
Simon Willison
58e2e3a8ab Ran cog 2026-05-26 15:43:34 -07:00
Simon Willison
1bcd99df90 Refactor code from datasette.app into datasette.stored_queries
The datasette/app.py file had grown a lot in this branch.
2026-05-26 15:42:40 -07:00
Simon Willison
e89ffa0e06 Fixed broken test caused by apply_queries_config() rename 2026-05-26 15:37:21 -07:00
Simon Willison
ca4907ab6b Make _save_queries_from_config a private method 2026-05-26 15:30:36 -07:00
Simon Willison
e2864fc895 test_stored_queries.py 2026-05-26 15:21:09 -07:00
Simon Willison
cafb6b9dbd Need is_trusted=True for the counters demo 2026-05-26 15:20:29 -07:00
Simon Willison
02a1468f1b Renamed canned queries to queries / stored queries in docs
And a few renames in code and YAML as well.
2026-05-26 15:17:51 -07:00
Simon Willison
56b14f37d5 The stored queries do not live in that DB 2026-05-26 15:16:18 -07:00
Simon Willison
2f73869c09 Document that canned_queries() has been removed 2026-05-26 15:09:48 -07:00
Simon Willison
b1029acc68 top_canned_query is now top_stored_query, closes #2747 2026-05-26 15:05:41 -07:00
Simon Willison
4bf1c4b065 Rename canned queries to queries/stored queries in docs 2026-05-26 14:54:35 -07:00
Simon Willison
0cadd07187 No need to document QueryCreateAnalyzeView 2026-05-26 14:53:31 -07:00
Simon Willison
24887004cf Rename insert-query to store-query
Also queries/insert to queries/store

Refs https://github.com/simonw/datasette/pull/2741#issuecomment-4549103663
2026-05-26 14:51:59 -07:00
Simon Willison
180a6a86fd Remove queries-plan.md
We do not need this any more. It can live
forever in Git history.
2026-05-26 14:16:10 -07:00
Simon Willison
ac6ee097dd Disallow update/delete of private queries
If a user does not own a private query they cannot update
or delete it either, even if they have global update-query.

https://github.com/simonw/datasette/pull/2741/changes#r3306417463
2026-05-26 14:10:48 -07:00
Simon Willison
024b911772 Clarifying comment
https://github.com/simonw/datasette/pull/2741/changes#r3306856046
2026-05-26 14:09:53 -07:00
Simon Willison
f7e9dbc27e Tweaked design of create query page 2026-05-26 14:02:44 -07:00
Simon Willison
5dca2dc9be Show query count on database page 2026-05-26 13:54:47 -07:00
Simon Willison
6033bf8e40 Merge branch 'main' into queries 2026-05-26 13:51:51 -07:00
Simon Willison
eb7c25c57c Major redesign of create saved query UI
https://github.com/simonw/datasette/pull/2741#issuecomment-4548707129
2026-05-26 13:48:40 -07:00
Simon Willison
70b23ff4a5 Tweaked save query link 2026-05-26 13:47:24 -07:00
Simon Willison
0fcaa5792b Style query operations on create query
Made it consistent with the SQL write page.
2026-05-26 13:12:07 -07:00
Simon Willison
71c76e3853 Better faceting on /-/queries
Ref https://github.com/simonw/datasette/pull/2741#issuecomment-4548321815
2026-05-26 13:08:19 -07:00
Simon Willison
866852eff6 Clarifying comments 2026-05-26 12:46:18 -07:00
Simon Willison
1ac4265ffd Require permissions for untrusted stored query execution, refs #2735 2026-05-26 12:12:59 -07:00
Simon Willison
1cd162e9da Removed some no-longer-necessary code, simplified
view-query is back in the default allow actions now. We have
other mechanisms that work for controlling visibility, and
the fact that queries default to running with the permissions
of the actor makes this safe.
2026-05-26 12:07:30 -07:00
Simon Willison
4a1a4d7807 Query is_trusted and is_private properties
Refs https://github.com/simonw/datasette/issues/2735#issuecomment-4547270516

Diff explanation: https://gist.github.com/simonw/1e4de6c4b041a51968eb273ee96dec1f
2026-05-26 11:59:49 -07:00
Simon Willison
f1dd86ebfb Tweak URL designs of new endpoints 2026-05-25 14:05:26 -07:00
Simon Willison
8ab8999ba9 Big visual improvement to /-/queries pages
Including /db/-/queries

Refs https://github.com/simonw/datasette/issues/2735#issuecomment-4536860239
2026-05-25 12:56:59 -07:00
Simon Willison
4208ded249 No execute-write on immutable databases
Refs https://github.com/simonw/datasette/issues/2742#issuecomment-4536690161
2026-05-25 12:46:21 -07:00
Simon Willison
1f7c26ffea Refactor to share JS/HTML between execute and execute-write
Refs #2742
2026-05-25 12:45:42 -07:00
Simon Willison
de55a76d40
Fix 500 error when accessing query page without ?sql= parameter (#2744)
Closes #2743
2026-05-25 12:33:57 -07:00
Simon Willison
e1261442c0 Update parameters/query operations as user edits the write query
Refs #2742
2026-05-25 12:09:52 -07:00
Simon Willison
abb17ba773 Improved the look of the parameters table
Refs #2742

It now adapts better to different sizes of column labels.
2026-05-25 11:42:26 -07:00
Simon Willison
66bbbbc947 Support multi-line parameters on /db/-/execute-write
Refs https://github.com/simonw/datasette/issues/2742#issuecomment-4536317049

Each paramater input now has an expand/collapse button toggle to turn into a textarea.

If you paste text that includes at least one newline it toggles automatically.
2026-05-25 11:35:09 -07:00
Simon Willison
1bce34a338 If just a single insert, link to row page
Refs #2742
2026-05-25 11:22:24 -07:00
Simon Willison
2b5b4ed66b Much improved "Write to this database" UI
- Start with a template option, letting you pick table and operation
- SQL textarea defaults to 4 empty lines at start
- Query operations table is simpler and looks nicer

Refs #2742
2026-05-25 11:11:11 -07:00
Simon Willison
f0b59971f7 Delete unnecessary test 2026-05-25 10:40:00 -07:00
Simon Willison
6eee6c81e8 Add global query browser
Refs #2735
2026-05-25 10:24:42 -07:00
Simon Willison
310c36ae94 Limit database query preview to five
Refs #2735
2026-05-25 10:18:36 -07:00
Simon Willison
4a70b89355 Add cursor-paginated query browser
Refs #2735
2026-05-25 10:11:46 -07:00
Simon Willison
539ff9ddfc Drop query publication check from docs
Refs #2735
2026-05-25 09:49:21 -07:00
Simon Willison
2d07c3b99e Ran cog 2026-05-25 09:47:12 -07:00
Simon Willison
e62a5ea337 Rename query publication flag
Refs #2735
2026-05-25 09:46:39 -07:00
Simon Willison
e0d39ba69f Store query options as JSON
Refs #2735
2026-05-25 09:41:32 -07:00