html_url,issue_url,id,node_id,user,user_label,created_at,updated_at,author_association,body,reactions,issue,issue_label,performed_via_github_app https://github.com/simonw/sqlite-utils/issues/87#issuecomment-586661250,https://api.github.com/repos/simonw/sqlite-utils/issues/87,586661250,MDEyOklzc3VlQ29tbWVudDU4NjY2MTI1MA==,9599,simonw,2020-02-16T02:19:33Z,2020-02-16T02:19:33Z,OWNER,"Here's the code: https://github.com/simonw/sqlite-utils/blob/5e0000609f9be6efafea1b96f610988eb18d6d89/sqlite_utils/utils.py#L18-L24","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",565837965,Should detect collections.OrderedDict as a regular dictionary, https://github.com/simonw/sqlite-utils/issues/87#issuecomment-586661276,https://api.github.com/repos/simonw/sqlite-utils/issues/87,586661276,MDEyOklzc3VlQ29tbWVudDU4NjY2MTI3Ng==,9599,simonw,2020-02-16T02:20:14Z,2020-02-16T02:20:14Z,OWNER,"`OrderedDict` is actually a subclass of `dict` - so a smart fix would be for this logic to check and see if the type `t` is a subclass of one of `list`, `tuple` or `dict`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",565837965,Should detect collections.OrderedDict as a regular dictionary, https://github.com/simonw/sqlite-utils/issues/86#issuecomment-586661934,https://api.github.com/repos/simonw/sqlite-utils/issues/86,586661934,MDEyOklzc3VlQ29tbWVudDU4NjY2MTkzNA==,9599,simonw,2020-02-16T02:33:07Z,2020-02-16T02:33:07Z,OWNER,"Thanks for the example file - looks like it can be trimmed down to just these two lines to replicate the bug: ```csv ""MTU (CET)"",""Day-ahead Price [EUR/MWh]"" ""01.01.2016 00:00 - 01.01.2016 01:00"",""23.86"" ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",564579430,Problem with square bracket in CSV column name, https://github.com/simonw/sqlite-utils/issues/86#issuecomment-586662404,https://api.github.com/repos/simonw/sqlite-utils/issues/86,586662404,MDEyOklzc3VlQ29tbWVudDU4NjY2MjQwNA==,9599,simonw,2020-02-16T02:43:12Z,2020-02-16T02:43:12Z,OWNER,"https://stackoverflow.com/a/22694438 looks like the answer: > When using square brackets, it is not possible to have these characters in the identifier. > > When using double quotes, you can escape them in the name by doubling them: > > `CREATE TABLE ""hello """"world""""""(key INTEGER PRIMARY KEY);`","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",564579430,Problem with square bracket in CSV column name, https://github.com/simonw/sqlite-utils/issues/86#issuecomment-586676640,https://api.github.com/repos/simonw/sqlite-utils/issues/86,586676640,MDEyOklzc3VlQ29tbWVudDU4NjY3NjY0MA==,9599,simonw,2020-02-16T07:16:31Z,2020-02-16T07:16:31Z,OWNER,"There's something weird about this. I created a test database file like so: ``` sqlite3 /tmp/demo.db < .schema CREATE TABLE IF NOT EXISTS ""data"" ( ""MTU (CET)"" TEXT, ""Day-ahead Price [EUR/MWh]"" TEXT ); sqlite> .headers on sqlite> select * from data; MTU (CET)|Day-ahead Price [EUR/MWh] 01.01.2016 00:00 - 01.01.2016 01:00|23.86 sqlite> ``` BUT... if I open the same database in Python, something weird happens: ``` In [1]: import sqlite3 In [2]: conn = sqlite3.connect(""/tmp/demo.db"") In [3]: cursor = conn.cursor() In [4]: cursor.execute(""select * from data"") Out[4]: In [5]: cursor.fetchall() Out[5]: [('01.01.2016 00:00 - 01.01.2016 01:00', '23.86')] In [6]: cursor.description Out[6]: (('MTU (CET)', None, None, None, None, None, None), ('Day-ahead Price', None, None, None, None, None, None)) In [7]: conn.row_factory = sqlite3.Row In [8]: cursor = conn.cursor() In [9]: cursor.execute(""select * from data"") Out[9]: In [10]: row = cursor.fetchall() In [12]: row Out[12]: In [15]: row.keys() Out[15]: ['MTU (CET)', 'Day-ahead Price'] ``` Note that in `cursor.description` AND in `row.keys()` above the second column is displayed as `'Day-ahead Price'` - when we would expect it to be displayed as `Day-ahead Price [EUR/MWh]` So.... it looks like there may be a bug in Python's `sqlite3` module where columns with square braces in them have that portion of the name stripped out!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",564579430,Problem with square bracket in CSV column name, https://github.com/simonw/sqlite-utils/issues/86#issuecomment-586676856,https://api.github.com/repos/simonw/sqlite-utils/issues/86,586676856,MDEyOklzc3VlQ29tbWVudDU4NjY3Njg1Ng==,9599,simonw,2020-02-16T07:20:34Z,2020-02-16T07:20:34Z,OWNER,"I'm not sure what to do about this one. 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. So... I could do one of the following: - Throw an error if a column name includes those characters. That's my preferred option I think. - Automatically replace `[` in column names with `(` and `]` with `)` - Do the automatic replacement but show a user-visible warning when I do it - Throw an error, but give the user an option to run with e.g. `--fix-column-names` which applies that automatic fix. 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.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",564579430,Problem with square bracket in CSV column name, https://github.com/simonw/sqlite-utils/issues/86#issuecomment-586683572,https://api.github.com/repos/simonw/sqlite-utils/issues/86,586683572,MDEyOklzc3VlQ29tbWVudDU4NjY4MzU3Mg==,8149512,foscoj,2020-02-16T09:03:54Z,2020-02-16T09:03:54Z,NONE,"Probably the best option to just throw the error. Is there any active dev chan where we could post the issue to python sqlite3?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",564579430,Problem with square bracket in CSV column name, https://github.com/simonw/sqlite-utils/issues/86#issuecomment-586729798,https://api.github.com/repos/simonw/sqlite-utils/issues/86,586729798,MDEyOklzc3VlQ29tbWVudDU4NjcyOTc5OA==,9599,simonw,2020-02-16T17:11:02Z,2020-02-16T17:11:02Z,OWNER,I filed a bug in the Python issue tracker here: https://bugs.python.org/issue39652,"{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",564579430,Problem with square bracket in CSV column name,