home / github

Menu
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where issue = 440134714

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: user, author_association, created_at (date), updated_at (date)

id ▼ html_url issue_url node_id user created_at updated_at author_association body reactions issue performed_via_github_app
489167692 https://github.com/simonw/datasette/issues/446#issuecomment-489167692 https://api.github.com/repos/simonw/datasette/issues/446 MDEyOklzc3VlQ29tbWVudDQ4OTE2NzY5Mg== simonw 9599 2019-05-03T17:02:24Z 2019-05-03T17:02:24Z OWNER I looked at using namedtuples for this but hey have one major constraint: there isn't a clean way to convert them to dictionary-style JSON: https://bugs.python.org/issue30343 So something that uses a class which knows how to be rendered as JSON would be a better fit. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Define mechanism for plugins to return structured data 440134714  
489204605 https://github.com/simonw/datasette/issues/446#issuecomment-489204605 https://api.github.com/repos/simonw/datasette/issues/446 MDEyOklzc3VlQ29tbWVudDQ4OTIwNDYwNQ== simonw 9599 2019-05-03T18:59:51Z 2019-05-03T18:59:59Z OWNER Potential design: ```python from collections import OrderedDict class DataSpec: __slots__ = [] def __init__(self, **kwargs): if list(kwargs.keys()) != self.__slots__: raise TypeError( "{}() has required arguments {} (got {})".format( self.__class__.__name__, self.__slots__, list(kwargs.keys()) ) ) for key in self.__slots__: setattr(self, key, kwargs[key]) def __repr__(self): return "<{} {}>".format(self.__class__.__name__, dict(self.as_dict())) def as_dict(self): return OrderedDict([(key, getattr(self, key)) for key in self.__slots__]) class Output(DataSpec): __slots__ = ["body", "content_type", "status_code"] ``` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Define mechanism for plugins to return structured data 440134714  
489209255 https://github.com/simonw/datasette/issues/446#issuecomment-489209255 https://api.github.com/repos/simonw/datasette/issues/446 MDEyOklzc3VlQ29tbWVudDQ4OTIwOTI1NQ== simonw 9599 2019-05-03T19:15:23Z 2019-05-03T19:16:34Z OWNER The `register_output_renderer()` hook currently returns a dictionary with `body`, `content_type` and `status_code` keys but each of these keys are optionaly. I'm tempted to make all three required to better fit this model - @russss any objections? Alternative would be to support default values for properties of the `DataSpec` subclass - maybe: `__defaults__ = {"body": "", "content_type": "text/plain", "status_code": 200}` {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Define mechanism for plugins to return structured data 440134714  
489221481 https://github.com/simonw/datasette/issues/446#issuecomment-489221481 https://api.github.com/repos/simonw/datasette/issues/446 MDEyOklzc3VlQ29tbWVudDQ4OTIyMTQ4MQ== russss 45057 2019-05-03T19:58:31Z 2019-05-03T19:58:31Z CONTRIBUTOR In this particular case I don't think there's an issue making all those required. However, I suspect we might have to allow optional values at some point - my preferred solution to russss/datasette-geo#2 would need one. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Define mechanism for plugins to return structured data 440134714  
489222223 https://github.com/simonw/datasette/issues/446#issuecomment-489222223 https://api.github.com/repos/simonw/datasette/issues/446 MDEyOklzc3VlQ29tbWVudDQ4OTIyMjIyMw== russss 45057 2019-05-03T20:01:19Z 2019-05-03T20:01:29Z CONTRIBUTOR Also I have a slight preference against (ab)using `__slots__` to enforce fields, although I have done it myself in the past. It would be possible to do this with `__setattr__` instead, although that's an implementation detail and I'm not too fussed about it. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Define mechanism for plugins to return structured data 440134714  
498838841 https://github.com/simonw/datasette/issues/446#issuecomment-498838841 https://api.github.com/repos/simonw/datasette/issues/446 MDEyOklzc3VlQ29tbWVudDQ5ODgzODg0MQ== simonw 9599 2019-06-04T20:51:37Z 2019-06-04T20:51:37Z OWNER So the Python 3.7 way to do this would be dataclasses, but I still want to support 3.5. This excellent essay has made me think attrs might be the way to go: https://www.revsys.com/tidbits/dataclasses-and-attrs-when-and-why/ {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Define mechanism for plugins to return structured data 440134714  
702459432 https://github.com/simonw/datasette/issues/446#issuecomment-702459432 https://api.github.com/repos/simonw/datasette/issues/446 MDEyOklzc3VlQ29tbWVudDcwMjQ1OTQzMg== simonw 9599 2020-10-02T00:08:47Z 2020-10-02T00:08:47Z OWNER I've decided not to bother with this, especially having redesigned some hooks to return Datasette standard `Response` objects. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} Define mechanism for plugins to return structured data 440134714  

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 27.311ms · About: simonw/datasette-graphql