home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where author_association = "OWNER" and issue = 1876353656 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 6

issue 1

  • Consider a request/response wrapping hook slightly higher level than asgi_wrapper() · 6 ✖

author_association 1

  • OWNER · 6 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1712897194 https://github.com/simonw/datasette/issues/2168#issuecomment-1712897194 https://api.github.com/repos/simonw/datasette/issues/2168 IC_kwDOBm6k_c5mGLyq simonw 9599 2023-09-10T17:54:07Z 2023-09-10T17:54:07Z OWNER

This looks relevant:

https://pluggy.readthedocs.io/en/stable/#wrappers

A hookimpl can be marked with the "wrapper" option, which indicates that the function will be called to wrap (or surround) all other normal hookimpl calls. A hook wrapper can thus execute some code ahead and after the execution of all corresponding non-wrappper hookimpls.

This could be the perfect mechanism for implementing this hook, although I still need to figure out how it interacts with streaming.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consider a request/response wrapping hook slightly higher level than asgi_wrapper() 1876353656  
1701831013 https://github.com/simonw/datasette/issues/2168#issuecomment-1701831013 https://api.github.com/repos/simonw/datasette/issues/2168 IC_kwDOBm6k_c5lb-Fl simonw 9599 2023-08-31T21:51:12Z 2023-08-31T21:52:15Z OWNER

Need to make sure the design of this takes streaming responses into account. Those could be pretty tricky here.

I nice thing about asgi_wrapper() is that it handles those already.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consider a request/response wrapping hook slightly higher level than asgi_wrapper() 1876353656  
1701830241 https://github.com/simonw/datasette/issues/2168#issuecomment-1701830241 https://api.github.com/repos/simonw/datasette/issues/2168 IC_kwDOBm6k_c5lb95h simonw 9599 2023-08-31T21:50:18Z 2023-08-31T21:50:18Z OWNER

The hook could be called register_middleware() and could work like register_routes() and register_commands():

```python @hookspec def register_middleware(datasette): """Register middleware: returns a list of async def middleware functions"""

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consider a request/response wrapping hook slightly higher level than asgi_wrapper() 1876353656  
1701828197 https://github.com/simonw/datasette/issues/2168#issuecomment-1701828197 https://api.github.com/repos/simonw/datasette/issues/2168 IC_kwDOBm6k_c5lb9Zl simonw 9599 2023-08-31T21:48:00Z 2023-08-31T21:48:57Z OWNER

A pattern like this could be interesting: python async def my_middleware(datasette, request, get_response): # Mess with request here if neccessary response = await get_response(request) # mess with response return response The Django pattern is more complicated but does have that mechanism for running one-time configuration prior to defining the middleware() function, which is neat.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consider a request/response wrapping hook slightly higher level than asgi_wrapper() 1876353656  
1701826521 https://github.com/simonw/datasette/issues/2168#issuecomment-1701826521 https://api.github.com/repos/simonw/datasette/issues/2168 IC_kwDOBm6k_c5lb8_Z simonw 9599 2023-08-31T21:46:13Z 2023-08-31T21:46:13Z OWNER

This could even be a pair of hooks - process_request() and process_response().

Or could take a leaf from Django, which redesigned middleware to use this pattern instead:

python def simple_middleware(get_response): # One-time configuration and initialization. def middleware(request): # Code to be executed for each request before # the view (and later middleware) are called. response = get_response(request) # Code to be executed for each request/response after # the view is called. return response return middleware Or even borrow an idea from pytest where fixtures can yield in the middle, like this: python @pytest.fixture def sending_user(mail_admin): user = mail_admin.create_user() yield user mail_admin.delete_user(user)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consider a request/response wrapping hook slightly higher level than asgi_wrapper() 1876353656  
1701823609 https://github.com/simonw/datasette/issues/2168#issuecomment-1701823609 https://api.github.com/repos/simonw/datasette/issues/2168 IC_kwDOBm6k_c5lb8R5 simonw 9599 2023-08-31T21:43:06Z 2023-08-31T21:44:13Z OWNER

Not sure what to call this. Maybe app_wrapper()?

Or perhaps it's simpler than that, something like this:

python @hookspec def process_response(datasette, request, response): """Last chance to modify the response before it is returned to the client"""

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Consider a request/response wrapping hook slightly higher level than asgi_wrapper() 1876353656  

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