home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 492903398

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/419#issuecomment-492903398 https://api.github.com/repos/simonw/datasette/issues/419 492903398 MDEyOklzc3VlQ29tbWVudDQ5MjkwMzM5OA== 9599 2019-05-16T03:33:01Z 2019-05-16T03:33:01Z OWNER

@russss sorry I only just spotted your comment here.

I think I have an alternative suggestion for what you need to do here. It sounds to me like you need to calculate a specific piece of information against a specific database. Instead of doing this in inspect, how about having a separate tool which runs this once against the database file and writes the result into a database file there?

I've been thinking about this pattern a bit as part of the sqlite-utils work I've been doing. It's already something that's needed for SQLite FTS support - it's no good just creating a FTS index, you have to populate it as well. In sqlite-utils world you do that like this: https://sqlite-utils.readthedocs.io/en/latest/cli.html#configuring-full-text-search

$ sqlite-utils enable-fts mydb.db documents title summary

But then later if you've inserted new records you have to call this:

$ sqlite-utils populate-fts mydb.db documents title summary

So one option here could be for datasette-geo to know to look for a special datasette_geo_bounding_box database table and, if it's missing, to calculate at runtime (probably once on startup and then cache it).

Another option: Datasette now has an option to open a database file in "immutable" mode, using datasette -i mydatabase.db. When you do that we calculate counts on startup - and we'll also be able to load counts from the inspect-data.json file (that's pretty much all that will be in there). I'm open to making this available as a plugin hook - all kinds of optimizations could be run against these -i databases. It would essentially be what we have with inspect today but just for databases opened in that specific mode.

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