home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 753660814

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/sqlite-utils/issues/215#issuecomment-753660814 https://api.github.com/repos/simonw/sqlite-utils/issues/215 753660814 MDEyOklzc3VlQ29tbWVudDc1MzY2MDgxNA== 9599 2021-01-03T18:53:05Z 2021-01-03T18:53:05Z OWNER

Here's the current .count property: https://github.com/simonw/sqlite-utils/blob/036ec6d32313487527c66dea613a3e7118b97459/sqlite_utils/db.py#L597-L609

It's implemented on Queryable which means it's available on both Table and View - the optimization doesn't make sense for views.

I'm a bit cautious about making that property so much more complex. In order to decide if it should try the _counts table first it needs to know:

  • Should it be trusting the counts? I'm thinking a .should_trust_counts property on Database which defaults to True would be good - then advanced users can turn that off if they know the counts should not be trusted.
  • Does the _counts table exist?
  • Are the triggers defined?

Then it can do the query, and if the query fails it can fall back on the count(*). That's quite a lot of extra activity though.

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