Ensure all created primary keys are not null

Open
#2,807 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python, sqlite
Domain
api, database

Research direction

Start at the Datasette JSON API path that creates tables and inspect how primary-key definitions are handled. Add a regression test for creating a table with a nullable primary key, then verify the API rejects that schema while existing-database handling from #2805 remains unaffected.

Written by the indexing model from the issue text.

Description

data-entry-ui json-api

Split from:

  • #2805

SQLite allows null primary keys (which then means a table can have multiple rows with the same null primary key value!). Datasette needs to be able to handle those in existing databases - see #2805 - but we can at least stem the bleeding a bit by disallowing them for tables created using the Datasette JSON API.

Dominant language
Python
Stars
11.5k
Forks
904
Avg merge
4d 17h
Merged PRs (30d)
18

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from simonw/datasette

All issues in simonw/datasette

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.