{"html_url": "https://github.com/simonw/sqlite-utils/issues/488#issuecomment-1364141224", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/488", "id": 1364141224, "node_id": "IC_kwDOCGYnMM5RTySo", "user": {"value": 1176293, "label": "ar-jan"}, "created_at": "2022-12-23T17:38:55Z", "updated_at": "2022-12-23T17:38:55Z", "author_association": "NONE", "body": "> text columns containing empty strings should not be rewritten to null.\r\n\r\nI would actually appreciate an option to do just that for text columns as well.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373224657, "label": "`sqlite-utils transform` should set empty strings to null when converting text columns to integer/float"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/488#issuecomment-1254033981", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/488", "id": 1254033981, "node_id": "IC_kwDOCGYnMM5Kvwo9", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-21T17:49:32Z", "updated_at": "2022-09-21T17:50:10Z", "author_association": "OWNER", "body": "It looks like SQLite has a `SELECT NULLIF(value, '')` function which returns `null` if that value is equal to `''`.\r\n\r\nWe need to only apply that function to columns that we know to be of type integer or float though - text columns containing empty strings should not be rewritten to null.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373224657, "label": "`sqlite-utils transform` should set empty strings to null when converting text columns to integer/float"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/488#issuecomment-1254032378", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/488", "id": 1254032378, "node_id": "IC_kwDOCGYnMM5KvwP6", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-21T17:47:54Z", "updated_at": "2022-09-21T17:47:54Z", "author_association": "OWNER", "body": "New tests should go in: https://github.com/simonw/sqlite-utils/blob/main/tests/test_transform.py\r\n\r\nI think the implementation fix needs to go near here: https://github.com/simonw/sqlite-utils/blob/0b315d3fa83c1584eaeec32f24912898621e437a/sqlite_utils/db.py#L1770-L1775\r\n\r\nThe trick is going to be teaching that generated SQL to know which columns are `integer` or `float` and to convert `\"\"` to `null` as part of that operation. ", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373224657, "label": "`sqlite-utils transform` should set empty strings to null when converting text columns to integer/float"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/488#issuecomment-1254029808", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/488", "id": 1254029808, "node_id": "IC_kwDOCGYnMM5Kvvnw", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-21T17:45:20Z", "updated_at": "2022-09-21T17:45:41Z", "author_association": "OWNER", "body": "No, I'm going to say that this is a bug - it's WEIRD having a `integer` or `float` column containing an empty string. I'm OK changing that - I very much doubt anyone is relying on this functionality.\r\n\r\nSo no need for a new option here - just fixing the bug is sensible.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373224657, "label": "`sqlite-utils transform` should set empty strings to null when converting text columns to integer/float"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/488#issuecomment-1246971764", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/488", "id": 1246971764, "node_id": "IC_kwDOCGYnMM5KU0d0", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-09-14T15:52:14Z", "updated_at": "2022-09-14T15:52:14Z", "author_association": "OWNER", "body": "Frustratingly I think this counts as a backwards-incompatible change.\r\n\r\nCould have it be opt-in with a new option / method parameter, and then change it to the default if I release a `sqlite-utils 4`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1373224657, "label": "`sqlite-utils transform` should set empty strings to null when converting text columns to integer/float"}, "performed_via_github_app": null}