{"html_url": "https://github.com/simonw/datasette/issues/1708#issuecomment-1095675839", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1708", "id": 1095675839, "node_id": "IC_kwDOBm6k_c5BTq-_", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-04-11T23:06:30Z", "updated_at": "2022-11-15T19:57:53Z", "author_association": "OWNER", "body": "# Datasette 1.0 alpha 1\r\n\r\nThis alpha release is a preview of Datasette 1.0.\r\n\r\nDatasette 1.0 marks a significant milestone in the project: it is the point from which various aspects of Datasette can be considered \"stable\", in that code developed against them should expect not to be broken by future releases in the 1.x series.\r\n\r\nThis will hold true until the next major version release, Datasette 2.0 - which we hope to hold off releasing for as long as possible.\r\n\r\nThe following Datasette components should be be considered stable after 1.0:\r\n\r\n- The plugin API. Plugins developed against 1.0 should continue to work unmodified throughout the 1.x series.\r\n- The JSON API. Code written that interacts with Datasette's default JSON web API should continue to work.\r\n- The template context. If you build custom templates against Datasette your custom pages should continue to work.\r\n\r\nNote that none of these components will cease to introduce new features. New plugin hooks, new JSON APIs and new template context variables can be introduced without breaking existing code.\r\n\r\nSince this alpha release previews features that will be frozen for 1.0, please test this thoroughly against your existing Datasette projects.\r\n\r\nYou can install the alpha using:\r\n\r\n pip install datasette==1.0a0\r\n\r\n## JSON API changes\r\n\r\nThe most significant changes introduced in this new alpha concern Datasette's JSON API.\r\n\r\nThe default JSON returned by the `/database/table.json` endpoint has changed. It now returns an object with two keys: `rows` - which contains a list of objects representing the rows in the table or query, and `more` containing a `boolean` that shows if there are more rows or if this object contains them all.\r\n\r\n```json\r\n{\r\n \"rows\": [{\r\n \"id\": 1,\r\n \"name\": \"Name 1\"\r\n }, {\r\n \"id\": 2,\r\n \"name\": \"Name 2\"\r\n }],\r\n \"more\": false\r\n}\r\n```\r\n[ Initially I thought about going with `next_url`, which would be `null` if you have reached the last page of records. Maybe that would be better? But since `next_url` cannot be provided on query pages, should this be part of the default format at all? ]\r\n\r\n## Use ?_extra= to retrieve extra fields\r\n\r\nThe default format can be expanded using one or more `?_extra=` parameters. This takes names of extra keys you would like to include. These can be comma-separated or `?_extra=` can be applied multiple times.\r\n\r\nFor example:\r\n\r\n /database/table.json?_extra=total\r\n\r\nThis adds a `\"total\": 124` field to the returned JSON.\r\n\r\n[ Question: if you do `?_facet=foo` then do you still need to do `?_extra=facets` - I think not? ]", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1200649124, "label": "Datasette 1.0 alpha upcoming release notes"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1875#issuecomment-1314615592", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1875", "id": 1314615592, "node_id": "IC_kwDOBm6k_c5OW3Eo", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-11-15T01:04:28Z", "updated_at": "2022-11-15T01:04:28Z", "author_association": "OWNER", "body": "Worth noting this bit in RFC 7807:\r\n\r\n> The fictional problem type here defines the \"errors\" extension, an\r\n> array that describes the details of each validation error. Each\r\n> member is an object containing \"detail\" to describe the issue, and\r\n> \"pointer\" to locate the problem within the request's content using a\r\n> JSON Pointer [JSON-POINTER].\r\n\r\nSo the list of `\"errors\"` with JSON Pointer isn't technically part of the spec, it's an imaginary extension.\r\n\r\nIt fits what I need to do though, so I'm inclined to stick with it anyway.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1430797211, "label": "Figure out design for JSON errors (consider RFC 7807)"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1875#issuecomment-1314620086", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1875", "id": 1314620086, "node_id": "IC_kwDOBm6k_c5OW4K2", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-11-15T01:09:56Z", "updated_at": "2022-11-15T01:09:56Z", "author_association": "OWNER", "body": "Rough initial prototype:\r\n```diff\r\ndiff --git a/datasette/views/table.py b/datasette/views/table.py\r\nindex 8b987221..518ac578 100644\r\n--- a/datasette/views/table.py\r\n+++ b/datasette/views/table.py\r\n@@ -1103,19 +1103,30 @@ class TableInsertView(BaseView):\r\n except json.JSONDecodeError as e:\r\n return _errors([\"Invalid JSON: {}\".format(e)])\r\n if not isinstance(data, dict):\r\n- return _errors([\"JSON must be a dictionary\"])\r\n+ return _errors([{\"detail\": \"JSON must be a dictionary\", \"pointer\": \"#/\"}])\r\n keys = data.keys()\r\n \r\n # keys must contain \"row\" or \"rows\"\r\n if \"row\" not in keys and \"rows\" not in keys:\r\n return _errors(['JSON must have one or other of \"row\" or \"rows\"'])\r\n rows = []\r\n+ was_single_row = False\r\n if \"row\" in keys:\r\n if \"rows\" in keys:\r\n- return _errors(['Cannot use \"row\" and \"rows\" at the same time'])\r\n+ return _errors(\r\n+ [\r\n+ {\r\n+ \"detail\": 'Cannot use \"row\" and \"rows\" at the same time',\r\n+ \"pointer\": \"#/row\",\r\n+ }\r\n+ ]\r\n+ )\r\n+ was_single_row = True\r\n row = data[\"row\"]\r\n if not isinstance(row, dict):\r\n- return _errors(['\"row\" must be a dictionary'])\r\n+ return _errors(\r\n+ [{\"detail\": '\"row\" must be a dictionary', \"pointer\": \"#/row\"}]\r\n+ )\r\n rows = [row]\r\n data[\"return\"] = True\r\n else:\r\n@@ -1152,9 +1163,12 @@ class TableInsertView(BaseView):\r\n invalid_columns = set(row.keys()) - columns\r\n if invalid_columns:\r\n errors.append(\r\n- \"Row {} has invalid columns: {}\".format(\r\n- i, \", \".join(sorted(invalid_columns))\r\n- )\r\n+ {\r\n+ \"detail\": \"Invalid columns: {}\".format(\r\n+ \", \".join(sorted(invalid_columns))\r\n+ ),\r\n+ \"pointer\": \"#/blah/\",\r\n+ }\r\n )\r\n if errors:\r\n return _errors(errors)\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1430797211, "label": "Figure out design for JSON errors (consider RFC 7807)"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1886#issuecomment-1314627077", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1886", "id": 1314627077, "node_id": "IC_kwDOBm6k_c5OW54F", "user": {"value": 11788561, "label": "jrdmb"}, "created_at": "2022-11-15T01:19:54Z", "updated_at": "2022-11-15T01:19:54Z", "author_association": "NONE", "body": "Datasette usage comments for its 5th anniversary celebration:\r\n\r\nI use Datasette and related tools for a Cosmology Researcher Talks database app project, which is [described in the github Readme](https://github.com/jrdmb/cosmotalks-datasette#readme) \r\n\r\nThe app hosted on the Google Cloud Run service also uses other Datasette-related tools developed by Simon - datasette-render-markdown, csvs-to-sqlite, datasette-template-sql, and datasette-block-robots. This is one of two apps used for querying the talks database, each has it pros/cons as described in the github Readme.\r\n\r\nAt present, over 170 different sites that host cosmology talks are scraped to collect new talks for import into the sqlite database. The shot-scraper and sqlite-utils tools are a major help for this.\r\n\r\nI also use the Mastodon API to get my favorites, toots, and boosts into a local database so I can do searches on the data. This was done on Twitter and was then extended to the Mastodon data. Again, sqlite-utils is an important tool for this.\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1447050738, "label": "Call for birthday presents: if you're using Datasette, let us know how you're using it here"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1882#issuecomment-1314813205", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1882", "id": 1314813205, "node_id": "IC_kwDOBm6k_c5OXnUV", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-11-15T06:00:41Z", "updated_at": "2022-11-15T06:00:41Z", "author_association": "OWNER", "body": "Documentation:\r\n\r\n- https://docs.datasette.io/en/1.0-dev/json_api.html#creating-a-table\r\n- https://docs.datasette.io/en/1.0-dev/json_api.html#creating-a-table-from-example-data\r\n\r\nWrote a TIL about how I wrote some of those tests with Copilot: https://til.simonwillison.net/gpt3/writing-test-with-copilot", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1435294468, "label": "`/db/-/create` API for creating tables"}, "performed_via_github_app": null}
{"html_url": "https://github.com/simonw/datasette/issues/1890#issuecomment-1314821337", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1890", "id": 1314821337, "node_id": "IC_kwDOBm6k_c5OXpTZ", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-11-15T06:08:19Z", "updated_at": "2022-11-15T06:08:19Z", "author_association": "OWNER", "body": "Oh interesting... this doesn't even need to be attached to the visible faceting feature, necessarily: Datasette could try to detect when a column has a limited number of options (which the faceting code handles already) and could turn those into an auto-complete interface.\r\n\r\nThere's actually a native HTML element for this these days: the `