A reviewer opens the task queue and sees Atlas in the project column twice. One link opens the Billing project and the other opens the Support project, but discovering which is which takes two clicks. Datasette label templates let you put the team in the link text. The reviewer can then choose Atlas / Billing or Atlas / Support directly from the task list. Follow both links and inspect the JSON for the same tasks to verify that each caption leads to the intended project.
You’ll build task:review-label-01 from four synthetic rows. Use the SQLite command-line program, a browser, and a local Datasette installation with label-template support. You’ll also need permission to use Set label column on the disposable instance. The launch commands use Datasette’s local development actor for that step. Simon Willison’s December 2, 2026 Datasette 1.0a47 prerelease introduced templates and the table action used here. Datasette 1.0a47 release notes

Build the two-Atlas review queue
- Work in a fresh directory with no
review.dborlabel-state.dbfrom an earlier attempt. Save the SQL below asreview.sql, then feed it to SQLite using the first command. - Check the installed Datasette version and start the baseline server. Keep the same directory for each launch so the paths identify the same files.
- Open the tasks table and follow each
Atlaslink. Record the task ID and the project ID together so you can compare the same pairs after changing the configuration.
PRAGMA foreign_keys = ON;
BEGIN;
CREATE TABLE projects (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
team TEXT NOT NULL
);
CREATE TABLE tasks (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
project_id INTEGER NOT NULL,
FOREIGN KEY (project_id) REFERENCES projects(id)
);
INSERT INTO projects (id, name, team) VALUES
(101, 'Atlas', 'Billing'),
(202, 'Atlas', 'Support');
INSERT INTO tasks (id, title, project_id) VALUES
(1, 'Review invoice exceptions', 101),
(2, 'Review ticket escalation', 202);
COMMIT;
sqlite3 review.db < review.sql
datasette --version
datasette serve review.db --host 127.0.0.1 --port 8001 --root --internal label-state.db
The first command should create the fixture without printing rows. If SQLite reports that a table already exists or an ID is already in use, start again in a fresh directory. That avoids combining previously seeded rows with this example. The version command prints the installed version and exits. The third command starts the web server and keeps the terminal occupied until you stop it. The explicit host binds it to the local machine. The file passed to --internal is where Datasette keeps the label you save later. review.db holds the projects and tasks. Datasette CLI reference
Open http://127.0.0.1:8001/review/tasks in the browser. Find the project_id cell beside task 1, Review invoice exceptions. Follow its Atlas link and confirm that the row path is /review/projects/101 and the row’s team is Billing. Return to the task list and follow the Atlas link beside task 2, Review ticket escalation. That link should open /review/projects/202, where team is Support. The observations throughout this guide are illustrative expectations for the fixture.
Both tasks have their own id and a separate project_id. The declaration binds tasks.project_id to projects.id. Both are integers, and the parent column is the declared primary key. Duplicate values in projects.name are intentional. The NOT NULL constraint on the child key means every fixture task supplies a project ID. PRAGMA foreign_keys = ON enables enforcement on the SQLite connection that loads the fixture. It runs before BEGIN because changing that setting inside an open transaction has no effect. The declaration remains part of the schema when that loading connection closes. SQLite foreign key support
The task titles help you recover your place in the browser. Use the task IDs for the actual comparison. Finding the Billing row in the projects table confirms that the row exists. Following the invoice task’s own cell confirms that the task points there. The duplicate names make this a useful fixture because a swapped association would pass a check that looks only for Atlas on both destination pages.
If you’re preparing a queue from a CSV, finish checking that the import contains the expected rows before comparing linked records. This fixture uses SQL so the foreign-key declaration and both task assignments are explicit from the start. Verify a Datasette browser CSV import
Configure the label on projects
- Stop the baseline server with Ctrl+C. Save the complete configuration below as
datasette.yamlalongsidereview.db. - Start the configured server with the command below. Return to
/review/tasksand compare its two project cells with your baseline. - Follow both links again. Match each link’s caption, destination path, and destination
teamto the originating task ID.
databases:
review:
tables:
projects:
label_column: "{name} / {team}"
datasette serve review.db --host 127.0.0.1 --port 8001 --root --internal label-state.db --config datasette.yaml
The database key is review, the name shown in the fixture’s URLs. Under that database, put label_column on projects. That table owns the name and team fields Datasette reads when rendering a project label. tasks owns the reference to the project, so it is the place to observe the resulting links. With a fresh internal database and no label configuration, Datasette automatically detects name on projects. The configured template supplies literal spaces and a slash between the values from the two fields. Datasette table configuration and label templates
The configured invoice task should display Atlas / Billing and lead to /review/projects/101. The escalation task should display Atlas / Support and lead to /review/projects/202. On each destination page, use the ID and the team field to verify the content independently of the link caption. If the invoice task reads Atlas / Support and opens project 202, inspect the task’s stored reference against the fixture. If it opens 101 and the project row says Billing while the caption reads Atlas / Support, focus on how that label is being rendered.
Team is a good disambiguator for this pair because it gives the reviewer the same distinction they use to choose work. In an adapted queue, start with a pair the reviewer actually confuses and read the candidate template fields from both project rows. If two projects are named Atlas and both belong to Billing, this template produces identical captions. Including the project ID as an additional field can distinguish the pair when team alone is insufficient. Keep the ID available wherever a client needs a stable identifier.
Template substitutions use values from the referenced row. A null value becomes empty text, and when all substituted values are null or empty, Datasette uses the primary key for display. A blank team can therefore leave a label like Atlas / if the name is present. The sample supplies nonempty names and teams so the labels show the intended distinction. When adapting it, review an actual pair of duplicate names and a row with missing display data before relying on the template. Datasette label template syntax and empty values
If a browser automation selects these links, capture the selected caption and the destination path together. For the invoice task in the configured state, the expected pair is Atlas / Billing and /review/projects/101. After a team rename, the previous caption can help explain why an older run made its selection, while the path lets you identify the row that run opened. Intel’s guide to replaying an agent run
Read the label and original key in JSON
- With the configured server running, open
http://127.0.0.1:8001/review/tasks.json?_labels=on&_pretty=1in your browser. Read theproject_idobject inside each task row. - Open the same table with expansion disabled at
http://127.0.0.1:8001/review/tasks.json?_labels=off&_pretty=1. Compare the scalar in each row with thevaluein its expanded counterpart. - Compare
id,project_id.value, andproject_id.labelas a set. Match the values to the two HTML link destinations before calling the configuration correct.
In the expanded response, project_id.value carries the original foreign-key value, and project_id.label carries the resolved text. _pretty=1 formats the JSON for reading. The surrounding response also contains metadata. The edited excerpt below shows the two expected rows for this case. Datasette JSON API and foreign-key expansion
{
"rows": [
{
"id": 1,
"title": "Review invoice exceptions",
"project_id": {"value": 101, "label": "Atlas / Billing"}
},
{
"id": 2,
"title": "Review ticket escalation",
"project_id": {"value": 202, "label": "Atlas / Support"}
}
]
}
With _labels=off, expect project_id: 101 on task 1 and project_id: 202 on task 2. If an existing consumer reads a scalar, keep its request in raw mode until it explicitly handles the expanded representation. A review client that opts in can use label to present the project and value to match a record. An expanded request can still return a plain value for a reference if Datasette finds no label for it. A client processing unfamiliar data should handle both shapes documented for that column. Datasette JSON API expansion rules
For a terminal-only view of the configured example, stop the browser server before running the command below. --get issues the request directly through Datasette, prints the result and exits. This command uses the same content file, configuration and internal state path as the live configured server. If you have already saved a label, clear it using the rollback steps and leave the YAML template in place before running this check. An exit code of zero confirms the request received HTTP 200. Read the row values and labels before using that result to verify the task. Restart the configured browser server to continue with the override. Datasette CLI reference for --get
datasette serve review.db --internal label-state.db --config datasette.yaml --get '/review/tasks.json?_labels=on&_pretty=1'
A program checking these results should match rows by task ID. An array position can change with sorting or filtering, and the project caption is the field you want the test to be free to change. Compare the numeric value with the known mapping for the task, then compare its label with the expectation for the current configuration. If the consumer requires both records, establish that both task IDs were returned. On a larger queue, follow the documented next_url until you have the rows needed for the check or reach the final page. Datasette JSON API pagination
The same check helps when your queue feeds a chart. An aggregate for project 101 can have the right count and still display the caption belonging to 202 if the consumer pairs labels and aggregates by position. Check the grouping key in the input to the chart before comparing the visible text to what the API supplied. Verify Datasette charts against their SQL
Save a different label and check what wins
- With the configured browser server running, open the single-use login URL printed by that launch in your local browser. Visit
http://127.0.0.1:8001/-/actorand verify that the actor’s ID isroot. - Open
http://127.0.0.1:8001/review/projects, open the table actions menu, and choose Set label column. Choose a template and enter{team} / {name}. Check the preview forBilling / AtlasandSupport / Atlas, then save the template. - Return to
/review/tasksand refresh it. Read the same two task cells, open both project links and request the expanded tasks JSON again. Keep the configured YAML in place during this check.
The stock local --root launch grants the actor set-label-column on the fixture, along with other development permissions. The action belongs to the selected table resource, so open the menu on projects. If the menu item is missing, check your actor in the same browser and on the same host used for the table. If you need to sign in again and have already used the startup link, restart the local process with the same command for a fresh link. Use the local development actor only for this disposable example. On a shared instance, have an actor with set-label-column on the project table make the change. Datasette authentication and permissions
The dialog previews labels for the first five rows, which covers both rows here. The reversed template deliberately uses the same fields and places the team first, making it easy to distinguish the saved result from the configured one. The preview lets you check the proposed text before saving. After saving, review the tasks table to check what the server is applying. The expected caption beside task 1 is Billing / Atlas, with project ID 101. Beside task 2 it is Support / Atlas, with project ID 202. Datasette release notes for the label preview and saved setting
While signed in, open http://127.0.0.1:8001/review/projects.json?_extra=set_label_column_ui&_pretty=1. In set_label_column_ui, expect saved to show {team} / {name}, configured to show {name} / {team}, and current.source to read saved. The extra also reports detected, which is name for this schema. Its default field tells you what the table would use if you cleared the saved label. For this fixture, look for default.label_template with the name-first template. If the extra is null, check the actor’s permission to set the label before using it to interpret precedence. Datasette JSON API table extras
For a persistence check, stop the process and run the configured launch command again with the same --internal label-state.db argument. Reopen the tasks table and look for Billing / Atlas and Support / Atlas. Those captions are the expected result after restarting with the file that contains the saved override. Keep the file path fixed so the restart tests persistence. If an instance uses an in-memory internal database, its saved label lasts only while the instance runs. Datasette configuration and saved label persistence
Clear the override and restore the baseline
- On
/review/projects, open Set label column, choose Default, and save. Sign in using the current local launch link first if needed. Leavedatasette.yamlin place. - Reload the task list and expanded JSON. The expected labels are
Atlas / BillingandAtlas / Support. Check that the project settings extra showssaved: nullandcurrent.source: "configured". - For the second rollback, stop the server and remove the
label_columnconfiguration. For this single-purpose file, replace its complete contents with{}. Launch again with the same configured command, including--config datasette.yamland the same internal state path. - Open the task list and expanded JSON one more time. Both captions should read
Atlas, with values101and202for tasks1and2respectively. If you inspect the project settings extra as an authorized actor, its expectedcurrent.sourceis nowdetected.
Choosing Default clears the override from Datasette’s internal database. The configured template is still available, so Atlas / Billing is the first caption you should see after clearing. Removing the YAML key exposes the automatically detected name once no saved setting or configured label is active. Check the intermediate state before changing the file. If you change the file while the reverse template is still saved, the visible labels can remain team-first after a restart because the saved choice still wins. Datasette configuration for setting and clearing a label
| Input | Action | Expected result |
|---|---|---|
task:review-label-01 baseline, task 1 references 101 and task 2 references 202 |
Start review.db with the baseline command and follow both project links from /review/tasks. |
Both captions read Atlas. Task 1 opens /review/projects/101 and task 2 opens /review/projects/202. |
task:review-label-01 with {name} / {team} configured on review.projects |
Start with --config datasette.yaml and open /review/tasks.json?_labels=on. |
Task 1 has label Atlas / Billing and value 101. Task 2 has label Atlas / Support and value 202. |
task:review-label-01 with YAML still present and a proposed {team} / {name} override |
On /review/projects, preview and save the reversed template through Set label column. Reload the tasks table. |
Labels become Billing / Atlas and Support / Atlas. Task 1 opens project 101 and task 2 opens project 202. |
task:review-label-01 with a saved override and the original YAML template |
Choose Default in the projects dialog, save, and reload the expanded tasks JSON. | The configured name-first captions return with values 101 and 202. The authorized project settings extra reports saved: null. |
task:review-label-01 with the override cleared and the YAML template still present |
Replace this fixture’s YAML with {}, restart using the same command, and reopen the task list. |
Both links again read Atlas. Task 1 reaches Billing at 101 and task 2 reaches Support at 202. |
To finish with the configured queue, put the YAML block from the configuration step back and restart with that file. Confirm that the two distinct captions return. Keep review.sql and datasette.yaml together to reproduce the case. If you maintain a fixture for a UI test, the sample gives you two checks that can fail independently. The reviewer must be able to pick the intended team from the visible label, and the selection must resolve to the project ID assigned to the task. Build synthetic fixtures for agent testing
Diagnose a label that did not change
- Check the relationship first if you see bare numbers. Open
/review/tasks.json?_labels=on&_extra=expandable_columns&_pretty=1. Look for a pair whose relationship namesproject_id, withother_tableset toprojectsandother_columnset toid. The second element of the pair is the label column or template, if available. If the relationship is absent, inspect the database file used by the server with the SQLite command below. Datasette JSON API relationship extras - Check the parent fields if the relationship is visible. Inspect
/review/projectsfor thenameandteamcolumns, and confirm the two rows contain the expected values. In YAML, check the database and table nesting and the literal template{name} / {team}. Start the local process with the same--configpath after correcting the file. Datasette label templates and configuration - Check precedence if it still shows the former text. Request the project settings extra as the authorized actor and read
saved,configuredandcurrent. Acurrent.sourceofsavedpoints to the stored choice. Clear it in the dialog and verify the configured string becomes current before making further YAML changes. Datasette JSON API for label settings
sqlite3 review.db 'PRAGMA foreign_key_list(tasks);'
Read the result for projects, project_id and id as the target table, child field and parent field. An empty result for this fixture suggests the declaration is missing or you opened the wrong database file. If the schema is wrong in the disposable copy, rebuild it in a fresh directory using review.sql, then reapply the YAML and check the two project links. If the declaration is present and an expanded value still looks raw, verify that a row with the stored ID actually exists in projects and has usable label data. SQLite foreign-key declarations
When the extra shows the relationship and the detected column name, you have a more specific diagnosis than a pair of identical captions. Check whether configured contains the template you wrote and whether current shows it in use. A missing configured value points you back to the file path and YAML nesting. If the saved template is present and active, start by clearing it. Seeing the configured template become current after that one action gives you a direct check of the cause. Datasette JSON API for label settings
If JSON shows the expected labels but the browser page seems wrong, return to the plain /review/tasks URL for the same local server. Remove any _labels=off parameter and check that project_id is visible in the table. If the browser shows the labels and the JSON does not, compare the request URLs and verify _labels=on in the JSON request. Treat a changed ID as a separate data issue. Open the relevant project row directly and compare the task’s raw reference with the seed SQL before adjusting any label settings. Datasette HTML and JSON foreign-key expansion
If you add a chart to the review queue, group by project ID when each project needs its own bucket and use the expanded label to make each bucket readable. Grouping this fixture by the detected display name alone would combine Billing and Support under Atlas. For a worked example of checking the query, grouping and rendered counts in a custom chart, see the guide to building a Datasette chart type. Build a Datasette chart type plugin and test what it draws

