home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

16 rows where "updated_at" is on date 2020-09-23 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 5

  • Improve performance of extract operations 8
  • "Invalid SQL" page should let you edit the SQL 5
  • Add “updated” to metadata 1
  • Release notes for 2.20 1
  • Progress bar for sqlite-utils insert 1

user 1

  • simonw · 16 ✖

author_association 1

  • OWNER 16
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
698024773 https://github.com/simonw/datasette/issues/619#issuecomment-698024773 https://api.github.com/repos/simonw/datasette/issues/619 MDEyOklzc3VlQ29tbWVudDY5ODAyNDc3Mw== simonw 9599 2020-09-23T23:31:46Z 2020-09-23T23:31:46Z OWNER

I'm going to have to untangle Datasette's error handling a bit for this - currently the expectation is that exceptions will be handled at a higher level, but I need to rethink that to make it cleaner for views like the "execute custom SQL" view to add their own error handling (and still be able to return the correct HTTP status codes, even with custom pages).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"Invalid SQL" page should let you edit the SQL 520655983  
697998045 https://github.com/simonw/datasette/issues/619#issuecomment-697998045 https://api.github.com/repos/simonw/datasette/issues/619 MDEyOklzc3VlQ29tbWVudDY5Nzk5ODA0NQ== simonw 9599 2020-09-23T22:09:06Z 2020-09-23T22:09:06Z OWNER

I'll add this to the succesful JSON format: json { "ok": true, "error": null }

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"Invalid SQL" page should let you edit the SQL 520655983  
697995885 https://github.com/simonw/datasette/issues/619#issuecomment-697995885 https://api.github.com/repos/simonw/datasette/issues/619 MDEyOklzc3VlQ29tbWVudDY5Nzk5NTg4NQ== simonw 9599 2020-09-23T22:02:44Z 2020-09-23T22:08:28Z OWNER

So the JSON (still served with a 500 code) will look something like this: json { "ok": false, "status": 500, "database": "fixtures", "query_name": null, "rows": [], "truncated": false, "error": "Error message goes here", "columns": [], "query": { "sql": "the query that broke goes here", "params": {} }, "private": false, "allow_execute_sql": true, "query_ms": 0.8716583251953125, "source": "tests/fixtures.py", "source_url": "https://github.com/simonw/datasette/blob/master/tests/fixtures.py", "license": "Apache License 2.0", "license_url": "https://github.com/simonw/datasette/blob/master/LICENSE" }

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"Invalid SQL" page should let you edit the SQL 520655983  
697995303 https://github.com/simonw/datasette/issues/619#issuecomment-697995303 https://api.github.com/repos/simonw/datasette/issues/619 MDEyOklzc3VlQ29tbWVudDY5Nzk5NTMwMw== simonw 9599 2020-09-23T22:01:08Z 2020-09-23T22:01:08Z OWNER

This is a little tricky to solve, because of the location of the form and the need to return JSON as well as HTML. It would be weird if a JSON request came in and got back the standard output from https://latest.datasette.io/fixtures.json when they were expecting to get back JSON in the shape of https://latest.datasette.io/fixtures.json?sql=select%20*%20from%20sqlite_master

I'm going to return the HTML view that you would get for 0 results for a query - https://latest.datasette.io/fixtures?sql=select%201%20limit%200 - but with an error message.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"Invalid SQL" page should let you edit the SQL 520655983  
697980061 https://github.com/simonw/datasette/issues/619#issuecomment-697980061 https://api.github.com/repos/simonw/datasette/issues/619 MDEyOklzc3VlQ29tbWVudDY5Nzk4MDA2MQ== simonw 9599 2020-09-23T21:22:42Z 2020-09-23T21:22:42Z OWNER

Yeah that sucks. Bumping this up the priority list.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
"Invalid SQL" page should let you edit the SQL 520655983  
697869886 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697869886 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5Nzg2OTg4Ng== simonw 9599 2020-09-23T18:45:30Z 2020-09-23T18:45:30Z OWNER

There's something to be said for making this operation pausable and resumable, especially if I'm going to make it available in a Datasette plugin at some point.

{
    "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  
697866885 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697866885 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5Nzg2Njg4NQ== simonw 9599 2020-09-23T18:43:37Z 2020-09-23T18:43:37Z OWNER

Also what would happen if the table had new rows added to it while that command was running?

{
    "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  
697863116 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697863116 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5Nzg2MzExNg== simonw 9599 2020-09-23T18:41:06Z 2020-09-23T18:41:06Z OWNER

Problem with this approach is it's not compatible with progress bars - but if it's a multiple of times faster it's worth it.

{
    "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  
697859772 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697859772 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5Nzg1OTc3Mg== simonw 9599 2020-09-23T18:38:43Z 2020-09-23T18:38:52Z 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

{
    "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  
697835956 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697835956 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5NzgzNTk1Ng== simonw 9599 2020-09-23T18:22:49Z 2020-09-23T18:22:49Z OWNER

I ran sudo py-spy top -p 123 against the process while it was running and the most time is definitely spent in .update(): ``` Total Samples 1000 GIL: 0.00%, Active: 90.00%, Threads: 1

%Own %Total OwnTime TotalTime Function (filename:line)
38.00% 38.00% 3.85s 3.85s update (sqlite_utils/db.py:1283) 27.00% 27.00% 2.12s 2.12s execute (sqlite_utils/db.py:161) 10.00% 10.00% 0.890s 0.890s execute (sqlite_utils/db.py:163) 10.00% 17.00% 0.870s 1.54s columns (sqlite_utils/db.py:553) 0.00% 0.00% 0.110s 0.210s <listcomp> (sqlite_utils/db.py:554) 0.00% 3.00% 0.100s 0.320s table_names (sqlite_utils/db.py:191) 0.00% 0.00% 0.100s 0.100s new (<string>:1) ```

{
    "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  
697577646 https://github.com/simonw/sqlite-utils/issues/173#issuecomment-697577646 https://api.github.com/repos/simonw/sqlite-utils/issues/173 MDEyOklzc3VlQ29tbWVudDY5NzU3NzY0Ng== simonw 9599 2020-09-23T15:48:51Z 2020-09-23T15:48:51Z OWNER

This can only work when it's reading from a file, not when it's reading from standard input.

{
    "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  
697545290 https://github.com/simonw/datasette/issues/111#issuecomment-697545290 https://api.github.com/repos/simonw/datasette/issues/111 MDEyOklzc3VlQ29tbWVudDY5NzU0NTI5MA== simonw 9599 2020-09-23T15:29:11Z 2020-09-23T15:29:11Z OWNER

This is still a good idea.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Add “updated” to metadata 274615452  
697473247 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697473247 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5NzQ3MzI0Nw== simonw 9599 2020-09-23T14:45:13Z 2020-09-23T14:45:13Z OWNER

lookup_table.lookup(lookups) is doing a SQL lookup. This could be cached in-memory, maybe with a LRU cache, to avoid looking up the primary key for records that we have recently used.

The .update() method it is calling first does a get() and then does a SQL UPDATE ... WHERE:

https://github.com/simonw/sqlite-utils/blob/1ebffe1dbeaed7311e5b61ed988f4cd701e84808/sqlite_utils/db.py#L1244-L1264

Batching those updates may have an effect. Or finding a way to skip the .get() since we already know we have a valid record.

{
    "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  
697467833 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697467833 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5NzQ2NzgzMw== simonw 9599 2020-09-23T14:42:03Z 2020-09-23T14:42:03Z OWNER

Here's the loop that's taking the time: https://github.com/simonw/sqlite-utils/blob/1ebffe1dbeaed7311e5b61ed988f4cd701e84808/sqlite_utils/db.py#L892-L897

{
    "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  
697466497 https://github.com/simonw/sqlite-utils/issues/172#issuecomment-697466497 https://api.github.com/repos/simonw/sqlite-utils/issues/172 MDEyOklzc3VlQ29tbWVudDY5NzQ2NjQ5Nw== simonw 9599 2020-09-23T14:41:17Z 2020-09-23T14:41:17Z OWNER

Steps to produce that database: curl -o salaries.csv 'https://data.sfgov.org/api/views/88g8-5mnd/rows.csv?accessType=DOWNLOAD' sqlite-utils insert salaries.db salaries salaries.csv --csv

{
    "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  
697047591 https://github.com/simonw/sqlite-utils/issues/170#issuecomment-697047591 https://api.github.com/repos/simonw/sqlite-utils/issues/170 MDEyOklzc3VlQ29tbWVudDY5NzA0NzU5MQ== simonw 9599 2020-09-23T00:14:52Z 2020-09-23T00:14:52Z OWNER

@simonw @db.register_function decorator, closes #162 4824775 @simonw table.transform() method - closes #114 987dd12 @simonw Keyword only arguments for transform() f8e10df

Also renamed columns= to types=

Closes #165

Commits on Sep 22, 2020 @simonw Implemented sqlite-utils transform command, closes #164 752d261 @simonw Applied Black f29f682 @simonw table.extract() method, refs #42 f855379 @simonw Docstring for sqlite-utils transform c755f28 @simonw Added table.extract(rename=) option, refs #42 c3210f2 @simonw Applied Black 317071a @simonw New .rows_where(select=) argument 7178231 @simonw table.extract() now works with rowid tables, refs #42 2db6c5b @simonw sqlite-utils extract, closes #42 55cf928 @simonw Progress bar for "sqlite-utils extract", closes #169 5c4d58d @simonw Fixed PRAGMA foreign_keys handling for .transform, closes #167

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Release notes for 2.20 706768798  

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