Skip to content

Fixes for SQL write with RETURNING#2763

Merged
simonw merged 14 commits into
mainfrom
codex/execute-write-returning
May 31, 2026
Merged

Fixes for SQL write with RETURNING#2763
simonw merged 14 commits into
mainfrom
codex/execute-write-returning

Conversation

@simonw

@simonw simonw commented May 31, 2026

Copy link
Copy Markdown
Owner

simonw added 7 commits May 30, 2026 12:24
Use the router-stripped route_path when building request-derived export
URLs, so table, row, and query JSON/CSV links do not apply base_url twice.

Keep urls.path() behavior unchanged, and add coverage for both /prefix/
exports and a /data/ base_url with a data database.

Closes #2759
@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 84 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (c1476a4) to head (58dcedb).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
datasette/database.py 0.00% 36 Missing ⚠️
datasette/views/execute_write.py 0.00% 19 Missing ⚠️
datasette/utils/sqlite.py 0.00% 12 Missing ⚠️
datasette/app.py 0.00% 7 Missing ⚠️
datasette/views/database.py 0.00% 7 Missing ⚠️
datasette/utils/__init__.py 0.00% 2 Missing ⚠️
datasette/views/special.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2763   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         67      67           
  Lines      10223   10295   +72     
=====================================
- Misses     10223   10295   +72     

☔ 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.

simonw added 3 commits May 31, 2026 14:02
We select 11 when we return 10 just to detect if the results were truncated.

We were returning rowcount: 11 in this case when it should have been -1.
@simonw

simonw commented May 31, 2026

Copy link
Copy Markdown
Owner Author

Tests are failing because SQLite 3.25.0 (the earliest version Datasette supports) does not support RETURNING.

@simonw simonw merged commit b1f3e43 into main May 31, 2026
39 checks passed
@simonw simonw deleted the codex/execute-write-returning branch May 31, 2026 23:15
simonw added a commit that referenced this pull request May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL write with RETURNING: cannot commit transaction - SQL statements in progress

1 participant