github
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-664163524 | https://api.github.com/repos/simonw/sqlite-utils/issues/122 | 664163524 | MDEyOklzc3VlQ29tbWVudDY2NDE2MzUyNA== | 9599 | 2020-07-27T07:10:41Z | 2020-07-27T07:10:41Z | OWNER | Docs: https://github.com/simonw/sqlite-utils/blob/ebc802f7ff0e640b6ae11ea525290fea0115228c/docs/cli.rst#inserting-binary-data-from-files | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665700495 | |
https://github.com/simonw/sqlite-utils/issues/122#issuecomment-664128071 | https://api.github.com/repos/simonw/sqlite-utils/issues/122 | 664128071 | MDEyOklzc3VlQ29tbWVudDY2NDEyODA3MQ== | 9599 | 2020-07-27T05:30:54Z | 2020-07-27T05:30:54Z | OWNER | Inserting files by piping them in should work - but since a filename cannot be derived this will need a `--name blah.gif` option. cat blah.gif | sqlite-utils insert-files files.db files - --name=blah.gif | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665700495 | |
https://github.com/simonw/sqlite-utils/issues/122#issuecomment-664127741 | https://api.github.com/repos/simonw/sqlite-utils/issues/122 | 664127741 | MDEyOklzc3VlQ29tbWVudDY2NDEyNzc0MQ== | 9599 | 2020-07-27T05:29:48Z | 2020-07-27T05:29:48Z | OWNER | Test command: ``` sqlite-utils insert-files gifs.db *.gif \ -c filename:filename \ -c filepath:filepath \ -c absolutepath:absolutepath \ -c sha256:sha256 \ -c md5:md5 \ -c content:content \ -c mtime:mtime \ -c ctime:ctime \ -c mtime_iso:mtime_iso \ -c ctime_iso:ctime_iso \ -c size:size \ --pk absolutepath ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665700495 | |
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: ```sql 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 |