{"html_url": "https://github.com/simonw/datasette/issues/638#issuecomment-557331366", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/638", "id": 557331366, "node_id": "MDEyOklzc3VlQ29tbWVudDU1NzMzMTM2Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-11-22T00:19:40Z", "updated_at": "2019-11-22T00:19:40Z", "author_association": "OWNER", "body": "We currently use `select distinct wikipedia_url ...` to suggest facets. This query would only return rows which are represented twice or more:\r\n```sql\r\nselect\r\n wikipedia_url, count(*) as n\r\nfrom\r\n museums\r\nwhere\r\n wikipedia_url is not null\r\ngroup by wikipedia_url\r\nhaving n > 1\r\n```\r\nhttps://www.niche-museums.com/museums?sql=select%0D%0A++wikipedia_url%2C+count%28*%29+as+n%0D%0Afrom%0D%0A++museums%0D%0Awhere%0D%0A++wikipedia_url+is+not+null%0D%0Agroup+by+wikipedia_url%0D%0Ahaving+n+%3E+1", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 526913133, "label": "Don't suggest column for faceting if all values are 1"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/638#issuecomment-557333467", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/638", "id": 557333467, "node_id": "MDEyOklzc3VlQ29tbWVudDU1NzMzMzQ2Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-11-22T00:28:07Z", "updated_at": "2019-11-22T00:28:07Z", "author_association": "OWNER", "body": "It's not as simple as that - `planet_int` should be a suggested facet on https://latest.datasette.io/fixtures/facetable?_facet=planet_int because it returns two filters, even though one of those two is a value of 1. Switching to the new proposed SQL statement misses this.\r\n\r\n\"fixtures__facetable__15_rows_and_museums__select___from__select_id__name__url__address__description__wikipedia_url__photo_url__photo_alt__latitude__longitude__press__permanently_closed__hours_from_museums_order_by_id___limit_0\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 526913133, "label": "Don't suggest column for faceting if all values are 1"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/638#issuecomment-557343750", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/638", "id": 557343750, "node_id": "MDEyOklzc3VlQ29tbWVudDU1NzM0Mzc1MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-11-22T01:14:59Z", "updated_at": "2019-11-22T01:14:59Z", "author_association": "OWNER", "body": "Demo: https://latest.datasette.io/fixtures/facetable doesn't suggest `distinct_some_null` as a facet.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 526913133, "label": "Don't suggest column for faceting if all values are 1"}, "performed_via_github_app": null}