home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

12 rows where issue = 440222719 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw 12

issue 1

  • _facet_array should work against views · 12 ✖

author_association 1

  • OWNER 12
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
969621662 https://github.com/simonw/datasette/issues/448#issuecomment-969621662 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45y0Ce simonw 9599 2021-11-16T01:32:04Z 2021-11-16T01:32:04Z OWNER

Tests are failing and I think it's because the facets come back in different orders, need a tie-breaker. https://github.com/simonw/datasette/runs/4219325197?check_suite_focus=true

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969582098 https://github.com/simonw/datasette/issues/448#issuecomment-969582098 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45yqYS simonw 9599 2021-11-16T01:10:28Z 2021-11-16T01:10:28Z OWNER

Also note that this demo data is using a SQL view to create the JSON arrays - the view is defined as such:

sql CREATE VIEW ads_with_targets as select ads.*, json_group_array(targets.name) as target_names from ads join ad_targets on ad_targets.ad_id = ads.id join targets on ad_targets.target_id = targets.id group by ad_targets.ad_id; So running JSON faceting on top of that view is a pretty big ask!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969578466 https://github.com/simonw/datasette/issues/448#issuecomment-969578466 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45ypfi simonw 9599 2021-11-16T01:08:29Z 2021-11-16T01:08:29Z OWNER

Actually with the cache warmed up it looks like the facet query is taking 150ms which is good enough.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969572281 https://github.com/simonw/datasette/issues/448#issuecomment-969572281 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45yn-5 simonw 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
}
_facet_array should work against views 440222719  
969557008 https://github.com/simonw/datasette/issues/448#issuecomment-969557008 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45ykQQ simonw 9599 2021-11-16T00:56:09Z 2021-11-16T00:59:59Z OWNER

This looks like it might work: sql with inner as ( select * from ads_with_targets where :p0 in ( select value from json_each([ads_with_targets].[target_names]) ) ), deduped_array_items as ( select distinct j.value, inner.* from json_each([inner].[target_names]) j join inner ) select value, count(*) from deduped_array_items group by value order by count(*) desc

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969557972 https://github.com/simonw/datasette/issues/448#issuecomment-969557972 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45ykfU simonw 9599 2021-11-16T00:56:58Z 2021-11-16T00:56:58Z OWNER

It uses a CTE which were introduced in SQLite 3.8 - and AWS Lambda Python 3.9 still provides 3.7 - but I've checked and I can use pysqlite3-binary to work around that there so I'm OK relying on CTEs for this.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969449772 https://github.com/simonw/datasette/issues/448#issuecomment-969449772 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45yKEs simonw 9599 2021-11-15T23:48:37Z 2021-11-15T23:48:37Z OWNER

Given this query: https://json-view-facet-bug-demo-j7hipcg4aq-uc.a.run.app/russian-ads?sql=select%0D%0A++j.value+as+value%2C%0D%0A++count%28*%29+as+count%0D%0Afrom%0D%0A++%28%0D%0A++++select%0D%0A++++++id%2C%0D%0A++++++file%2C%0D%0A++++++clicks%2C%0D%0A++++++impressions%2C%0D%0A++++++text%2C%0D%0A++++++url%2C%0D%0A++++++spend_amount%2C%0D%0A++++++spend_currency%2C%0D%0A++++++created%2C%0D%0A++++++ended%2C%0D%0A++++++target_names%0D%0A++++from%0D%0A++++++ads_with_targets%0D%0A++++where%0D%0A++++++%3Ap0+in+%28%0D%0A++++++++select%0D%0A++++++++++value%0D%0A++++++++from%0D%0A++++++++++json_each%28%5Bads_with_targets%5D.%5Btarget_names%5D%29%0D%0A++++++%29%0D%0A++%29%0D%0A++join+json_each%28target_names%29+j%0D%0Agroup+by%0D%0A++j.value%0D%0Aorder+by%0D%0A++count+desc%2C%0D%0A++value%0D%0Alimit%0D%0A++31&p0=people_who_match%3Ainterests%3AAfrican-American+culture

sql select j.value as value, count(*) as count from ( select id, file, clicks, impressions, text, url, spend_amount, spend_currency, created, ended, target_names from ads_with_targets where :p0 in ( select value from json_each([ads_with_targets].[target_names]) ) ) join json_each(target_names) j group by j.value order by count desc, value limit 31 How can I return a count of the number of documents containing each tag, but not the number of total tags that match including duplicates?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969446972 https://github.com/simonw/datasette/issues/448#issuecomment-969446972 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45yJY8 simonw 9599 2021-11-15T23:46:13Z 2021-11-15T23:46:13Z OWNER

It looks like the problem here is that some of the tags occur more than once in the documents:

So they get counted more than once, hence the 182 count for something that couldn't possibly return more than 172 documents.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969442215 https://github.com/simonw/datasette/issues/448#issuecomment-969442215 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45yIOn simonw 9599 2021-11-15T23:42:03Z 2021-11-15T23:42:03Z OWNER

I think this code is wrong in the ArrayFacet class: https://github.com/simonw/datasette/blob/502c02fa6dde6a8bb840af6c4c8cf858aa1db687/datasette/facets.py#L357-L364

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969440918 https://github.com/simonw/datasette/issues/448#issuecomment-969440918 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45yH6W simonw 9599 2021-11-15T23:40:17Z 2021-11-15T23:40:35Z OWNER

Applied that fix to the arraycontains filter but I'm still getting bad results for the faceting:

Should never get 182 results on a page that faceting against only 172 items.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
969436930 https://github.com/simonw/datasette/issues/448#issuecomment-969436930 https://api.github.com/repos/simonw/datasette/issues/448 IC_kwDOBm6k_c45yG8C simonw 9599 2021-11-15T23:31:58Z 2021-11-15T23:31:58Z OWNER

I think this SQL recipe may work instead: sql select * from ads_with_targets where 'people_who_match:interests:African-American Civil Rights Movement (1954—68)' in ( select value from json_each(target_names) ) and 'interests:Martin Luther King III' in ( select value from json_each(target_names) ) https://json-view-facet-bug-demo-j7hipcg4aq-uc.a.run.app/russian-ads?sql=select%0D%0A++*%0D%0Afrom%0D%0A++ads_with_targets%0D%0Awhere%0D%0A++%27people_who_match%3Ainterests%3AAfrican-American+Civil+Rights+Movement+%281954%E2%80%9468%29%27+in+%28%0D%0A++++select%0D%0A++++++value%0D%0A++++from%0D%0A++++++json_each%28target_names%29%0D%0A++%29%0D%0A++and+%27interests%3AMartin+Luther+King+III%27+in+%28%0D%0A++++select%0D%0A++++++value%0D%0A++++from%0D%0A++++++json_each%28target_names%29%0D%0A++%29&interests=&African=&Martin=

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  
489240609 https://github.com/simonw/datasette/issues/448#issuecomment-489240609 https://api.github.com/repos/simonw/datasette/issues/448 MDEyOklzc3VlQ29tbWVudDQ4OTI0MDYwOQ== simonw 9599 2019-05-03T21:09:13Z 2019-05-03T21:09:13Z OWNER

It may be that some facet implementations (ArrayFacet in this case) need a way to detect if they are supported by the thing they are running against (must be a rowid table in this case) and avoid suggesting themselves if they are not compatible. This may require a change to the information we make available to the suggest() method (information passed to the Facet class constructor).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
_facet_array should work against views 440222719  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 42.543ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows