{"html_url": "https://github.com/simonw/datasette/issues/1257#issuecomment-852686827", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1257", "id": 852686827, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MjY4NjgyNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-02T03:26:27Z", "updated_at": "2021-06-02T03:26:27Z", "author_association": "OWNER", "body": "I tried and failed to get this fix working for tables with double quotes in their name - I couldn't figure out what the double-quote-in-a-table-name version of this code would look like: https://github.com/simonw/datasette/blob/807de378d08752a0f05bb1b980a0a62620a70520/datasette/utils/__init__.py#L538-L548", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 828811618, "label": "Table names containing single quotes break things"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1257#issuecomment-852681622", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1257", "id": 852681622, "node_id": "MDEyOklzc3VlQ29tbWVudDg1MjY4MTYyMg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-02T03:12:18Z", "updated_at": "2021-06-02T03:12:18Z", "author_association": "OWNER", "body": "Created a test database like this:\r\n```\r\n% sqlite-utils create-table quote-in-name.db \"this'hasquoteinname\" id integer name text --pk id\r\n% datasette quote-in-name.db -p 8025 --pdb\r\nINFO: Started server process [86046]\r\nINFO: Waiting for application startup.\r\nINFO: Application startup complete.\r\nINFO: Uvicorn running on http://127.0.0.1:8025 (Press CTRL+C to quit)\r\n> /Users/simon/Dropbox/Development/datasette/datasette/utils/__init__.py(530)detect_fts()\r\n-> rows = conn.execute(detect_fts_sql(table)).fetchall()\r\n(Pdb) c\r\nTraceback (most recent call last):\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/app.py\", line 1124, in route_path\r\n response = await view(request, send)\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/views/base.py\", line 147, in view\r\n return await self.dispatch_request(\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/views/base.py\", line 122, in dispatch_request\r\n return await handler(request, *args, **kwargs)\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/views/index.py\", line 72, in get\r\n \"fts_table\": await db.fts_table(table),\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/database.py\", line 279, in fts_table\r\n return await self.execute_fn(lambda conn: detect_fts(conn, table))\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/database.py\", line 155, in execute_fn\r\n return await asyncio.get_event_loop().run_in_executor(\r\n File \"/Users/simon/.pyenv/versions/3.8.2/lib/python3.8/concurrent/futures/thread.py\", line 57, in run\r\n result = self.fn(*self.args, **self.kwargs)\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/database.py\", line 153, in in_thread\r\n return fn(conn)\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/database.py\", line 279, in \r\n return await self.execute_fn(lambda conn: detect_fts(conn, table))\r\n File \"/Users/simon/Dropbox/Development/datasette/datasette/utils/__init__.py\", line 530, in detect_fts\r\n rows = conn.execute(detect_fts_sql(table)).fetchall()\r\nsqlite3.OperationalError: near \"hasquoteinname\": syntax error\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 828811618, "label": "Table names containing single quotes break things"}, "performed_via_github_app": null}