home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 496338808

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/473#issuecomment-496338808 https://api.github.com/repos/simonw/datasette/issues/473 496338808 MDEyOklzc3VlQ29tbWVudDQ5NjMzODgwOA== 9599 2019-05-28T02:07:23Z 2019-05-28T02:07:23Z OWNER

Assuming I do go ahead with this plugin hook, the existing InFilter makes for a nice simple example that illustrates the two key methods: .where_clause() and .human_clause():

```python class InFilter(Filter): key = "in" display = "in"

def split_value(self, value):
    if value.startswith("["):
        return json.loads(value)
    else:
        return [v.strip() for v in value.split(",")]

def where_clause(self, table, column, value, param_counter):
    values = self.split_value(value)
    params = [":p{}".format(param_counter + i) for i in range(len(values))]
    sql = "{} in ({})".format(escape_sqlite(column), ", ".join(params))
    return sql, values

def human_clause(self, column, value):
    return "{} in {}".format(column, json.dumps(self.split_value(value)))

```

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