mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
--nl now ignores blank lines, closes #376
This commit is contained in:
parent
2f8879235a
commit
d2a79d200f
2 changed files with 2 additions and 2 deletions
|
|
@ -791,7 +791,7 @@ def insert_upsert_implementation(
|
|||
else:
|
||||
try:
|
||||
if nl:
|
||||
docs = (json.loads(line) for line in decoded)
|
||||
docs = (json.loads(line) for line in decoded if line.strip())
|
||||
else:
|
||||
docs = json.load(decoded)
|
||||
if isinstance(docs, dict):
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ def test_insert_newline_delimited(db_path):
|
|||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "from_json_nl", "-", "--nl"],
|
||||
input='{"foo": "bar", "n": 1}\n{"foo": "baz", "n": 2}',
|
||||
input='{"foo": "bar", "n": 1}\n\n{"foo": "baz", "n": 2}',
|
||||
)
|
||||
assert 0 == result.exit_code, result.output
|
||||
db = Database(db_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue