mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Output binary columns as base64 in JSON, closes #125
This commit is contained in:
parent
bc8409941f
commit
20e543e9a4
3 changed files with 46 additions and 1 deletions
13
docs/cli.rst
13
docs/cli.rst
|
|
@ -55,6 +55,19 @@ If you want to pretty-print the output further, you can pipe it through ``python
|
|||
}
|
||||
]
|
||||
|
||||
Binary strings are not valid JSON, so BLOB columns containing binary data will be returned as a JSON object containing base64 encoded data, that looks like this::
|
||||
|
||||
$ sqlite-utils dogs.db "select name, content from images" | python -mjson.tool
|
||||
[
|
||||
{
|
||||
"name": "smile.gif",
|
||||
"content": {
|
||||
"$base64": true,
|
||||
"encoded": "eJzt0c1x..."
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
If you execute an ``UPDATE``, ``INSERT`` or ``DELETE`` query the comand will return the number of affected rows::
|
||||
|
||||
$ sqlite-utils dogs.db "update dogs set age = 5 where name = 'Cleo'"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue