home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

9 rows where issue = 1078702875 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 2

  • simonw 7
  • davidbgk 2

author_association 2

  • OWNER 7
  • CONTRIBUTOR 2

issue 1

  • Allow to set `facets_array` in metadata (like current `facets`) · 9 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
996229007 https://github.com/simonw/datasette/issues/1552#issuecomment-996229007 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47YT-P davidbgk 3556 2021-12-16T22:04:39Z 2021-12-16T22:04:39Z CONTRIBUTOR

Wow, that was fast, thank you so much @simonw !

I'm also not convinced that this configuration syntax is right. It's a bit weird having a "facets" list that can either by column-name-strings or {"type-of-facet": "column-name"} objects. Maybe there's a better design for this?

I agree that it's not ideal, my initial naive approach was to detect if it's an array, like what is done here:

https://github.com/simonw/datasette/blob/2c07327d23d9c5cf939ada9ba4091c1b8b2ba42d/datasette/facets.py#L312-L313

But it requires an extra query to determine the type, which is a bit problematic, especially for big tables I guess.

Taking a look at #510, I wonder if a facet_delimiter should be defined for that kind of columns (that would help our team not to have an intermediary conversion step from foo|bar to ["foo","bar"] for instance).

To be consistent with the --extract-column parameter, maybe an explicit casting/delimiter would be useful: --set-column 'Foo:Array:|'.

Throwing a lot of ideas without knowing the big picture… but sometimes newcomers have superpowers :).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
996084899 https://github.com/simonw/datasette/issues/1552#issuecomment-996084899 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47Xwyj simonw 9599 2021-12-16T18:48:14Z 2021-12-16T18:48:14Z OWNER

Updated documentation: https://github.com/simonw/datasette/blob/20a2ed6bec367d2f6759be4a879364a72780b59d/docs/facets.rst#facets-in-metadatajson

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
996077053 https://github.com/simonw/datasette/issues/1552#issuecomment-996077053 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47Xu39 simonw 9599 2021-12-16T18:36:41Z 2021-12-16T18:36:41Z OWNER

... actually no, I WILL document this, because not documenting this is what got us to this point in the first place!

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 1,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
996076373 https://github.com/simonw/datasette/issues/1552#issuecomment-996076373 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47XutV simonw 9599 2021-12-16T18:35:40Z 2021-12-16T18:35:40Z OWNER

I'm going to ship your fix now, but I'm not going to add this to the documentation yet because I hope to improve the design prior to Datasette 1.0.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
996046304 https://github.com/simonw/datasette/issues/1552#issuecomment-996046304 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47XnXg simonw 9599 2021-12-16T17:53:40Z 2021-12-16T18:16:12Z OWNER

I'm also not convinced that this configuration syntax is right. It's a bit weird having a "facets" list that can either by column-name-strings or {"type-of-facet": "column-name"} objects. Maybe there's a better design for this?

Part of the problem here is that facets were designed to accept optional extra configuration - partly to support m2m facets in #495 - but I haven't actually shipped any facets that use that ability.

Facet by delimiter would be a good one to exercise that ability: - #510

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
996045776 https://github.com/simonw/datasette/issues/1552#issuecomment-996045776 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47XnPQ simonw 9599 2021-12-16T17:52:54Z 2021-12-16T17:52:54Z OWNER

I tried that fix you suggested and now this metadata.json does the right thing: json { "databases": { "fixtures": { "tables": { "facetable": { "facets": [ { "array": "tags" } ] } } } } } It does further highlight the bug in #625 though - since then if you try to add ?_facet=tags to facet by tags treating them NOT as an array your request to do so is ignored.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
996034408 https://github.com/simonw/datasette/issues/1552#issuecomment-996034408 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47Xkdo simonw 9599 2021-12-16T17:37:37Z 2021-12-16T17:37:37Z OWNER

I think you're right! I had completely forgotten that piece of code.

This just turned into a bug fix and a documentation update. Thanks for the research!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
995296725 https://github.com/simonw/datasette/issues/1552#issuecomment-995296725 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47UwXV davidbgk 3556 2021-12-15T23:29:32Z 2021-12-15T23:29:32Z CONTRIBUTOR

@simonw thank you for your fast answer and your guidance!

While digging into the code, I found an undocumented way of doing it:

yaml facets: ["Facet for a column", {"array": "Facet for an array"}]

The only remaining problem with that solution is here: https://github.com/simonw/datasette/blob/250db8192cb8aba5eb8cd301ccc2a49525bc3d24/datasette/facets.py#L33

We have:

python type, metadata_config = metadata_config.items()[0]

But it requires to cast the dict_items as a list prior to access the first element:

python type, metadata_config = list(metadata_config.items())[0]

I guess it's an unspotted bug? (I mean, independently of the facets-with-arrays issue.)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  
995034143 https://github.com/simonw/datasette/issues/1552#issuecomment-995034143 https://api.github.com/repos/simonw/datasette/issues/1552 IC_kwDOBm6k_c47TwQf simonw 9599 2021-12-15T18:02:53Z 2021-12-15T18:02:53Z OWNER

This is definitely a missing feature. The "different types of facet" stuff feels incomplete to me generally - this is one issue, but this one as well:

  • 625

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Allow to set `facets_array` in metadata (like current `facets`) 1078702875  

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