{"html_url": "https://github.com/simonw/datasette/pull/1582#issuecomment-1077047152", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1582", "id": 1077047152, "node_id": "IC_kwDOBm6k_c5AMm9w", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2022-03-24T04:07:58Z", "updated_at": "2022-03-24T04:07:58Z", "author_association": "CONTRIBUTOR", "body": "this has been obviated by the datasette-hashed-urls plugin", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1090055810, "label": "don't set far expiry if hash is '000'"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1581#issuecomment-1077047295", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1581", "id": 1077047295, "node_id": "IC_kwDOBm6k_c5AMm__", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2022-03-24T04:08:18Z", "updated_at": "2022-03-24T04:08:18Z", "author_association": "CONTRIBUTOR", "body": "this has been addressed by the datasette-hashed-urls plugin", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1089529555, "label": "when hashed urls are turned on, the _memory db has improperly long-lived cache expiry"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/399#issuecomment-1077671779", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/399", "id": 1077671779, "node_id": "IC_kwDOCGYnMM5AO_dj", "user": {"value": 25778, "label": "eyeseast"}, "created_at": "2022-03-24T14:11:33Z", "updated_at": "2022-03-24T14:11:43Z", "author_association": "CONTRIBUTOR", "body": "Coming back to this. I was about to add a utility function to [datasette-geojson]() to convert lat/lng columns to geometries. Thankfully I googled first. There's a SpatiaLite function for this: [MakePoint](https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html#p0).\r\n\r\n```sql\r\nselect MakePoint(longitude, latitude) as geometry from places;\r\n```\r\n\r\nI'm not sure if that would work with `conversions`, since it needs two columns, but it's an option for tables that already have latitude, longitude columns.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1124731464, "label": "Make it easier to insert geometries, with documentation and maybe code"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1684#issuecomment-1078126065", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1684", "id": 1078126065, "node_id": "IC_kwDOBm6k_c5AQuXx", "user": {"value": 536941, "label": "fgregg"}, "created_at": "2022-03-24T20:08:56Z", "updated_at": "2022-03-24T20:13:19Z", "author_association": "CONTRIBUTOR", "body": "would be nice if the behavior was\r\n\r\n1. try to facet all the columns\r\n2. for bigger tables try to facet the indexed columns\r\n3. for the biggest tables, turn off autofacetting completely\r\n\r\nThis is based on my assumption that what determines autofaceting is the rarity of unique values. Which may not be true!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1179998071, "label": "Mechanism for disabling faceting on large tables only"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/420#issuecomment-1078315922", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/420", "id": 1078315922, "node_id": "IC_kwDOCGYnMM5ARcuS", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-24T21:09:27Z", "updated_at": "2022-03-24T21:09:27Z", "author_association": "OWNER", "body": "Yeah, this is WAY harder than it should be.\r\n\r\nThere's a clumsy workaround you could use which looks something like this: create a file `my_enchant.py` containing:\r\n\r\n```python\r\nimport enchant\r\nd = enchant.Dict(\"en_US\")\r\n\r\ndef check(word):\r\n return d.check(word)\r\n```\r\nThen run `sqlite-utils` like this:\r\n\r\n```\r\nPYTHONPATH=. cat items.json | jq '.data' | sqlite-utils insert listings.db listings - --convert 'my_enchant.check(value)' --import my_enchant\r\n```\r\nExcept I tried that and it doesn't work! I don't know the right pattern for getting `--import` to work with modules in the same directory.\r\n\r\nSo yeah, this is definitely a big feature gap.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1178546862, "label": "Document how to use a `--convert` function that runs initialization code first"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/420#issuecomment-1078322301", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/420", "id": 1078322301, "node_id": "IC_kwDOCGYnMM5AReR9", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-24T21:10:52Z", "updated_at": "2022-03-24T21:10:52Z", "author_association": "OWNER", "body": "I can think of three ways forward:\r\n\r\n- Figure out a pattern that gets that local file import workaround to work\r\n- Add another option such as `--convert-init` that lets you pass code that will be executed once at the start\r\n- Come up with a pattern where the `--convert` code can run some initialization code and then return a function which will be called against each value\r\n\r\nI quite like the idea of that third option - I'm going to prototype it and see if I can work something out.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1178546862, "label": "Document how to use a `--convert` function that runs initialization code first"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/420#issuecomment-1078328774", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/420", "id": 1078328774, "node_id": "IC_kwDOCGYnMM5ARf3G", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-24T21:12:33Z", "updated_at": "2022-03-24T21:12:33Z", "author_association": "OWNER", "body": "Here's how the `_compile_code()` mechanism works at the moment: https://github.com/simonw/sqlite-utils/blob/396f80fcc60da8dd844577114f7920830a2e5403/sqlite_utils/utils.py#L308-L342\r\n\r\nAt the end it does this:\r\n```python\r\n return locals[\"fn\"]\r\n```\r\nSo it's already building and then returning a function.\r\n\r\nThe question is if there's a sensible way to allow people to further customize that function by executing some code first, in a way that's easy to explain.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1178546862, "label": "Document how to use a `--convert` function that runs initialization code first"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/420#issuecomment-1078343231", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/420", "id": 1078343231, "node_id": "IC_kwDOCGYnMM5ARjY_", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-03-24T21:16:10Z", "updated_at": "2022-03-24T21:17:20Z", "author_association": "OWNER", "body": "Aha! This may be possible already: https://github.com/simonw/sqlite-utils/blob/396f80fcc60da8dd844577114f7920830a2e5403/sqlite_utils/utils.py#L311-L316\r\n\r\nAnd yes, this does indeed work - you can do something like this:\r\n\r\n```\r\necho '{\"name\": \"harry\"}' | sqlite-utils insert db.db people - --convert '\r\nimport time\r\n# Simulate something expensive\r\ntime.sleep(1)\r\n\r\ndef convert(row):\r\n row[\"upper\"] = row[\"name\"].upper()\r\n'\r\n```\r\nAnd after running that:\r\n```\r\nsqlite-utils dump db.db \r\nBEGIN TRANSACTION;\r\nCREATE TABLE [people] (\r\n [name] TEXT,\r\n [upper] TEXT\r\n);\r\nINSERT INTO \"people\" VALUES('harry','HARRY');\r\nCOMMIT;\r\n```\r\nSo this is a documentation issue - there's a trick for it but I didn't know what the trick was!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1178546862, "label": "Document how to use a `--convert` function that runs initialization code first"}, "performed_via_github_app": null}