Skip to content

Bulk insert mechanism in the insert row dialog#2813

Draft
simonw wants to merge 6 commits into
mainfrom
bulk-insert
Draft

Bulk insert mechanism in the insert row dialog#2813
simonw wants to merge 6 commits into
mainfrom
bulk-insert

Conversation

@simonw

@simonw simonw commented Jun 29, 2026

Copy link
Copy Markdown
Owner
  • Click "Insert multiple rows" from the insert dialog
  • Paste in JSON or TSV or CSV - or drop on a file
  • Preview table showing what will be inserted
  • Rows get inserted via the JSON API
  • Same UI is also available on create table, as "create table from rows", using existing API.

It's effectively https://github.com/datasette/datasette-import as a core feature.

simonw added 3 commits June 25, 2026 22:02
Works entirely using existing JSON API.

User can paste in CSV, TSV or JSON (or drop a text file on).

They get a preview of the rows to be imported, then they
are imported in max_insert_rows batches.
Similar to insert rows from JSON/CSV/TSV
but it creates a brand new table instead.
I was getting a confirm() dialog when I clicked outside the dialog on the
create table from data page despite not having filled out any fields.
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (d621bdf) to head (b759ea5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2813   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         73      73           
  Lines      12035   12037    +2     
=====================================
- Misses     12035   12037    +2     

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

@simonw

simonw commented Jun 29, 2026

Copy link
Copy Markdown
Owner Author

Insert screen now looks like this:

CleanShot 2026-06-29 at 15 13 43@2x

Moved text around, added clickable 'open a file' button for mobile.

Screenshot: #2813 (comment)
@simonw simonw added enhancement data-entry-ui Relating to the UI for inserting/updating/deleting rows and creating/altering/dropping tables. labels Jun 29, 2026
@simonw

simonw commented Jun 30, 2026

Copy link
Copy Markdown
Owner Author

Point of confusion: I tried importing the same external data (with a concrete primary key - it was the JSON from https://api.github.com/users/simonw/repos) twice - once to create the table, and then again with the edit feature.

This happened:

CleanShot 2026-06-29 at 17 46 39@2x

I guess I was actually trying to do an upsert here, which the UI doesn't yet support.

Need to think about if upsert should be a feature and how it should work.

@simonw

simonw commented Jun 30, 2026

Copy link
Copy Markdown
Owner Author

Note that upsert requires an additional permission, update-row - not just insert-row.

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

Labels

data-entry-ui Relating to the UI for inserting/updating/deleting rows and creating/altering/dropping tables. enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant