home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where issue = 346027040 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

  • Table view should support filtering via many-to-many relationships · 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
495079705 https://github.com/simonw/datasette/issues/355#issuecomment-495079705 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA3OTcwNQ== simonw 9599 2019-05-23T06:03:40Z 2019-05-23T06:04:03Z OWNER

I think an approach similar to how ?_where= works would do the job here.

Can address this feedback from @psychemedia while I'm at it: https://github.com/simonw/datasette/issues/429#issuecomment-483202658

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495079393 https://github.com/simonw/datasette/issues/355#issuecomment-495079393 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA3OTM5Mw== simonw 9599 2019-05-23T06:02:11Z 2019-05-23T06:02:11Z OWNER

I'm re-opening because we need a UI mechanism for deselecting this:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495077528 https://github.com/simonw/datasette/issues/355#issuecomment-495077528 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA3NzUyOA== simonw 9599 2019-05-23T05:53:20Z 2019-05-23T05:53:20Z OWNER

Demo: https://latest.datasette.io/fixtures/roadside_attractions?_through={%22table%22:%22roadside_attraction_characteristics%22,%22column%22:%22characteristic_id%22,%22value%22:%221%22}

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495077443 https://github.com/simonw/datasette/issues/355#issuecomment-495077443 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA3NzQ0Mw== simonw 9599 2019-05-23T05:52:52Z 2019-05-23T05:52:52Z OWNER

Documentation here: https://datasette.readthedocs.io/en/latest/json_api.html#special-table-arguments

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495061686 https://github.com/simonw/datasette/issues/355#issuecomment-495061686 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA2MTY4Ng== simonw 9599 2019-05-23T04:21:00Z 2019-05-23T04:21:00Z OWNER

Filtering through one table already works - you need to know that table's primary key, then you do ?column_id=pk against the first table.

Filtering through a m2m table will be handled by the new ?_through= parameter.

I'm going to leave out filtering through a second levels of joins for the moment. Potentially that could be added later as some extra complicated JSON.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495059236 https://github.com/simonw/datasette/issues/355#issuecomment-495059236 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA1OTIzNg== simonw 9599 2019-05-23T04:03:04Z 2019-05-23T04:03:04Z OWNER

This assumes that our current table has a single, unambiguous foreign key relationship with the table indicated by the ?through= parameter.

I think that's reasonable. The JSON format could be extended to allow that side of the relationship to optionally be defined there (if the foreign key relationship is missing).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495058964 https://github.com/simonw/datasette/issues/355#issuecomment-495058964 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA1ODk2NA== simonw 9599 2019-05-23T04:01:17Z 2019-05-23T04:01:17Z OWNER

I think I like this better. I don't think ?_m2m= is the correct name for it though.

?_through={"table":"ad_targets","column":"target_id","value":"ec3ac"} feels a little more accurate.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495058828 https://github.com/simonw/datasette/issues/355#issuecomment-495058828 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA1ODgyOA== simonw 9599 2019-05-23T04:00:27Z 2019-05-23T04:00:27Z OWNER

The alternative would be to use JSON:

?_m2m={"table":"ad_targets","column":"target_id","value":"ec3ac"}

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
495058622 https://github.com/simonw/datasette/issues/355#issuecomment-495058622 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQ5NTA1ODYyMg== simonw 9599 2019-05-23T03:58:58Z 2019-05-23T03:58:58Z OWNER

So the design I have so far is:

?_m2m_linktablename__linktablecolumn=value

I'm concerned that this doesn't take tables or columns with __ in their name into account. Does that matter? Could I support this without them?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  
409087871 https://github.com/simonw/datasette/issues/355#issuecomment-409087871 https://api.github.com/repos/simonw/datasette/issues/355 MDEyOklzc3VlQ29tbWVudDQwOTA4Nzg3MQ== simonw 9599 2018-07-31T04:06:22Z 2018-07-31T04:06:22Z OWNER

I started playing with this in the m2m branch - work so far: https://github.com/simonw/datasette/compare/295d005ca48747faf046ed30c3c61e7563c61ed2...af4ce463e7518f9d7828b846efd5b528a1905eca

Here's a demo: https://datasette-m2m-work-in-progress.now.sh/russian-ads-e8e09e2/ads?_m2m_ad_targets__target_id=ec3ac&_m2m_ad_targets__target_id=e128e

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Table view should support filtering via many-to-many relationships 346027040  

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