home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 996240802

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/1518#issuecomment-996240802 https://api.github.com/repos/simonw/datasette/issues/1518 996240802 IC_kwDOBm6k_c47YW2i 9599 2021-12-16T22:25:00Z 2021-12-16T22:36:04Z OWNER

I think that plugin hook would get given the request object (and datasette and the name of the database and table) and returns a list of SQL fragments, a dictionary of lookup arguments and a list of human-description fragments - or an awaitable.

filters_from_request(request, database, table, datasette) perhaps? (Similar in name to actor_from_request).

python @hookspec def filters_from_request(request, database, table, datasette): """Return (where_clauses, params_dict, human_descriptions) based on the request"""

Turns out that's pretty much exactly what I implemented in 5116c4ec8aed5091e1f75415424b80f613518dc6 for #473:

```python

@hookspec def table_filter(): "Custom filtering of the current table based on the request" python TableFilter = namedtuple("TableFilter", ( "human_description_extras", "where_clauses", "params") ) python # filter_arguments plugin hook support for awaitable_fn in pm.hook.table_filter(): extras = await awaitable_fn( view=self, name=name, table=table, request=request ) human_description_extras.extend(extras.human_description_extras) where_clauses.extend(extras.where_clauses) params.update(extras.params) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1058072543  
Powered by Datasette · Queries took 1.577ms · About: github-to-sqlite