mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-08 01:24:20 +02:00
Add --key option to insert/upsert/bulk for importing JSON lists nested under a top-level key
Fixes #489. JSON shaped like {"List": [...]} previously required piping through jq .List first; --key lets insert/upsert/bulk select the array directly.
This commit is contained in:
parent
74c7038b8b
commit
6a2e941863
4 changed files with 103 additions and 1 deletions
|
|
@ -293,6 +293,9 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
|
|||
--flatten Flatten nested JSON objects, so {"a": {"b": 1}}
|
||||
becomes {"a_b": 1}
|
||||
--nl Expect newline-delimited JSON
|
||||
--key TEXT If input is a JSON object, import the array of
|
||||
records under this key, e.g. --key results for
|
||||
{"results": [...]}
|
||||
-c, --csv Expect CSV input
|
||||
--tsv Expect TSV input
|
||||
--empty-null Treat empty strings as NULL
|
||||
|
|
@ -357,6 +360,9 @@ See :ref:`cli_upsert`.
|
|||
--flatten Flatten nested JSON objects, so {"a": {"b": 1}}
|
||||
becomes {"a_b": 1}
|
||||
--nl Expect newline-delimited JSON
|
||||
--key TEXT If input is a JSON object, import the array of
|
||||
records under this key, e.g. --key results for
|
||||
{"results": [...]}
|
||||
-c, --csv Expect CSV input
|
||||
--tsv Expect TSV input
|
||||
--empty-null Treat empty strings as NULL
|
||||
|
|
@ -412,6 +418,9 @@ See :ref:`cli_bulk`.
|
|||
--flatten Flatten nested JSON objects, so {"a": {"b": 1}} becomes
|
||||
{"a_b": 1}
|
||||
--nl Expect newline-delimited JSON
|
||||
--key TEXT If input is a JSON object, import the array of records
|
||||
under this key, e.g. --key results for {"results":
|
||||
[...]}
|
||||
-c, --csv Expect CSV input
|
||||
--tsv Expect TSV input
|
||||
--empty-null Treat empty strings as NULL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue