Skip to content

Add create table execute-write template#2794

Merged
simonw merged 1 commit into
mainfrom
codex/create-table-template
Jun 20, 2026
Merged

Add create table execute-write template#2794
simonw merged 1 commit into
mainfrom
codex/create-table-template

Conversation

@simonw

@simonw simonw commented Jun 20, 2026

Copy link
Copy Markdown
Owner

The /db/-/execute-write page now has a "Create table" template I addition to the templates for insert row / update rows / delete rows. It looks like this:

create-table

Also fixed it so if you select a template it no longer refreshes the entire page and closes the template expandable on you.

@simonw simonw force-pushed the codex/create-table-template branch from 790435b to 86e8090 Compare June 20, 2026 00:06
Comment thread datasette/app.py
return None

async def refresh_schemas(self):
async def refresh_schemas(self, *, force=False):

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a bug where you could add a new table but it would not be represented in the list of tables (for insert/etc) until you refreshed the page again. This was a timing issue with the schema refreshing - the new force=True parameter lets us fix that.

Comment thread tests/test_queries.py Outdated
Add a Create table starter template to the execute-write page, alongside the existing table-specific insert/update/delete templates.

Keep template button clicks in-page by updating CodeMirror and the URL without collapsing the template controls.

Refresh schema metadata after successful schema-changing execute-write statements so newly created tables appear immediately.
@simonw simonw force-pushed the codex/create-table-template branch from 86e8090 to a7578ca Compare June 20, 2026 00:11
@simonw simonw marked this pull request as ready for review June 20, 2026 00:11
@simonw simonw merged commit f673e74 into main Jun 20, 2026
43 checks passed
@simonw simonw deleted the codex/create-table-template branch June 20, 2026 00:14
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (1ae5500) to head (a7578ca).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
datasette/views/execute_write.py 0.00% 10 Missing ⚠️
datasette/app.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2794   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         70      70           
  Lines      11173   11183   +10     
=====================================
- Misses     11173   11183   +10     

☔ View full report in Codecov by Harness.
📢 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.

1 participant