{"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926203501", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926203501, "node_id": "IC_kwDOCGYnMM43NL5t", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:15:07Z", "updated_at": "2021-09-23T22:15:30Z", "author_association": "OWNER", "body": "Quoting https://github.com/simonw/sqlite-utils/issues/86#issuecomment-586676856 in full:\r\n\r\n> I'm not sure what to do about this one.\r\n> \r\n> I can't fix it: this bug in Python's `sqlite3` module means that even if I write a database out with column names that include `[]` I won't be able to read them back again.\r\n> \r\n> So... I could do one of the following:\r\n> \r\n> * Throw an error if a column name includes those characters. That's my preferred option I think.\r\n> * Automatically replace `[` in column names with `(` and `]` with `)`\r\n> * Do the automatic replacement but show a user-visible warning when I do it\r\n> * Throw an error, but give the user an option to run with e.g. `--fix-column-names` which applies that automatic fix.\r\n> \r\n> \r\n> Since this is likely to be an incredibly rare edge-case I think I'd rather minimize the amount of code that deals with it, so my preferred option is to just throw that error and stop.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926204046", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926204046, "node_id": "IC_kwDOCGYnMM43NMCO", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:16:18Z", "updated_at": "2021-09-23T22:16:18Z", "author_association": "OWNER", "body": "So either I do the automatic replacement, or I let the user request automatic replacement, or a third option: I do automatic replacement but let the user opt to receive an error instead.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926205047", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926205047, "node_id": "IC_kwDOCGYnMM43NMR3", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:18:34Z", "updated_at": "2021-09-23T22:19:38Z", "author_association": "OWNER", "body": "Here's the code where this happens: https://github.com/simonw/sqlite-utils/blob/54191d4dc114d7dc21e849b48a4d5ae4f9e601ca/sqlite_utils/db.py#L2943-L2948\r\n\r\nIt's called from three different methods in `db.py`: `create_table_sql()`, `update()` and `insert_all()`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926206220", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926206220, "node_id": "IC_kwDOCGYnMM43NMkM", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:20:55Z", "updated_at": "2021-09-23T22:21:19Z", "author_association": "OWNER", "body": "If I add a new parameter for opting in and out of fixing these, what should it be called? A few options:\r\n\r\n- `fix_columns=False`\r\n- `rename_bad_columns=False`\r\n- `fix_column_names=False`\r\n- `error_on_invalid_column_names=True`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926206705", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926206705, "node_id": "IC_kwDOCGYnMM43NMrx", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:21:58Z", "updated_at": "2021-09-23T22:21:58Z", "author_association": "OWNER", "body": "I'm inclined to just fix them and not have an option for opting-out of fixing them, since it adds quite a bit of cruft to the overall API design for an option that maybe no-one will ever use.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926207246", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926207246, "node_id": "IC_kwDOCGYnMM43NM0O", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:23:09Z", "updated_at": "2021-09-23T22:23:09Z", "author_association": "OWNER", "body": "What are my options for replacing those characters?\r\n\r\n- `[` becomes `(` and `]` becomes `)`\r\n- `[` and `]` are removed entirely\r\n- `[` and `]` both become `_`", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926207719", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926207719, "node_id": "IC_kwDOCGYnMM43NM7n", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:24:09Z", "updated_at": "2021-09-23T22:24:09Z", "author_association": "OWNER", "body": "I think I like the underscore option best. I don't like the idea of injecting surprise `( )` parenthesis, and having them vanish entirely could result in things like `item[price]` becoming `itemprice` which feels confusing.\r\n\r\n`item_price_` is a little ugly but I think I can live with it.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/329#issuecomment-926208819", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/329", "id": 926208819, "node_id": "IC_kwDOCGYnMM43NNMz", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-09-23T22:26:54Z", "updated_at": "2021-09-23T22:26:54Z", "author_association": "OWNER", "body": "I could even have those replacement characters be properties of the `Database` class, so uses can sub-class and change them.\r\n\r\n```python\r\nclass Database:\r\n left_brace_replace = \"_\"\r\n right_brace_replace = \"_\"\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": 1005891028, "label": "Rethink approach to [ and ] in column names (currently throws error)"}, "performed_via_github_app": null}