html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app
https://github.com/simonw/datasette/issues/1862#issuecomment-1314845667,https://api.github.com/repos/simonw/datasette/issues/1862,1314845667,IC_kwDOBm6k_c5OXvPj,9599,2022-11-15T06:42:09Z,2022-11-15T06:42:32Z,OWNER,"I implemented this as part of `/db/-/create`.
https://docs.datasette.io/en/1.0-dev/json_api.html#creating-a-table-from-example-data","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1425011030,
https://github.com/simonw/datasette/issues/1863#issuecomment-1315808062,https://api.github.com/repos/simonw/datasette/issues/1863,1315808062,IC_kwDOBm6k_c5ObaM-,9599,2022-11-15T20:08:04Z,2022-11-15T20:08:04Z,OWNER,"The initial design I'm going to implement will look like this:
```
POST /db/table/1/-/update
Authorization: Bearer xxx
Content-Type: application/json
```
```json
{
""update"": {
""name"": ""New name""
}
}
```
Any fields that are not yet columns will return an error.
Should it enforce types, in as much as an integer column should have a JSON integer passed to it, or should it allow strings containing valid integers?
I'm going to allow strings, mainly as a workaround for the fact that JavaScript integers have a maximum size.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1425029242,
https://github.com/simonw/datasette/issues/1863#issuecomment-1315809260,https://api.github.com/repos/simonw/datasette/issues/1863,1315809260,IC_kwDOBm6k_c5Obafs,9599,2022-11-15T20:09:11Z,2022-11-15T20:09:11Z,OWNER,"I'm going to use the error format I've been experimenting with here:
- #1875
```json
{
""type"": ""https://example.net/validation-error"",
""title"": ""Your request is not valid."",
""errors"": [
{
""detail"": ""must be a positive integer"",
""pointer"": ""#/age""
},
{
""detail"": ""must be 'green', 'red' or 'blue'"",
""pointer"": ""#/profile/color""
}
]
}
```
I'm not quite ready to commit to a `type` URL though, so I'll leave that to be solved later should I fully embrace that RFC.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1425029242,
https://github.com/simonw/datasette/issues/1863#issuecomment-1315809867,https://api.github.com/repos/simonw/datasette/issues/1863,1315809867,IC_kwDOBm6k_c5ObapL,9599,2022-11-15T20:09:44Z,2022-11-15T20:09:44Z,OWNER,"I'm also not going to implement `""alter"": true` yet (which would add any missing columns based on the update) - I'll hold that off for a later feature.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1425029242,
https://github.com/simonw/datasette/issues/1863#issuecomment-1315812212,https://api.github.com/repos/simonw/datasette/issues/1863,1315812212,IC_kwDOBm6k_c5ObbN0,9599,2022-11-15T20:12:02Z,2022-11-15T20:12:02Z,OWNER,"If the update succeeds it will return `{""ok"": true}`.
For consistency with `/db/table/-/insert` you can pass `""return"": true` and it will return a `""row""` key with the now-updated full row.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1425029242,
https://github.com/simonw/datasette/issues/1875#issuecomment-1314615592,https://api.github.com/repos/simonw/datasette/issues/1875,1314615592,IC_kwDOBm6k_c5OW3Eo,9599,2022-11-15T01:04:28Z,2022-11-15T01:04:28Z,OWNER,"Worth noting this bit in RFC 7807:
> The fictional problem type here defines the ""errors"" extension, an
> array that describes the details of each validation error. Each
> member is an object containing ""detail"" to describe the issue, and
> ""pointer"" to locate the problem within the request's content using a
> JSON Pointer [JSON-POINTER].
So the list of `""errors""` with JSON Pointer isn't technically part of the spec, it's an imaginary extension.
It fits what I need to do though, so I'm inclined to stick with it anyway.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1430797211,
https://github.com/simonw/datasette/issues/1875#issuecomment-1314620086,https://api.github.com/repos/simonw/datasette/issues/1875,1314620086,IC_kwDOBm6k_c5OW4K2,9599,2022-11-15T01:09:56Z,2022-11-15T01:09:56Z,OWNER,"Rough initial prototype:
```diff
diff --git a/datasette/views/table.py b/datasette/views/table.py
index 8b987221..518ac578 100644
--- a/datasette/views/table.py
+++ b/datasette/views/table.py
@@ -1103,19 +1103,30 @@ class TableInsertView(BaseView):
except json.JSONDecodeError as e:
return _errors([""Invalid JSON: {}"".format(e)])
if not isinstance(data, dict):
- return _errors([""JSON must be a dictionary""])
+ return _errors([{""detail"": ""JSON must be a dictionary"", ""pointer"": ""#/""}])
keys = data.keys()
# keys must contain ""row"" or ""rows""
if ""row"" not in keys and ""rows"" not in keys:
return _errors(['JSON must have one or other of ""row"" or ""rows""'])
rows = []
+ was_single_row = False
if ""row"" in keys:
if ""rows"" in keys:
- return _errors(['Cannot use ""row"" and ""rows"" at the same time'])
+ return _errors(
+ [
+ {
+ ""detail"": 'Cannot use ""row"" and ""rows"" at the same time',
+ ""pointer"": ""#/row"",
+ }
+ ]
+ )
+ was_single_row = True
row = data[""row""]
if not isinstance(row, dict):
- return _errors(['""row"" must be a dictionary'])
+ return _errors(
+ [{""detail"": '""row"" must be a dictionary', ""pointer"": ""#/row""}]
+ )
rows = [row]
data[""return""] = True
else:
@@ -1152,9 +1163,12 @@ class TableInsertView(BaseView):
invalid_columns = set(row.keys()) - columns
if invalid_columns:
errors.append(
- ""Row {} has invalid columns: {}"".format(
- i, "", "".join(sorted(invalid_columns))
- )
+ {
+ ""detail"": ""Invalid columns: {}"".format(
+ "", "".join(sorted(invalid_columns))
+ ),
+ ""pointer"": ""#/blah/"",
+ }
)
if errors:
return _errors(errors)
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1430797211,
https://github.com/simonw/datasette/issues/1882#issuecomment-1314813205,https://api.github.com/repos/simonw/datasette/issues/1882,1314813205,IC_kwDOBm6k_c5OXnUV,9599,2022-11-15T06:00:41Z,2022-11-15T06:00:41Z,OWNER,"Documentation:
- https://docs.datasette.io/en/1.0-dev/json_api.html#creating-a-table
- https://docs.datasette.io/en/1.0-dev/json_api.html#creating-a-table-from-example-data
Wrote a TIL about how I wrote some of those tests with Copilot: https://til.simonwillison.net/gpt3/writing-test-with-copilot","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1435294468,
https://github.com/simonw/datasette/issues/1886#issuecomment-1314627077,https://api.github.com/repos/simonw/datasette/issues/1886,1314627077,IC_kwDOBm6k_c5OW54F,11788561,2022-11-15T01:19:54Z,2022-11-15T01:19:54Z,NONE,"Datasette usage comments for its 5th anniversary celebration:
I 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)
The 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.
At 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.
I 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.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1447050738,
https://github.com/simonw/datasette/issues/1890#issuecomment-1314821337,https://api.github.com/repos/simonw/datasette/issues/1890,1314821337,IC_kwDOBm6k_c5OXpTZ,9599,2022-11-15T06:08:19Z,2022-11-15T06:08:19Z,OWNER,"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.
There's actually a native HTML element for this these days: the `