home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

12 rows where issue = 337141108 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 12

issue 1

  • Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 · 12 ✖

author_association 1

  • OWNER 12
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
407267762 https://github.com/simonw/datasette/issues/332#issuecomment-407267762 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNzI2Nzc2Mg== simonw 9599 2018-07-24T03:20:33Z 2018-07-24T03:20:33Z OWNER

Documentation: http://datasette.readthedocs.io/en/latest/json_api.html#special-json-arguments

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
407267707 https://github.com/simonw/datasette/issues/332#issuecomment-407267707 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNzI2NzcwNw== simonw 9599 2018-07-24T03:20:08Z 2018-07-24T03:20:08Z OWNER

Demo: * https://700d83d.datasette.io/fixtures-dcc1dbf/infinity.json - Infinity converted to Null * https://700d83d.datasette.io/fixtures-dcc1dbf/infinity.json?_json_infinity=on - invalid JSON containing Infinity and -Infinity

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
407262561 https://github.com/simonw/datasette/issues/332#issuecomment-407262561 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNzI2MjU2MQ== simonw 9599 2018-07-24T02:44:39Z 2018-07-24T02:44:39Z OWNER

According to https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg110573.html you can insert Infinity/-Infinity in raw SQL (as used by our fixtures) using 1e999 and -1e999.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
407262436 https://github.com/simonw/datasette/issues/332#issuecomment-407262436 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNzI2MjQzNg== simonw 9599 2018-07-24T02:43:50Z 2018-07-24T02:43:50Z OWNER

I'm going with _json_infinity=1 as the querystring argument.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
407262311 https://github.com/simonw/datasette/issues/332#issuecomment-407262311 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNzI2MjMxMQ== simonw 9599 2018-07-24T02:43:03Z 2018-07-24T02:43:03Z OWNER

Actually SQLite doesn't handle NaN at all (it treats it as null) so I'm going to change this ticket to just deal with Infinity and -Infinity.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
405968983 https://github.com/simonw/datasette/issues/332#issuecomment-405968983 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNTk2ODk4Mw== simonw 9599 2018-07-18T15:18:57Z 2018-07-18T15:18:57Z OWNER

Maybe argument should be ?_json_nan=1 since that makes it more explicitly obvious what is going on here.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
404574598 https://github.com/simonw/datasette/issues/332#issuecomment-404574598 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNDU3NDU5OA== simonw 9599 2018-07-12T16:39:51Z 2018-07-12T16:39:51Z OWNER

Since my data is all flat lists of values I don't think I need to customize the JSON encoder itself (no need to deal with nested values). I'll fix the data on its way into the encoder instead. This will also help if I decide to move to uJSON for better performance #48

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
404569003 https://github.com/simonw/datasette/issues/332#issuecomment-404569003 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNDU2OTAwMw== simonw 9599 2018-07-12T16:20:06Z 2018-07-12T16:20:06Z OWNER

And here's how django-rest-framework did it: https://github.com/encode/django-rest-framework/pull/4918/files

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
404567587 https://github.com/simonw/datasette/issues/332#issuecomment-404567587 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwNDU2NzU4Nw== simonw 9599 2018-07-12T16:15:29Z 2018-07-12T16:17:54Z OWNER

Here's how plotly handled this issue: https://github.com/plotly/plotly.py/pull/203 - see also https://github.com/plotly/plotly.py/blob/213602df6c89b45ce2b811ed2591171c961408e7/plotly/utils.py#L137

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
402243153 https://github.com/simonw/datasette/issues/332#issuecomment-402243153 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwMjI0MzE1Mw== simonw 9599 2018-07-03T17:58:50Z 2018-07-12T16:10:39Z OWNER

I think I'm going to return null in the JSON for infinity/nan values by default, but if you send _nan=1 I will instead return invalid JSON with Infinity or NaN in it (since you have opted in to getting those and hence should be able to handle them).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
401478223 https://github.com/simonw/datasette/issues/332#issuecomment-401478223 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwMTQ3ODIyMw== simonw 9599 2018-06-29T21:26:12Z 2018-06-29T21:26:19Z OWNER

I'm not sure what the correct thing to do here is. I don't want to throw a ValueError when trying to render that data as JSON, but I also want to produce JSON that doesn't break when fetched by JavaScript.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  
401477622 https://github.com/simonw/datasette/issues/332#issuecomment-401477622 https://api.github.com/repos/simonw/datasette/issues/332 MDEyOklzc3VlQ29tbWVudDQwMTQ3NzYyMg== simonw 9599 2018-06-29T21:23:17Z 2018-06-29T21:23:55Z OWNER

https://docs.python.org/3/library/json.html#json.dump

json.dump(obj, fp, , skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, *kw)¶ If allow_nan is false (default: True), then it will be a ValueError to serialize out of range float values (nan, inf, -inf) in strict compliance of the JSON specification. If allow_nan is true, their JavaScript equivalents (NaN, Infinity, -Infinity) will be used.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Sanely handle Infinity/-Infinity values in JSON using ?_json_infinity=1 337141108  

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