Skip to content

Support multi-column label_column config, plus a runtime API and UI for setting it#2817

Open
simonw wants to merge 1 commit into
mainfrom
claude/datasette-label-column-ui-mmb372
Open

Support multi-column label_column config, plus a runtime API and UI for setting it#2817
simonw wants to merge 1 commit into
mainfrom
claude/datasette-label-column-ui-mmb372

Conversation

@simonw

@simonw simonw commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Let’s design a datasette feature providing a UI for setting the label column (or columns) for a table

Start by reviewing how label columns currently work

There are two parts to this. First, we will expand the definition of a label column so that it can be configured (in configuration) as an ordered list of columns - currently it can only be one.

Then we will design a system for optionally storing that configuration in the internal database, complete with a table-level permission for setting them and a JSON endpoint, consistent with other similar endpoints

Finally we will design a UI for calling that endpoint

  • label_column config can now be a string or an ordered list of columns,
    joined with a space to build a row's display label. Database.label_column_for_table()
    is renamed to label_columns_for_table() and always returns a list.
  • Adds a label_columns internal DB table, get/set/remove_label_columns()
    methods, and a set-label-columns permission so the label can be overridden
    at runtime independently of config (config only seeds the value the first
    time a table is seen).
  • Adds a POST /<database>/<table>/-/set-label-columns JSON endpoint, modeled
    on the existing set-column-type endpoint.
  • Adds a "Set label column(s)" table action and modal for calling that
    endpoint from the table page.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_019oYhPa7o24kd8Cwx3i4GiD


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

…or setting it

- label_column config can now be a string or an ordered list of columns,
  joined with a space to build a row's display label. Database.label_column_for_table()
  is renamed to label_columns_for_table() and always returns a list.
- Adds a label_columns internal DB table, get/set/remove_label_columns()
  methods, and a set-label-columns permission so the label can be overridden
  at runtime independently of config (config only seeds the value the first
  time a table is seen).
- Adds a POST /<database>/<table>/-/set-label-columns JSON endpoint, modeled
  on the existing set-column-type endpoint.
- Adds a "Set label column(s)" table action and modal for calling that
  endpoint from the table page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019oYhPa7o24kd8Cwx3i4GiD
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 146 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (34ab85e) to head (8592ce2).

Files with missing lines Patch % Lines
datasette/views/table.py 0.00% 90 Missing ⚠️
datasette/app.py 0.00% 27 Missing ⚠️
datasette/database.py 0.00% 8 Missing ⚠️
datasette/default_table_actions.py 0.00% 6 Missing ⚠️
datasette/utils/__init__.py 0.00% 6 Missing ⚠️
datasette/views/row.py 0.00% 4 Missing ⚠️
datasette/views/table_extras.py 0.00% 3 Missing ⚠️
datasette/views/special.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2817   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         73      73           
  Lines      12037   12129   +92     
=====================================
- Misses     12037   12129   +92     

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

2 participants