Skip to content

Commit cec8c3c

Browse files
committed
sqlite-utils rows now obeys --json-cols
1 parent 092e136 commit cec8c3c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

sqlite_utils/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ def rows(ctx, path, dbtable, nl, arrays, csv, no_headers, table, fmt, json_cols)
386386
no_headers=no_headers,
387387
table=table,
388388
fmt=fmt,
389+
json_cols=json_cols,
389390
)
390391

391392

tests/test_cli.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,13 @@ def test_query_json_with_json_cols(db_path):
496496
result = CliRunner().invoke(
497497
cli.cli, [db_path, "select id, name, friends from dogs", "--json-cols"]
498498
)
499-
assert (
500-
r"""
499+
expected = r"""
501500
[{"id": 1, "name": "Cleo", "friends": [{"name": "Pancakes"}, {"name": "Bailey"}]}]
502501
""".strip()
503-
== result.output.strip()
504-
)
502+
assert expected == result.output.strip()
503+
# Test rows command too
504+
result_rows = CliRunner().invoke(cli.cli, ["rows", db_path, "dogs", "--json-cols"])
505+
assert expected == result_rows.output.strip()
505506

506507

507508
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)