home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 322787470

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association pull_request body repo type active_lock_reason performed_via_github_app reactions draft state_reason
322787470 MDU6SXNzdWUzMjI3ODc0NzA= 259 inspect() should detect many-to-many relationships 9599 closed 0     6 2018-05-14T12:03:58Z 2019-05-23T03:55:37Z 2019-05-23T03:55:37Z OWNER  

Relates to #255 - in particular supporting facets across M2M relationships.

It should be possible for .inspect() to notice when a table has two foreign keys to two different tables, and assume that this means there is a M2M relationship between those tables.

When rendering a table with a m2m relationship we could display the first X associated records as a comma separated list of hyperlinks in a new column on the table view, with a column name derived from the table on the other side.

Since SQLite doesn't have RANK or an equivalent of https://www.xaprb.com/blog/2006/12/02/how-to-number-rows-in-mysql/ this would be implemented as N+1 queries (one query per cell that we want to display an m2m summary). This should be OK in SQLite: https://sqlite.org/np1queryprob.html

107914493 issue    
{
    "url": "https://api.github.com/repos/simonw/datasette/issues/259/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed

Links from other tables

  • 1 row from issues_id in issues_labels
  • 6 rows from issue in issue_comments
Powered by Datasette · Queries took 3.104ms · About: github-to-sqlite