{"html_url": "https://github.com/simonw/sqlite-utils/issues/403#issuecomment-1033332570", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/403", "id": 1033332570, "node_id": "IC_kwDOCGYnMM49l2da", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2022-02-09T04:22:43Z", "updated_at": "2022-02-09T04:22:43Z", "author_association": "CONTRIBUTOR", "body": "dddoooope", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1126692066, "label": "Document how to add a primary key to a rowid table using `sqlite-utils transform --pk`"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/403#issuecomment-1032987901", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/403", "id": 1032987901, "node_id": "IC_kwDOCGYnMM49kiT9", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-02-08T19:36:06Z", "updated_at": "2022-02-08T19:36:06Z", "author_association": "OWNER", "body": "New documentation: https://sqlite-utils.datasette.io/en/latest/cli.html#adding-a-primary-key-to-a-rowid-table", "reactions": "{\"total_count\": 3, \"+1\": 3, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1126692066, "label": "Document how to add a primary key to a rowid table using `sqlite-utils transform --pk`"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/403#issuecomment-1032976720", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/403", "id": 1032976720, "node_id": "IC_kwDOCGYnMM49kflQ", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-02-08T19:23:05Z", "updated_at": "2022-02-08T19:23:27Z", "author_association": "OWNER", "body": "This is already possible using `sqlite-utils transform` like so:\r\n\r\n```\r\n% echo '[{\"name\": \"Barry\"}, {\"name\": \"Sandra\"}]' | sqlite-utils insert rowid.db records -\r\n% sqlite-utils schema rowid.db \r\nCREATE TABLE [records] (\r\n [name] TEXT\r\n);\r\n% sqlite-utils rows rowid.db records\r\n[{\"name\": \"Barry\"},\r\n {\"name\": \"Sandra\"}]\r\n% sqlite-utils transform rowid.db records --pk id\r\n% sqlite-utils rows rowid.db records\r\n[{\"id\": 1, \"name\": \"Barry\"},\r\n {\"id\": 2, \"name\": \"Sandra\"}]\r\n% sqlite-utils schema rowid.db\r\nCREATE TABLE \"records\" (\r\n [id] INTEGER PRIMARY KEY,\r\n [name] TEXT\r\n);\r\n% echo '[{\"name\": \"Barry 2\"}, {\"name\": \"Sandra 2\"}]' | sqlite-utils insert rowid.db records -\r\n% sqlite-utils rows rowid.db records \r\n[{\"id\": 1, \"name\": \"Barry\"},\r\n {\"id\": 2, \"name\": \"Sandra\"},\r\n {\"id\": 3, \"name\": \"Barry 2\"},\r\n {\"id\": 4, \"name\": \"Sandra 2\"}]\r\n```\r\nIt's not covered in the documentation though: https://sqlite-utils.datasette.io/en/3.23/cli.html#transforming-tables", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1126692066, "label": "Document how to add a primary key to a rowid table using `sqlite-utils transform --pk`"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/403#issuecomment-1032126353", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/403", "id": 1032126353, "node_id": "IC_kwDOCGYnMM49hP-R", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2022-02-08T01:45:15Z", "updated_at": "2022-02-08T01:45:31Z", "author_association": "CONTRIBUTOR", "body": "you can hack something like this to achieve this result:\r\n\r\n`sqlite-utils convert my_database my_table rowid \"{'id': value}\" --multi`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1126692066, "label": "Document how to add a primary key to a rowid table using `sqlite-utils transform --pk`"}, "performed_via_github_app": null}