{"html_url": "https://github.com/simonw/sqlite-utils/issues/134#issuecomment-678474018", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/134", "id": 678474018, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ3NDAxOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T20:16:20Z", "updated_at": "2020-08-21T20:16:20Z", "author_association": "OWNER", "body": "Trickiest part of this is how to write a test for it.\r\n\r\nI'll do a `pytest.skipIf` that only executes the test if SpatiaLite is available.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683804172, "label": "--load-extension option for sqlite-utils query"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/134#issuecomment-678474928", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/134", "id": 678474928, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ3NDkyOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T20:18:33Z", "updated_at": "2020-08-21T20:18:33Z", "author_association": "OWNER", "body": "This should get me SpatiaLite in the GitHub Actions Ubuntu:\r\n```\r\napt install libsqlite3-mod-spatialite\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683804172, "label": "--load-extension option for sqlite-utils query"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/135#issuecomment-678475578", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/135", "id": 678475578, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ3NTU3OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T20:20:05Z", "updated_at": "2020-08-21T20:20:05Z", "author_association": "OWNER", "body": "https://github.com/simonw/cryptozoology/blob/2ad69168f3b78ebd90a2cbeea8136c9115e2a9b7/build_cryptids_database.py#L16-L22\r\n```python\r\ntry_these = (\r\n \"mod_spatialite\",\r\n \"/usr/local/lib/mod_spatialite.dylib\",\r\n \"/usr/lib/x86_64-linux-gnu/mod_spatialite.so\",\r\n \"/usr/lib/x86_64-linux-gnu/libspatialite.so.5\",\r\n \"/usr/lib/x86_64-linux-gnu/libspatialite.so.7\",\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": 683805434, "label": "Code for finding SpatiaLite in the usual locations"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/134#issuecomment-678476338", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/134", "id": 678476338, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ3NjMzOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T20:22:02Z", "updated_at": "2020-08-21T20:22:02Z", "author_association": "OWNER", "body": "I think that adds it as `/usr/lib/x86_64-linux-gnu/mod_spatialite.so`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683804172, "label": "--load-extension option for sqlite-utils query"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/135#issuecomment-678476842", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/135", "id": 678476842, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ3Njg0Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T20:23:13Z", "updated_at": "2020-08-21T20:23:13Z", "author_association": "OWNER", "body": "I'm going to start with just the first two - I'm not convinced I understand the `.so.5` variants.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683805434, "label": "Code for finding SpatiaLite in the usual locations"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/135#issuecomment-678479741", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/135", "id": 678479741, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ3OTc0MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T20:30:37Z", "updated_at": "2020-08-21T20:30:37Z", "author_association": "OWNER", "body": "Docs: https://github.com/simonw/sqlite-utils/blob/bf4c6b7c82fab6b2400e48424f8dac1ae2f0a2dc/docs/python-api.rst#finding-spatialite", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683805434, "label": "Code for finding SpatiaLite in the usual locations"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/136#issuecomment-678480969", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/136", "id": 678480969, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ4MDk2OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T20:33:45Z", "updated_at": "2020-08-21T20:33:45Z", "author_association": "OWNER", "body": "I think this should initialize SpatiaLite against the current database if it has not been initialized already.\r\n\r\nRelevant code: https://github.com/simonw/shapefile-to-sqlite/blob/e754d0747ca2facf9a7433e2d5d15a6a37a9cf6e/shapefile_to_sqlite/utils.py#L112-L126\r\n\r\n```python\r\ndef init_spatialite(db, lib):\r\n db.conn.enable_load_extension(True)\r\n db.conn.load_extension(lib)\r\n # Initialize SpatiaLite if not yet initialized\r\n if \"spatial_ref_sys\" in db.table_names():\r\n return\r\n db.conn.execute(\"select InitSpatialMetadata(1)\")\r\n\r\n\r\ndef ensure_table_has_geometry(db, table, table_srid):\r\n if \"geometry\" not in db[table].columns_dict:\r\n db.conn.execute(\r\n \"SELECT AddGeometryColumn(?, 'geometry', ?, 'GEOMETRY', 2);\",\r\n [table, table_srid],\r\n )\r\n```\r\nNot sure if I should add a utility function or CLI command for that `ensure_table_has_geometry` bit.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683812642, "label": "--load-extension=spatialite shortcut option"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/134#issuecomment-678497497", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/134", "id": 678497497, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODQ5NzQ5Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T21:06:26Z", "updated_at": "2020-08-21T21:06:26Z", "author_association": "OWNER", "body": "Ended up needing two skipIfs:\r\n\r\nhttps://github.com/simonw/sqlite-utils/blob/7e9aad7e1c09d1cf80d0b4d17d6157212a4b857d/tests/test_cli.py#L888-L893", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683804172, "label": "--load-extension option for sqlite-utils query"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/137#issuecomment-678507502", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/137", "id": 678507502, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODUwNzUwMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T21:13:19Z", "updated_at": "2020-08-21T21:13:19Z", "author_association": "OWNER", "body": "Adding `--spatialite` too would be great for usability: #136", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683830416, "label": "--load-extension for other sqlite-utils commands"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/136#issuecomment-678508056", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/136", "id": 678508056, "node_id": "MDEyOklzc3VlQ29tbWVudDY3ODUwODA1Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-08-21T21:13:41Z", "updated_at": "2020-08-21T21:13:41Z", "author_association": "OWNER", "body": "The `--spatialite` option should be available for other useful commands too, refs #137.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 683812642, "label": "--load-extension=spatialite shortcut option"}, "performed_via_github_app": null}