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/124#issuecomment-664105302 | https://api.github.com/repos/simonw/sqlite-utils/issues/124 | 664105302 | MDEyOklzc3VlQ29tbWVudDY2NDEwNTMwMg== | 9599 | 2020-07-27T03:54:24Z | 2020-07-30T22:57:51Z | OWNER | Documentation: https://github.com/simonw/sqlite-utils/commit/814d4a7f90991be865d38aac45ff12e36df1c67d?short_path=7240b7c#diff-7240b7c71b1a8194da0c001c64fc8d40 > You can pass named parameters to the query using -p: > > $ sqlite-utils query dogs.db "select :num * :num2" -p num 5 -p num2 6 > [{":num * :num2": 30}] | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665802405 | |
https://github.com/simonw/sqlite-utils/issues/128#issuecomment-664683608 | https://api.github.com/repos/simonw/sqlite-utils/issues/128 | 664683608 | MDEyOklzc3VlQ29tbWVudDY2NDY4MzYwOA== | 9599 | 2020-07-27T23:09:22Z | 2020-07-27T23:09:22Z | OWNER | This seems to work, but needs more tests: ```diff diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index d6b9ecf..ee26433 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -7,6 +7,7 @@ import itertools import json import os import pathlib +import uuid SQLITE_MAX_VARS = 999 @@ -40,11 +41,13 @@ COLUMN_TYPE_MAPPING = { str: "TEXT", bytes.__class__: "BLOB", bytes: "BLOB", + memoryview: "BLOB", datetime.datetime: "TEXT", datetime.date: "TEXT", datetime.time: "TEXT", decimal.Decimal: "FLOAT", None.__class__: "TEXT", + uuid.UUID: "TEXT", # SQLite explicit types "TEXT": "TEXT", "INTEGER": "INTEGER", @@ -1336,6 +1339,8 @@ def jsonify_if_needed(value): return json.dumps(value, default=repr) elif isinstance(value, (datetime.time, datetime.date, datetime.datetime)): return value.isoformat() + elif isinstance(value, uuid.UUID): + return str(value) else: return value ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
666639051 | |
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/127#issuecomment-664163206 | https://api.github.com/repos/simonw/sqlite-utils/issues/127 | 664163206 | MDEyOklzc3VlQ29tbWVudDY2NDE2MzIwNg== | 9599 | 2020-07-27T07:10:05Z | 2020-07-27T07:10:05Z | OWNER | I tried to get this working but it was a bit tricky because `-` doesn't behave like a regular `pathlib.Path` - needs a bit more thought on how the implementation would work. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
666040390 | |
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/114#issuecomment-664106621 | https://api.github.com/repos/simonw/sqlite-utils/issues/114 | 664106621 | MDEyOklzc3VlQ29tbWVudDY2NDEwNjYyMQ== | 9599 | 2020-07-27T04:01:13Z | 2020-07-27T04:01:13Z | OWNER | Work in progress in `transform` branch here: https://github.com/simonw/sqlite-utils/tree/transform | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
621989740 | |
https://github.com/simonw/sqlite-utils/issues/126#issuecomment-664106405 | https://api.github.com/repos/simonw/sqlite-utils/issues/126 | 664106405 | MDEyOklzc3VlQ29tbWVudDY2NDEwNjQwNQ== | 9599 | 2020-07-27T04:00:08Z | 2020-07-27T04:00:33Z | OWNER | ``` $ echo '[ { "name": "transparent.gif", "content": { "$base64": true, "encoded": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" } } ]' | sqlite-utils insert trans.db files - --pk=name ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665819048 | |
https://github.com/simonw/sqlite-utils/issues/126#issuecomment-664065597 | https://api.github.com/repos/simonw/sqlite-utils/issues/126 | 664065597 | MDEyOklzc3VlQ29tbWVudDY2NDA2NTU5Nw== | 9599 | 2020-07-27T00:51:11Z | 2020-07-27T00:51:11Z | OWNER | I'm going to implement this as the reverse of #125 - binary columns in JSON are now output like this: ```json { "name": "lorem.txt", "mode": 33188, "mtime": 1595805965, "sz": 16984, "data": { "$base64": true, "encoded": "eJzt0c1xAyEMBeC7q1ABHleR3HxNAQrIjmb4M0gelx+RTY7p4N2WBYT0vmufUknH8kq5lz5pqRFXsTOl3pYkE/NJnHXoStruJEVjc0mOCyTqq/ZMJnXEZW1Js2ZvRm5U+DPKk9hRWqjyvTFx0YfzhT6MpGmN2lR1fzxjyfVMD9dFrS+bnkleMpMam/ZGXgrX1I/K+5Au3S/9lNQRh0k4Gq/RUz8GiKfsQm+7JLsJ6fTo5JhVG00ZU76kZZkxePx49uIjnpNoJyYlWUsoaSl/CcVATje/Kxu13RANnrHweaH3V5Jh4jvGyKCnxJLiXPKhmW3fiCnG7Jql7RR3UvFo8jJ4z039dtOkTFmWzL1be9lt8A5II471m6vXy+l0BR/4wAc+8IEPfOADH/jABz7wgQ984AMf+MAHPvCBD3zgAx/4wAc+8IEPfOADH/jABz7wgQ984AMf+MAHPvCBD3zgAx/4wAc+8IEPfOADH/jABz7wgQ984PuP7xubBoN9" } } ] ``` So the `sqlite-utils insert` command should learn to spot `{"$base64": true...}` values and base64 decode them before inserting them. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665819048 | |
https://github.com/simonw/sqlite-utils/issues/125#issuecomment-664065341 | https://api.github.com/repos/simonw/sqlite-utils/issues/125 | 664065341 | MDEyOklzc3VlQ29tbWVudDY2NDA2NTM0MQ== | 9599 | 2020-07-27T00:49:41Z | 2020-07-27T00:49:41Z | OWNER | Documentation: https://github.com/simonw/sqlite-utils/commit/20e543e9a492f2e764caae73c38e87f18eaec444?short_path=7240b7c#diff-7240b7c71b1a8194da0c001c64fc8d40 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665817570 | |
https://github.com/simonw/sqlite-utils/issues/125#issuecomment-664062546 | https://api.github.com/repos/simonw/sqlite-utils/issues/125 | 664062546 | MDEyOklzc3VlQ29tbWVudDY2NDA2MjU0Ng== | 9599 | 2020-07-27T00:33:03Z | 2020-07-27T00:33:03Z | OWNER | I'm going to imitate how Datasette solves this problem: ```json [ { "name": "lorem.txt", "mode": 33188, "mtime": 1595805965, "sz": 16984, "data": { "$base64": true, "encoded": "eJzt0c1xAyEMBeC7q1ABHleR3HxNAQrIjmb4M0gelx+RTY7p4N2WBYT0vmufUknH8kq5lz5pqRFXsTOl3pYkE/NJnHXoStruJEVjc0mOCyTqq/ZMJnXEZW1Js2ZvRm5U+DPKk9hRWqjyvTFx0YfzhT6MpGmN2lR1fzxjyfVMD9dFrS+bnkleMpMam/ZGXgrX1I/K+5Au3S/9lNQRh0k4Gq/RUz8GiKfsQm+7JLsJ6fTo5JhVG00ZU76kZZkxePx49uIjnpNoJyYlWUsoaSl/CcVATje/Kxu13RANnrHweaH3V5Jh4jvGyKCnxJLiXPKhmW3fiCnG7Jql7RR3UvFo8jJ4z039dtOkTFmWzL1be9lt8A5II471m6vXy+l0BR/4wAc+8IEPfOADH/jABz7wgQ984AMf+MAHPvCBD3zgAx/4wAc+8IEPfOADH/jABz7wgQ984AMf+MAHPvCBD3zgAx/4wAc+8IEPfOADH/jABz7wgQ984PuP7xubBoN9" } } ] ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
665817570 |