home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 1430797211, "updated_at" is on date 2022-11-15 and user = 9599 sorted by updated_at descending

✖
✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw · 2 ✖

issue 1

  • Figure out design for JSON errors (consider RFC 7807) · 2 ✖

author_association 1

  • OWNER 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1314620086 https://github.com/simonw/datasette/issues/1875#issuecomment-1314620086 https://api.github.com/repos/simonw/datasette/issues/1875 IC_kwDOBm6k_c5OW4K2 simonw 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
}
Figure out design for JSON errors (consider RFC 7807) 1430797211  
1314615592 https://github.com/simonw/datasette/issues/1875#issuecomment-1314615592 https://api.github.com/repos/simonw/datasette/issues/1875 IC_kwDOBm6k_c5OW3Eo simonw 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
}
Figure out design for JSON errors (consider RFC 7807) 1430797211  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 479.244ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows