home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 810397025 and user = 9599 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 · 4 ✖

issue 1

  • 500 error caused by faceting if a column called `n` exists · 4 ✖

author_association 1

  • OWNER 4
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1072915936 https://github.com/simonw/datasette/issues/1228#issuecomment-1072915936 https://api.github.com/repos/simonw/datasette/issues/1228 IC_kwDOBm6k_c4_82Xg simonw 9599 2022-03-19T01:50:27Z 2022-03-19T01:50:27Z OWNER

Demo: https://latest.datasette.io/fixtures/facetable - which now has a column called n.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
500 error caused by faceting if a column called `n` exists 810397025  
1072908029 https://github.com/simonw/datasette/issues/1228#issuecomment-1072908029 https://api.github.com/repos/simonw/datasette/issues/1228 IC_kwDOBm6k_c4_80b9 simonw 9599 2022-03-19T00:57:54Z 2022-03-19T00:57:54Z OWNER

Yes! That's the problem. I was able to replicate it like so: echo '[{ "n": "one", "abc": 1 }, { "n": "one", "abc": 2 }, { "n": "two", "abc": 3 }]' | sqlite-utils insert column-called-n.db t -

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
500 error caused by faceting if a column called `n` exists 810397025  
1072907680 https://github.com/simonw/datasette/issues/1228#issuecomment-1072907680 https://api.github.com/repos/simonw/datasette/issues/1228 IC_kwDOBm6k_c4_80Wg simonw 9599 2022-03-19T00:55:48Z 2022-03-19T00:55:48Z OWNER

... unless your data had a column called n?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
500 error caused by faceting if a column called `n` exists 810397025  
1072907610 https://github.com/simonw/datasette/issues/1228#issuecomment-1072907610 https://api.github.com/repos/simonw/datasette/issues/1228 IC_kwDOBm6k_c4_80Va simonw 9599 2022-03-19T00:55:29Z 2022-03-19T00:55:29Z OWNER

It looks to me like something is causing the faceting query here to return a string when it was expected to return a number:

https://github.com/simonw/datasette/blob/32963018e7edfab1233de7c7076c428d0e5c7813/datasette/facets.py#L153-L170

I can't think of any way that a count(*) as n would turn into a string though!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
500 error caused by faceting if a column called `n` exists 810397025  

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