{"html_url": "https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646655272", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/568", "id": 1646655272, "node_id": "IC_kwDOCGYnMM5iJfco", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-22T19:25:35Z", "updated_at": "2023-07-22T19:25:35Z", "author_association": "OWNER", "body": "Here's why that test broke: https://github.com/simonw/sqlite-utils/blob/58b577279fcd5ef6ce88f88b28668dffebfe7f44/sqlite_utils/db.py#L960-L964\r\n\r\nI added an extra `if self[name].exists()` check to the `db.create_table()` method.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1816851056, "label": "table.create(..., replace=True)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646654818", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/568", "id": 1646654818, "node_id": "IC_kwDOCGYnMM5iJfVi", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-22T19:22:40Z", "updated_at": "2023-07-22T19:22:40Z", "author_association": "OWNER", "body": "I think this broke a test:\r\n```\r\n$ pytest tests/test_tracer.py \r\n=============================================== test session starts ================================================\r\nplatform darwin -- Python 3.11.4, pytest-7.2.2, pluggy-1.0.0\r\nrootdir: /Users/simon/Dropbox/Development/sqlite-utils\r\nplugins: icdiff-0.6, hypothesis-6.68.2\r\ncollected 2 items \r\n\r\ntests/test_tracer.py F. [100%]\r\n\r\n===================================================== FAILURES =====================================================\r\n___________________________________________________ test_tracer ____________________________________________________\r\n\r\n def test_tracer():\r\n collected = []\r\n db = Database(\r\n memory=True, tracer=lambda sql, params: collected.append((sql, params))\r\n )\r\n db[\"dogs\"].insert({\"name\": \"Cleopaws\"})\r\n db[\"dogs\"].enable_fts([\"name\"])\r\n db[\"dogs\"].search(\"Cleopaws\")\r\n> assert collected == [\r\n (\"PRAGMA recursive_triggers=on;\", None),\r\n (\"select name from sqlite_master where type = 'view'\", None),\r\n (\"select name from sqlite_master where type = 'table'\", None),\r\n (\"select name from sqlite_master where type = 'view'\", None),\r\n (\"CREATE TABLE [dogs] (\\n [name] TEXT\\n);\\n \", None),\r\n (\"select name from sqlite_master where type = 'view'\", None),\r\n (\"INSERT INTO [dogs] ([name]) VALUES (?);\", [\"Cleopaws\"]),\r\n (\"select name from sqlite_master where type = 'view'\", None),\r\n (\r\n \"CREATE VIRTUAL TABLE [dogs_fts] USING FTS5 (\\n [name],\\n content=[dogs]\\n)\",\r\n None,\r\n ),\r\n (\r\n \"INSERT INTO [dogs_fts] (rowid, [name])\\n SELECT rowid, [name] FROM [dogs];\",\r\n None,\r\n ),\r\n (\"select name from sqlite_master where type = 'view'\", None),\r\n ]\r\nE assert equals failed\r\nE [ [ \r\nE ('PRAGMA recursive_triggers=on;', None), ('PRAGMA recursive_triggers=on;', None), \r\nE ( \r\nE \"select name from sqlite_master where type = \r\nE 'view'\", \r\nE None, ...\r\nE \r\nE ...Full output truncated (13 lines hidden), use '-vv' to show\r\n\r\ntests/test_tracer.py:12: AssertionError\r\n============================================= short test summary info ==============================================\r\nFAILED tests/test_tracer.py::test_tracer - assert equals failed\r\n=========================================== 1 failed, 1 passed in 0.05s ============================================\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1816851056, "label": "table.create(..., replace=True)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646653610", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/568", "id": 1646653610, "node_id": "IC_kwDOCGYnMM5iJfCq", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-22T19:14:56Z", "updated_at": "2023-07-22T19:14:56Z", "author_association": "OWNER", "body": "Manual testing of CLI command as well:\r\n```\r\n$ sqlite-utils create-table /tmp/f.db foo id integer \r\n$ sqlite-utils create-table /tmp/f.db foo id integer\r\nError: Table \"foo\" already exists. Use --replace to delete and replace it.\r\n$ sqlite-utils create-table /tmp/f.db foo id integer --replace\r\n$ sqlite-utils create-table /tmp/f.db foo id \r\n$ sqlite-utils schema /tmp/f.db\r\nCREATE TABLE [foo] (\r\n [id] INTEGER\r\n);\r\n$ sqlite-utils create-table /tmp/f.db foo id integer name str --transform\r\nError: column types must be one of ('INTEGER', 'TEXT', 'FLOAT', 'BLOB')\r\n$ sqlite-utils create-table /tmp/f.db foo id integer name text --transform\r\n$ sqlite-utils schema /tmp/f.db \r\nCREATE TABLE \"foo\" (\r\n [id] INTEGER,\r\n [name] TEXT\r\n);\r\n$ sqlite-utils create-table /tmp/f.db foo id integer name text --ignore \r\n$ sqlite-utils create-table /tmp/f.db foo id integer name text --replace\r\n$ sqlite-utils schema /tmp/f.db \r\nCREATE TABLE [foo] (\r\n [id] INTEGER,\r\n [name] TEXT\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": 1816851056, "label": "table.create(..., replace=True)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/568#issuecomment-1646653382", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/568", "id": 1646653382, "node_id": "IC_kwDOCGYnMM5iJe_G", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-07-22T19:13:20Z", "updated_at": "2023-07-22T19:13:20Z", "author_association": "OWNER", "body": "Demo:\r\n```pycon\r\n>>> from sqlite_utils import Database\r\n>>> db = Database(memory=True)\r\n>>> db[\"foo\"].create({\"id\": int})\r\n