home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where issue = 1058072543 and "updated_at" is on date 2021-11-19 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 10

issue 1

  • Complete refactor of TableView and table.html template · 10 ✖

author_association 1

  • OWNER 10
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
974300823 https://github.com/simonw/datasette/issues/1518#issuecomment-974300823 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46EqaX simonw 9599 2021-11-19T18:18:32Z 2021-11-19T18:18:32Z OWNER

This may be an argument for continuing to allow non-JSON-objects through to the HTML templates. Need to think about that a bit more.

I can definitely support this using pure-JSON - I could make two versions of the row available, one that's an array of cell objects and the other that's an object mapping column names to column raw values.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
974285803 https://github.com/simonw/datasette/issues/1518#issuecomment-974285803 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46Emvr simonw 9599 2021-11-19T17:56:48Z 2021-11-19T18:14:30Z OWNER

Very confused by this piece of code here: https://github.com/simonw/datasette/blob/1c13e1af0664a4dfb1e69714c56523279cae09e4/datasette/views/table.py#L37-L63

I added it in https://github.com/simonw/datasette/commit/754836eef043676e84626c4fd3cb993eed0d2976 - in the new world that should probably be replaced by pure JSON.

Aha - this comment explains it: https://github.com/simonw/datasette/issues/521#issuecomment-505279560

I think the trick is to redefine what a "cell_row" is. Each row is currently a list of cells:

https://github.com/simonw/datasette/blob/6341f8cbc7833022012804dea120b838ec1f6558/datasette/views/table.py#L159-L163

I can redefine the row (the cells variable in the above example) as a thing-that-iterates-cells (hence behaving like a list) but that also supports __getitem__ access for looking up cell values if you know the name of the column.

The goal was to support neater custom templates like this: ```html+jinja {% for row in display_rows %}

{{ row["First_Name"] }} {{ row["Last_Name"] }}

... ``` This may be an argument for continuing to allow non-JSON-objects through to the HTML templates. Need to think about that a bit more.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
974287570 https://github.com/simonw/datasette/issues/1518#issuecomment-974287570 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46EnLS simonw 9599 2021-11-19T17:59:33Z 2021-11-19T17:59:33Z OWNER

I'm going to try leaning into the asyncinject mechanism a bit here. One method can execute and return the raw rows. Another can turn that into the default minimal JSON representation. Then a third can take that (or take both) and use it to inflate out the JSON that the HTML template needs, with those extras and with the rendered cells from plugins.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
973700549 https://github.com/simonw/datasette/issues/1518#issuecomment-973700549 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46CX3F simonw 9599 2021-11-19T03:31:20Z 2021-11-19T03:31:26Z OWNER

... and while I'm doing all of this I can rewrite the templates to not use those cheating magical functions AND document the template context at the same time, refs: - #1510.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
973700322 https://github.com/simonw/datasette/issues/1518#issuecomment-973700322 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46CXzi simonw 9599 2021-11-19T03:30:30Z 2021-11-19T03:30:30Z OWNER

Right now the HTML version gets to cheat - it passes through objects that are not JSON serializable, including custom functions that can then be called by Jinja.

I'm interested in maybe removing this cheating - if the HTML version could only request JSON-serializable extras those could be exposed in the API as well.

It would also help cleanup the kind-of-nasty pattern I use in the current BaseView where everything returns both a bunch of JSON-serializable data AND an awaitable function that then gets to add extra things to the HTML context.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
973698917 https://github.com/simonw/datasette/issues/1518#issuecomment-973698917 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46CXdl simonw 9599 2021-11-19T03:26:18Z 2021-11-19T03:29:03Z OWNER

A (likely incomplete) list of features on the table page:

  • [ ] Display table/database/instance metadata
  • [ ] Show count of all results
  • [ ] Display table of results
  • [ ] Special table display treatment for URLs, numbers
  • [ ] Allow plugins to modify table cells
  • [ ] Respect ?_col= and ?_nocol=
  • [ ] Show interface for filtering by columns and operations
  • [ ] Show search box, support executing FTS searches
  • [ ] Sort table by specified column
  • [ ] Paginate table
  • [ ] Show facet results
  • [ ] Show suggested facets
  • [ ] Link to available exports
  • [ ] Display schema for table
  • [ ] Maybe it should show the SQL for the query too?
  • [ ] Handle various non-obvious querystring options, like ?_where= and ?_through=
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
973699424 https://github.com/simonw/datasette/issues/1518#issuecomment-973699424 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46CXlg simonw 9599 2021-11-19T03:27:49Z 2021-11-19T03:27:49Z OWNER

My goal is to break up a lot of this functionality into separate methods. These methods can be executed in parallel by asyncinject, but more importantly they can be used to build a much better JSON representation, where the default representation is lighter and ?_extra=x options can be used to execute more expensive portions and add them to the response.

So the HTML version itself needs to be re-written to use those JSON extras.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
973687978 https://github.com/simonw/datasette/issues/1518#issuecomment-973687978 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46CUyq simonw 9599 2021-11-19T03:07:47Z 2021-11-19T03:07:47Z OWNER

I was wrong about that, you CAN over-ride default routes already.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
973682389 https://github.com/simonw/datasette/issues/1518#issuecomment-973682389 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46CTbV simonw 9599 2021-11-19T02:57:39Z 2021-11-19T02:57:39Z OWNER

Ideally I'd like to execute the existing test suite against the new implementation - that would require me to solve this so I can replace the view with the plugin version though:

  • 1517

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  
973681970 https://github.com/simonw/datasette/issues/1518#issuecomment-973681970 https://api.github.com/repos/simonw/datasette/issues/1518 IC_kwDOBm6k_c46CTUy simonw 9599 2021-11-19T02:56:31Z 2021-11-19T02:56:53Z OWNER

Here's where I got to with my hacked-together initial plugin prototype - it managed to render the table page with some rows on it (and a bunch of missing functionality such as filters): https://gist.github.com/simonw/281eac9c73b062c3469607ad86470eb2

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Complete refactor of TableView and table.html template 1058072543  

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 26.51ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows