issue_comments

5 rows where user = 14834132 sorted by updated_at descending

View and edit SQL

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

user

  • SteadBytes · 5

author_association

id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue
513652597 https://github.com/simonw/datasette/issues/537#issuecomment-513652597 https://api.github.com/repos/simonw/datasette/issues/537 MDEyOklzc3VlQ29tbWVudDUxMzY1MjU5Nw== SteadBytes 14834132 2019-07-22T06:03:18Z 2019-07-22T06:03:18Z NONE

@simonw do you think it is still worth populating the endpoint key in the scope as originally intended by this issue, or should we hold off until a decision about possibly using an X-Endpoint header instead? :smile:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Populate "endpoint" key in ASGI scope 463544206
513446227 https://github.com/simonw/datasette/issues/537#issuecomment-513446227 https://api.github.com/repos/simonw/datasette/issues/537 MDEyOklzc3VlQ29tbWVudDUxMzQ0NjIyNw== SteadBytes 14834132 2019-07-20T07:50:44Z 2019-07-20T07:50:44Z NONE

Oh yes well spotted thank you 😁

I agree that the strictness would be nice as it could help to avoid different middleware altering the scope in incompatible ways. However I do also agree that it's likely for not all implementations to follow 🤔

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Populate "endpoint" key in ASGI scope 463544206
513439736 https://github.com/simonw/datasette/issues/537#issuecomment-513439736 https://api.github.com/repos/simonw/datasette/issues/537 MDEyOklzc3VlQ29tbWVudDUxMzQzOTczNg== SteadBytes 14834132 2019-07-20T06:05:01Z 2019-07-20T06:05:01Z NONE

The asgi spec doesn't explicitly specify (at least as far as I can tell) whether the scope is immutable/mutable https://asgi.readthedocs.io/en/latest/specs/lifespan.html#scope . @simonw using a header for this would be a nice approach. It would also potentially increase the portability of any middleware/plugins/clients across different applications/frameworks as it's not tied directly to an asgi implementation

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Populate "endpoint" key in ASGI scope 463544206
512930353 https://github.com/simonw/datasette/issues/537#issuecomment-512930353 https://api.github.com/repos/simonw/datasette/issues/537 MDEyOklzc3VlQ29tbWVudDUxMjkzMDM1Mw== SteadBytes 14834132 2019-07-18T18:20:53Z 2019-07-18T18:34:03Z NONE

Ok great, getting the __qualname__ to be TableView and adding endpoint to the scope in AsgiRouter is simple enough (already done). However, (unless I'm missing a plugin hook or something) the suggestion of utilising it within a datasette-sentry plugin may not work. The only hook that would have access to the scope is the asgi_wrapper hook. But as this wraps the existing asgi app, the endpoint won't yet have been added to the scope received by the hook https://github.com/SteadBytes/datasette/blob/107d47567dedd472eebec7f35bc34f5b58285ba8/datasette/app.py#L672 . However, I'm not sure where else the endpoint could be added to the asgi scope :thinking:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Populate "endpoint" key in ASGI scope 463544206
512126748 https://github.com/simonw/datasette/issues/537#issuecomment-512126748 https://api.github.com/repos/simonw/datasette/issues/537 MDEyOklzc3VlQ29tbWVudDUxMjEyNjc0OA== SteadBytes 14834132 2019-07-17T06:48:35Z 2019-07-17T06:48:35Z NONE

It looks as if the datasette.utils.AsgiRouter.__call__ is the place to add this https://github.com/simonw/datasette/blob/90d4f497f9b3f6a5882937c91fddb496ac3e7368/datasette/utils/asgi.py#L101 .

The sentry_asgi middleware uses the __qualname__ or __name__ attributes of the endpoint https://github.com/encode/sentry-asgi/blob/c6a42d44d31f85885b79e4ee898683ecf8104971/sentry_asgi/middleware.py#L84

Looking at the Starlette implementation endpoint is a Callable https://github.com/encode/starlette/commit/34d0097feb6f057bd050d5057df5a2f96b97384e#diff-34fba745b50527bfb4245d02afd59246R100 which as far as I can tell is analogous to the view function which is matched here https://github.com/simonw/datasette/blob/90d4f497f9b3f6a5882937c91fddb496ac3e7368/datasette/utils/asgi.py#L96 .

A slight issue is that __qualname__ is matched first in the sentry_asgi middleware, and __name__ is used if that doesn't exist. I think (please correct me if I am wrong) that for datasette, the __name__ is what should be used. For example, when using the development fixtures and hitting http://127.0.0.1:8001/fixtures/compound_three_primary_keys the view function that is matched gives:

>>> view.__qualname__
'AsgiView.as_asgi.<locals>.view'
>>> view.__name__
'TableView'

Would TableView be the desired value here? Or am I looking in entirely the wrong place? :smile:

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Populate "endpoint" key in ASGI scope 463544206

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])
);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Query took 29.259ms · About: github-to-sqlite