home / github / issue_comments

Menu
  • GraphQL API

issue_comments: 969572281

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/448#issuecomment-969572281 https://api.github.com/repos/simonw/datasette/issues/448 969572281 IC_kwDOBm6k_c45yn-5 9599 2021-11-16T01:05:11Z 2021-11-16T01:05:11Z OWNER I tried this and it seems to work correctly: ```python for source_and_config in self.get_configs(): config = source_and_config["config"] source = source_and_config["source"] column = config.get("column") or config["simple"] facet_sql = """ with inner as ({sql}), deduped_array_items as ( select distinct j.value, inner.* from json_each([inner].{col}) j join inner ) select value as value, count(*) as count from deduped_array_items group by value order by count(*) desc limit {limit} """.format( col=escape_sqlite(column), sql=self.sql, limit=facet_size + 1 ) ``` The queries are _very_ slow though - I had to bump up to 2s time limit even against only a view returning 3,499 rows. {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} 440222719  
Powered by Datasette · Queries took 1.697ms