{"html_url": "https://github.com/simonw/sqlite-utils/issues/100#issuecomment-615372322", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/100", "id": 615372322, "node_id": "MDEyOklzc3VlQ29tbWVudDYxNTM3MjMyMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-04-17T17:31:42Z", "updated_at": "2020-04-17T17:31:42Z", "author_association": "OWNER", "body": "I'm going with `columns={\"score\": int}`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 601358649, "label": "Mechanism for forcing column-type, over-riding auto-detection"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/100#issuecomment-614846059", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/100", "id": 614846059, "node_id": "MDEyOklzc3VlQ29tbWVudDYxNDg0NjA1OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-04-16T19:17:56Z", "updated_at": "2020-04-16T19:17:56Z", "author_association": "OWNER", "body": "Reminder: the current list of arguments for those methods is:\r\nhttps://github.com/simonw/sqlite-utils/blob/13528faa817d79bc3900d3af7473300686b145d7/sqlite_utils/db.py#L951-L967", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 601358649, "label": "Mechanism for forcing column-type, over-riding auto-detection"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/100#issuecomment-614845657", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/100", "id": 614845657, "node_id": "MDEyOklzc3VlQ29tbWVudDYxNDg0NTY1Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-04-16T19:17:05Z", "updated_at": "2020-04-16T19:17:05Z", "author_association": "OWNER", "body": "The syntax for explicitly creating a table looks like this:\r\n```python\r\ndb[\"cats\"].create({\r\n \"id\": int,\r\n \"name\": str,\r\n \"weight\": float,\r\n}, pk=\"id\")\r\n```\r\nSo using a dictionary of column name -> Python type here would be good.\r\n\r\nI think it becomes a new optional argument to `.insert_all()` and `.insert()` and `.upsert_all()` and `.upsert()`. Question is, what should that argument be called?\r\n\r\nOptions:\r\n\r\n- `columns`\r\n- `types`\r\n- `type_overrides`\r\n- `extra_columns`\r\n\r\nI like the first two best. I'm leaning towards `columns` - it would serve two purposes: you can use it to ensure extra columns are created, and you can use it to specify the type on extra OR deteced columns.\r\n\r\nMaybe something like this:\r\n\r\n```python\r\ndb[\"authors\"].insert_all(\r\n [{\"id\": 1, \"name\": \"Sally\", \"score\": \"2\"}],\r\n pk=\"id\",\r\n not_null={\"name\", \"score\"},\r\n defaults={\"score\": 1},\r\n columns={\"score\": int, \"weight\": float}\r\n)\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 601358649, "label": "Mechanism for forcing column-type, over-riding auto-detection"}, "performed_via_github_app": null}