home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1684494464

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/2145#issuecomment-1684494464 https://api.github.com/repos/simonw/datasette/issues/2145 1684494464 IC_kwDOBm6k_c5kZ1iA 9599 2023-08-18T22:27:51Z 2023-08-18T22:28:40Z OWNER

Oh wow, null primary keys are bad news... SQLite lets you insert multiple rows with the same null value! ```pycon

import sqlite_utils db = sqlite_utils.Database(memory=True) db["foo"].insert({"id": None, "name": "No ID"}, pk="id")

<Table foo (id, name)> >>> db.schema 'CREATE TABLE [foo] (\n [id] TEXT PRIMARY KEY,\n [name] TEXT\n);' >>> db["foo"].insert({"id": None, "name": "No ID"}, pk="id") <Table foo (id, name)> >>> db.schema 'CREATE TABLE [foo] (\n [id] TEXT PRIMARY KEY,\n [name] TEXT\n);' >>> list(db["foo"].rows) [{'id': None, 'name': 'No ID'}, {'id': None, 'name': 'No ID'}] >>> list(db.query('select * from foo where id = null')) [] >>> list(db.query('select * from foo where id is null')) [{'id': None, 'name': 'No ID'}, {'id': None, 'name': 'No ID'}] ```
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1857234285  
Powered by Datasette · Queries took 1.052ms · About: github-to-sqlite