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/429#issuecomment-482628978,https://api.github.com/repos/simonw/datasette/issues/429,482628978,MDEyOklzc3VlQ29tbWVudDQ4MjYyODk3OA==,9599,2019-04-12T16:00:04Z,2019-04-12T16:00:04Z,OWNER,I originally thought of this as a plugin but then realized that it's 100% compatible with Datasette's existing arbitrary SQL clauses and would make some of my other projects (especially involving custom queries that still need faceting) a whole lot easier.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",432636432,
https://github.com/simonw/datasette/issues/429#issuecomment-482638695,https://api.github.com/repos/simonw/datasette/issues/429,482638695,MDEyOklzc3VlQ29tbWVudDQ4MjYzODY5NQ==,9599,2019-04-12T16:29:25Z,2019-04-13T01:14:17Z,OWNER,"Getting a prototype working was hardly any code at all:
http://127.0.0.1:8001/fixtures/facetable?_where=city_id+in+(select+id+from+facet_cities+where+name+like+%22%25an%25%22)
```
diff --git a/datasette/views/table.py b/datasette/views/table.py
index b7c9a4b..7ca9572 100644
--- a/datasette/views/table.py
+++ b/datasette/views/table.py
@@ -295,6 +295,10 @@ class TableView(RowTableShared):
filters = Filters(sorted(other_args.items()), units, ureg)
where_clauses, params = filters.build_where_clauses(table)
+ # Add _where= from querystring
+ if self.ds.config(""allow_sql"") and ""_where"" in request.args:
+ where_clauses.extend(request.args[""_where""])
+
# _search support:
fts_table = special_args.get(""_fts_table"")
fts_table = fts_table or table_metadata.get(""fts_table"")
```
Still needed:
- [x] Unit tests
- [x] Probably some kind of visual display on the table page so you know that extra clauses have been added (and maybe a UI for dropping them again)
I'm going to leave the `:named` parameter support out of the first version of this feature.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",432636432,
https://github.com/simonw/datasette/issues/429#issuecomment-482640079,https://api.github.com/repos/simonw/datasette/issues/429,482640079,MDEyOklzc3VlQ29tbWVudDQ4MjY0MDA3OQ==,9599,2019-04-12T16:34:01Z,2019-04-12T16:34:01Z,OWNER,"UI concept:
```
city_id in (select id from facet_cities where name like ""%an%"")
[remove]