home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

23 rows where author_association = "OWNER", "created_at" is on date 2020-09-24 and user = 9599 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

issue 12

  • Much, much faster extract() implementation 7
  • Progress bar for sqlite-utils insert 3
  • Add docs for .transform(column_order=) 3
  • sqlite-utils transform column order option 2
  • Datasette serve should accept paths/URLs to CSVs and other file formats 1
  • Ability to remove a foreign key 1
  • extracts= doesn't configure foreign keys 1
  • request an "-o" option on "datasette server" to open the default browser at the running url 1
  • Improve performance of extract operations 1
  • static assets and favicon aren't cached by the browser 1
  • Idea: -o could open to a more convenient location 1
  • Simplify .transform(drop_foreign_keys=) and sqlite-transform --drop-foreign-key 1

user 1

  • simonw · 23 ✖

author_association 1

  • OWNER · 23 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
698626768 https://github.com/simonw/sqlite-utils/issues/138#issuecomment-698626768 https://api.github.com/repos/simonw/sqlite-utils/issues/138 MDEyOklzc3VlQ29tbWVudDY5ODYyNjc2OA== simonw 9599 2020-09-24T22:46:56Z 2020-09-24T22:46:56Z OWNER

Yeah this works fine, added a new confirmatory test.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
extracts= doesn't configure foreign keys 684118950  
698578959 https://github.com/simonw/sqlite-utils/issues/173#issuecomment-698578959 https://api.github.com/repos/simonw/sqlite-utils/issues/173 MDEyOklzc3VlQ29tbWVudDY5ODU3ODk1OQ== simonw 9599 2020-09-24T20:44:35Z 2020-09-24T20:50:19Z OWNER

I'm using a click.File() at the moment: https://github.com/simonw/sqlite-utils/blob/5a63b9e88c5887432eb1d7df39f304ea55038437/sqlite_utils/cli.py#L496

I'll need to change that to be something that I can easily measure progress through. Also I should change its name - json_file is a bad name when it sometimes handles csv or tsv instead.

It looks like the argument provided by click.File doesn't provide a way to read the size of the file, so I need to switch that out for a file path instead. https://click.palletsprojects.com/en/7.x/api/#click.Path

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Progress bar for sqlite-utils insert 707478649  
698579389 https://github.com/simonw/sqlite-utils/issues/173#issuecomment-698579389 https://api.github.com/repos/simonw/sqlite-utils/issues/173 MDEyOklzc3VlQ29tbWVudDY5ODU3OTM4OQ== simonw 9599 2020-09-24T20:45:29Z 2020-09-24T20:45:29Z OWNER

Relevant code: https://github.com/simonw/sqlite-utils/blob/5a63b9e88c5887432eb1d7df39f304ea55038437/sqlite_utils/cli.py#L550-L560

Changing that to track progress through NL-JSON, CSV and TSV shouldn't be too hard.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Progress bar for sqlite-utils insert 707478649  
698577508 https://github.com/simonw/sqlite-utils/issues/173#issuecomment-698577508 https://api.github.com/repos/simonw/sqlite-utils/issues/173 MDEyOklzc3VlQ29tbWVudDY5ODU3NzUwOA== simonw 9599 2020-09-24T20:41:18Z 2020-09-24T20:41:18Z OWNER

I know how to build this for CSV and TSV - I can read them via a file wrapper that counts how many bytes it has seen.

Not sure how to do it for JSON though. Maybe I could provide it just for newline-delimited JSON? Again I can measure progress based on how many bytes have been read.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Progress bar for sqlite-utils insert 707478649  
698575545 https://github.com/simonw/sqlite-utils/issues/119#issuecomment-698575545 https://api.github.com/repos/simonw/sqlite-utils/issues/119 MDEyOklzc3VlQ29tbWVudDY5ODU3NTU0NQ== simonw 9599 2020-09-24T20:36:59Z 2020-09-24T20:36:59Z OWNER

This was implemented in #161.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Ability to remove a foreign key 652700770  
698572493 https://github.com/simonw/sqlite-utils/issues/176#issuecomment-698572493 https://api.github.com/repos/simonw/sqlite-utils/issues/176 MDEyOklzc3VlQ29tbWVudDY5ODU3MjQ5Mw== simonw 9599 2020-09-24T20:30:18Z 2020-09-24T20:30:18Z OWNER

Documentation: https://sqlite-utils.readthedocs.io/en/stable/cli.html#transforming-tables

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
sqlite-utils transform column order option 708293114  
698572264 https://github.com/simonw/sqlite-utils/issues/175#issuecomment-698572264 https://api.github.com/repos/simonw/sqlite-utils/issues/175 MDEyOklzc3VlQ29tbWVudDY5ODU3MjI2NA== simonw 9599 2020-09-24T20:29:48Z 2020-09-24T20:29:48Z OWNER

Documentation: https://sqlite-utils.readthedocs.io/en/stable/python-api.html#transforming-a-table

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Add docs for .transform(column_order=) 708261775  
698488971 https://github.com/simonw/datasette/issues/976#issuecomment-698488971 https://api.github.com/repos/simonw/datasette/issues/976 MDEyOklzc3VlQ29tbWVudDY5ODQ4ODk3MQ== simonw 9599 2020-09-24T17:42:09Z 2020-09-24T17:42:35Z OWNER

This is complex enough new logic that it will need test coverage - specifically covering tables or databases with strange names.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Idea: -o could open to a more convenient location 708289783  
698444567 https://github.com/simonw/sqlite-utils/issues/177#issuecomment-698444567 https://api.github.com/repos/simonw/sqlite-utils/issues/177 MDEyOklzc3VlQ29tbWVudDY5ODQ0NDU2Nw== simonw 9599 2020-09-24T16:14:47Z 2020-09-24T16:14:47Z OWNER

This is a backwards incompatible change, so technically I should bump the major version to 3. I'm not going to do that, because the feature is brand new and the chance that anyone has written code or shell scripts that use it is vanishingly small.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Simplify .transform(drop_foreign_keys=) and sqlite-transform --drop-foreign-key 708301810  
698438043 https://github.com/simonw/sqlite-utils/issues/176#issuecomment-698438043 https://api.github.com/repos/simonw/sqlite-utils/issues/176 MDEyOklzc3VlQ29tbWVudDY5ODQzODA0Mw== simonw 9599 2020-09-24T16:02:55Z 2020-09-24T16:02:55Z OWNER

I think I'll call this option --column-order with a shortcut of -o.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
sqlite-utils transform column order option 708293114  
698434811 https://github.com/simonw/sqlite-utils/issues/175#issuecomment-698434811 https://api.github.com/repos/simonw/sqlite-utils/issues/175 MDEyOklzc3VlQ29tbWVudDY5ODQzNDgxMQ== simonw 9599 2020-09-24T15:57:17Z 2020-09-24T15:57:17Z OWNER

Landed that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Add docs for .transform(column_order=) 708261775  
698434236 https://github.com/simonw/datasette/issues/970#issuecomment-698434236 https://api.github.com/repos/simonw/datasette/issues/970 MDEyOklzc3VlQ29tbWVudDY5ODQzNDIzNg== simonw 9599 2020-09-24T15:56:18Z 2020-09-24T15:56:50Z OWNER

Idea: if a database only has a single table, this could open straight to /db/table. If it has multiple tables but a single database it could open straight to /db.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
request an "-o" option on "datasette server" to open the default browser at the running url 705108492  
698412692 https://github.com/simonw/sqlite-utils/issues/175#issuecomment-698412692 https://api.github.com/repos/simonw/sqlite-utils/issues/175 MDEyOklzc3VlQ29tbWVudDY5ODQxMjY5Mg== simonw 9599 2020-09-24T15:19:28Z 2020-09-24T15:19:28Z OWNER

Need to land #174 first.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Add docs for .transform(column_order=) 708261775  
698400790 https://github.com/simonw/sqlite-utils/pull/174#issuecomment-698400790 https://api.github.com/repos/simonw/sqlite-utils/issues/174 MDEyOklzc3VlQ29tbWVudDY5ODQwMDc5MA== simonw 9599 2020-09-24T14:59:50Z 2020-09-24T14:59:50Z OWNER

For reusing the lookup table: I'm going to raise an error if a lookup table exists but without the correct columns. The caller can then add those columns and try again.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Much, much faster extract() implementation 707944044  
698184166 https://github.com/simonw/sqlite-utils/pull/174#issuecomment-698184166 https://api.github.com/repos/simonw/sqlite-utils/issues/174 MDEyOklzc3VlQ29tbWVudDY5ODE4NDE2Ng== simonw 9599 2020-09-24T08:01:07Z 2020-09-24T08:01:07Z OWNER

I may revert the now unnecessary undocumented tweaks to the .update() method made in 66d506587eba9f0715267d6560b97c1fa44cc781 as well.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Much, much faster extract() implementation 707944044  
698182656 https://github.com/simonw/sqlite-utils/pull/174#issuecomment-698182656 https://api.github.com/repos/simonw/sqlite-utils/issues/174 MDEyOklzc3VlQ29tbWVudDY5ODE4MjY1Ng== simonw 9599 2020-09-24T07:58:08Z 2020-09-24T07:58:08Z OWNER

The way the lookup table works here differs from the previous implementation. In the previous implementation the usage of .lookup() meant that an existing table would be modified to fit the new purpose. That no longer happens in this version. Need to make a design decision about how this should work.

It should definitely be possible to use an existing lookup table - imagine a database where several tables have a "Departments" column and we want to extract all of those values out to a single shared "Departments" table.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Much, much faster extract() implementation 707944044  
698182037 https://github.com/simonw/sqlite-utils/pull/174#issuecomment-698182037 https://api.github.com/repos/simonw/sqlite-utils/issues/174 MDEyOklzc3VlQ29tbWVudDY5ODE4MjAzNw== simonw 9599 2020-09-24T07:56:50Z 2020-09-24T07:56:50Z OWNER

I could also be a bit smarter about transaction handling. I think it may be possible to run this entire operation in a single transaction now.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Much, much faster extract() implementation 707944044  
698181478 https://github.com/simonw/sqlite-utils/pull/174#issuecomment-698181478 https://api.github.com/repos/simonw/sqlite-utils/issues/174 MDEyOklzc3VlQ29tbWVudDY5ODE4MTQ3OA== simonw 9599 2020-09-24T07:55:45Z 2020-09-24T07:55:45Z OWNER

import functools is no longer needed.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Much, much faster extract() implementation 707944044  
698180705 https://github.com/simonw/sqlite-utils/pull/174#issuecomment-698180705 https://api.github.com/repos/simonw/sqlite-utils/issues/174 MDEyOklzc3VlQ29tbWVudDY5ODE4MDcwNQ== simonw 9599 2020-09-24T07:54:10Z 2020-09-24T07:54:10Z OWNER

After running through the steps in https://simonwillison.net/2020/Sep/23/sqlite-utils-extract/ I get a table that looks like this:

The foreign key columns are all at the end of the table. It would be nicer if they were arranged in the same order as the columns they replaced.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Much, much faster extract() implementation 707944044  
698180113 https://github.com/simonw/sqlite-utils/pull/174#issuecomment-698180113 https://api.github.com/repos/simonw/sqlite-utils/issues/174 MDEyOklzc3VlQ29tbWVudDY5ODE4MDExMw== simonw 9599 2020-09-24T07:53:03Z 2020-09-24T07:53:03Z OWNER

This could do with a little bit more testing - I'm worried there may be column or table name edge cases that are not covered yet. I also need to remove the progress bar code since that no longer makes sense for this implementation.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Much, much faster extract() implementation 707944044  
698178101 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-698178101 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5ODE3ODEwMQ== simonw 9599 2020-09-24T07:48:57Z 2020-09-24T07:49:20Z OWNER

I wonder if I could make this faster by separating it out into a few steps:

* Create the new lookup table with all of the distinct rows

* Add the blank foreign key column

* run a `UPDATE table SET blah_id = (select id from lookup where thang = table.thang)`

* Drop the value columns

My prototype of this knocked the time down from 10 minutes to 4 seconds, so I think the change is worth it! ``` % date sqlite-utils extract salaries.db salaries \ 'Department Code' 'Department' \ --table 'departments' \ --fk-column 'department_id' \ --rename 'Department Code' code \ --rename 'Department' name date sqlite-utils extract salaries.db salaries \ 'Union Code' 'Union' \ --table 'unions' \ --fk-column 'union_id' \ --rename 'Union Code' code \ --rename 'Union' name date sqlite-utils extract salaries.db salaries \ 'Job Family Code' 'Job Family' \ --table 'job_families' \ --fk-column 'job_family_id' \ --rename 'Job Family Code' code \ --rename 'Job Family' name date sqlite-utils extract salaries.db salaries \ 'Job Code' 'Job' \ --table 'jobs' \ --fk-column 'job_id' \ --rename 'Job Code' code \ --rename 'Job' name date Thu Sep 24 00:48:16 PDT 2020

Thu Sep 24 00:48:20 PDT 2020

Thu Sep 24 00:48:24 PDT 2020

Thu Sep 24 00:48:28 PDT 2020

Thu Sep 24 00:48:32 PDT 2020 ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Improve performance of extract operations 707427200  
698168648 https://github.com/simonw/datasette/issues/123#issuecomment-698168648 https://api.github.com/repos/simonw/datasette/issues/123 MDEyOklzc3VlQ29tbWVudDY5ODE2ODY0OA== simonw 9599 2020-09-24T07:28:38Z 2020-09-24T07:28:38Z OWNER

@obra there's a plugin for that! https://github.com/simonw/datasette-upload-csvs

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Datasette serve should accept paths/URLs to CSVs and other file formats 275125561  
698110492 https://github.com/simonw/datasette/issues/974#issuecomment-698110492 https://api.github.com/repos/simonw/datasette/issues/974 MDEyOklzc3VlQ29tbWVudDY5ODExMDQ5Mg== simonw 9599 2020-09-24T04:50:56Z 2020-09-24T04:51:05Z OWNER

Come to think of it I've noticed that in the logs when it's running on my laptop, definitely worth fixing.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
static assets and favicon aren't cached by the browser 707849175  

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 1239.669ms · About: github-to-sqlite