{"html_url": "https://github.com/dogsheep/swarm-to-sqlite/issues/13#issuecomment-1502543165", "issue_url": "https://api.github.com/repos/dogsheep/swarm-to-sqlite/issues/13", "id": 1502543165, "node_id": "IC_kwDODD6af85Zjv09", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-04-11T01:10:36Z", "updated_at": "2023-04-11T01:11:47Z", "author_association": "MEMBER", "body": "I just had that error myself on macOS while running the tests:\r\n```\r\nERROR tests/test_save_checkin.py::test_tables - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_venue - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_event - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_sticker - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_likes - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_with_ - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_users - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_photos - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_posts - sqlite3.OperationalError: table sqlite_master may not be modified\r\nERROR tests/test_save_checkin.py::test_view - sqlite3.OperationalError: table sqlite_master may not be modified\r\n```\r\n`pytest --pdb` shows it happening in the bit that adds foreign keys:\r\n```\r\n> /Users/simon/.local/share/virtualenvs/swarm-to-sqlite-daPW7yIJ/lib/python3.9/site-packages/sqlite_utils/db.py(1096)add_foreign_keys()\r\n-> cursor.execute(\r\n(Pdb) list\r\n1096 >>\t cursor.execute(\r\n1097 \t \"UPDATE sqlite_master SET sql = ? WHERE name = ?\",\r\n1098 \t (new_sql, table_name),\r\n1099 \t )\r\n1100 \t cursor.execute(\"PRAGMA schema_version = %d\" % (schema_version + 1))\r\n1101 ->\t cursor.execute(\"PRAGMA writable_schema = 0\")\r\n1102 \t # Have to VACUUM outside the transaction to ensure .foreign_keys property\r\n1103 \t # can see the newly created foreign key.\r\n1104 \t self.vacuum()\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373210675, "label": "fails before generating views. ERR: table sqlite_master may not be modified"}, "performed_via_github_app": null} {"html_url": "https://github.com/dogsheep/swarm-to-sqlite/issues/13#issuecomment-1502546045", "issue_url": "https://api.github.com/repos/dogsheep/swarm-to-sqlite/issues/13", "id": 1502546045, "node_id": "IC_kwDODD6af85Zjwh9", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-04-11T01:14:50Z", "updated_at": "2023-04-11T01:14:50Z", "author_association": "MEMBER", "body": "Related:\r\n- https://github.com/simonw/sqlite-utils/issues/235", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373210675, "label": "fails before generating views. ERR: table sqlite_master may not be modified"}, "performed_via_github_app": null} {"html_url": "https://github.com/dogsheep/swarm-to-sqlite/issues/13#issuecomment-1502629219", "issue_url": "https://api.github.com/repos/dogsheep/swarm-to-sqlite/issues/13", "id": 1502629219, "node_id": "IC_kwDODD6af85ZkE1j", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-04-11T03:15:26Z", "updated_at": "2023-04-11T03:15:26Z", "author_association": "MEMBER", "body": "OK, I figured this out. Unfortunately it's an error that occurs on Python versions that have defensive mode turned on, and it doesn't look like there's a way to turn that mode off. See notes above.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373210675, "label": "fails before generating views. ERR: table sqlite_master may not be modified"}, "performed_via_github_app": null} {"html_url": "https://github.com/dogsheep/swarm-to-sqlite/issues/13#issuecomment-1502629404", "issue_url": "https://api.github.com/repos/dogsheep/swarm-to-sqlite/issues/13", "id": 1502629404, "node_id": "IC_kwDODD6af85ZkE4c", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-04-11T03:15:47Z", "updated_at": "2023-04-11T03:46:17Z", "author_association": "MEMBER", "body": "I think `swarm-to-sqlite` needs to avoid this error, maybe by setting up foreign keys in another way - or even by skipping foreign keys entirely on databases that don't support this kind of operation.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373210675, "label": "fails before generating views. ERR: table sqlite_master may not be modified"}, "performed_via_github_app": null}