issue_comments: 663931279

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/122#issuecomment-663931279 https://api.github.com/repos/simonw/sqlite-utils/issues/122 663931279 MDEyOklzc3VlQ29tbWVudDY2MzkzMTI3OQ== 9599 2020-07-26T03:33:23Z 2020-07-27T04:30:49Z OWNER

One idea: sqlite-utils insert-files

It could work something like this:

sqlite-utils insert-files files.db /tmp/blah.jpg /tmp/foo.gif \
  --table files \
  -c key:filename -c hash:sha256 -c body:content \
  --pk key

This would insert those two image files into the database in a table called files with a schema that looks something like this:

CREATE TABLE files (
    key text primary key,
    hash text,
    body blob
);

The -c key:filename options here are the most interesting: they let you create the table with a specific layout. The bit before the : is the column name. The bit after the : can be a range of different things:

  • filename - just the filename
  • filepath - the full filepath (provided on the command-line)
  • absolutepath - the filepath expanded to start with /home/... or whatever
  • sha256 - the SHA256 of the contents
  • md5 - the MD5
  • content - the binary content itself
  • mtime - the mtime (floating point timestamp)
  • ctime - the ctime (floating point timestamp)
  • mtime_iso - the mtime as an ISO datetime
  • ctime_iso - the mtime as an ISO datetime
  • size - the size of the file in bytes
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
665700495  
Powered by Datasette · Query took 1.214ms · About: github-to-sqlite