home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where author_association = "OWNER" and issue = 904071938 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 7

issue 1

  • ?_nocol= does not interact well with default facets · 7 ✖

author_association 1

  • OWNER · 7 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
851127314 https://github.com/simonw/datasette/issues/1345#issuecomment-851127314 https://api.github.com/repos/simonw/datasette/issues/1345 MDEyOklzc3VlQ29tbWVudDg1MTEyNzMxNA== simonw 9599 2021-05-31T02:40:26Z 2021-05-31T02:40:44Z OWNER

Demo: https://latest.datasette.io/fixtures/facetable?_facet=state&_nocol=state - the state column is not selected but facet by state still works:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_nocol= does not interact well with default facets 904071938  
851120306 https://github.com/simonw/datasette/issues/1345#issuecomment-851120306 https://api.github.com/repos/simonw/datasette/issues/1345 MDEyOklzc3VlQ29tbWVudDg1MTEyMDMwNg== simonw 9599 2021-05-31T02:14:36Z 2021-05-31T02:14:36Z OWNER

Yes! This was easier than I thought. I'm going with that solution - where facets are calculated against all columns, ignoring ?_col= and ?_nocol= entirely.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_nocol= does not interact well with default facets 904071938  
851117233 https://github.com/simonw/datasette/issues/1345#issuecomment-851117233 https://api.github.com/repos/simonw/datasette/issues/1345 MDEyOklzc3VlQ29tbWVudDg1MTExNzIzMw== simonw 9599 2021-05-31T02:04:35Z 2021-05-31T02:04:35Z OWNER

That long-term solution may not be too difficult. The facets are calculated against sql_no_limit which is constructed here:

https://github.com/simonw/datasette/blob/7b106e106000713bbee31b34d694b3dadbd4818c/datasette/views/table.py#L659-L665

And used here:

https://github.com/simonw/datasette/blob/7b106e106000713bbee31b34d694b3dadbd4818c/datasette/views/table.py#L706-L718

Crucially, sql_no_limit is ONLY used for faceting - nothing else uses it anywhere. So constructing it before constructing sql and taking ?_col= and ?_nocol= into account may not be a complex change.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_nocol= does not interact well with default facets 904071938  
851116105 https://github.com/simonw/datasette/issues/1345#issuecomment-851116105 https://api.github.com/repos/simonw/datasette/issues/1345 MDEyOklzc3VlQ29tbWVudDg1MTExNjEwNQ== simonw 9599 2021-05-31T02:00:44Z 2021-05-31T02:00:44Z OWNER

Maybe there's a short-term and longer-term solution for this - where the long-term solution is to use different columns in the faceting selects, while the short-term solution is to disable "Hide this column" for certain things.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_nocol= does not interact well with default facets 904071938  
851115805 https://github.com/simonw/datasette/issues/1345#issuecomment-851115805 https://api.github.com/repos/simonw/datasette/issues/1345 MDEyOklzc3VlQ29tbWVudDg1MTExNTgwNQ== simonw 9599 2021-05-31T01:59:39Z 2021-05-31T01:59:39Z OWNER

Maybe there's a concept here of the columns that are required by a selected facet? Those can then be included as data- attributes on the page, which will then impact which "Hide this column" options are available.

I can also use them to provide a better error message than "no such column: state" - I can verify that ?_nocol and ?_col have not been used to disable the required columns.

There is one other option here: I could still include the columns that are known to be needed for faceting in the faceting SQL queries, but leave them out of the query that is used to return the results! That's actually a pretty tempting (albeit more complex) option.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_nocol= does not interact well with default facets 904071938  
851114806 https://github.com/simonw/datasette/issues/1345#issuecomment-851114806 https://api.github.com/repos/simonw/datasette/issues/1345 MDEyOklzc3VlQ29tbWVudDg1MTExNDgwNg== simonw 9599 2021-05-31T01:55:56Z 2021-05-31T01:55:56Z OWNER

Two options here:

  • Don't provide users with options that will lead to this situation - so no "Hide this column" option on pages that are already faceted by that column
  • Ignore facet selections for columns which are no longer visible

I think I like the first option more.

I could partially implement that in the table.js JavaScript by looking at the ?_facet= parameters... but that won't cover the case where the facet is happening because of default facets configured in metadata.yml.

Instead the JavaScript should look for evidence in the DOM that specific facets are enabled. This could also help me cover other types of faceting, such as ?_facet_array= or even custom facets provided by plugins.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_nocol= does not interact well with default facets 904071938  
851113886 https://github.com/simonw/datasette/issues/1345#issuecomment-851113886 https://api.github.com/repos/simonw/datasette/issues/1345 MDEyOklzc3VlQ29tbWVudDg1MTExMzg4Ng== simonw 9599 2021-05-31T01:52:27Z 2021-05-31T01:52:27Z OWNER

Related issue: visit https://latest.datasette.io/fixtures/facetable?_facet=state and click "Hide this column" on the "state" cog menu and you get https://latest.datasette.io/fixtures/facetable?_facet=state&_nocol=state which shows an error:

Invalid SQL

no such column: state

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
?_nocol= does not interact well with default facets 904071938  

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