mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-10-07 18:07:03 +02:00
sqlite-utils rows now obeys --json-cols
This commit is contained in:
parent
092e1368ed
commit
cec8c3c482
2 changed files with 6 additions and 4 deletions
|
|
@ -386,6 +386,7 @@ def rows(ctx, path, dbtable, nl, arrays, csv, no_headers, table, fmt, json_cols)
|
||||||
no_headers=no_headers,
|
no_headers=no_headers,
|
||||||
table=table,
|
table=table,
|
||||||
fmt=fmt,
|
fmt=fmt,
|
||||||
|
json_cols=json_cols,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -496,12 +496,13 @@ def test_query_json_with_json_cols(db_path):
|
||||||
result = CliRunner().invoke(
|
result = CliRunner().invoke(
|
||||||
cli.cli, [db_path, "select id, name, friends from dogs", "--json-cols"]
|
cli.cli, [db_path, "select id, name, friends from dogs", "--json-cols"]
|
||||||
)
|
)
|
||||||
assert (
|
expected = r"""
|
||||||
r"""
|
|
||||||
[{"id": 1, "name": "Cleo", "friends": [{"name": "Pancakes"}, {"name": "Bailey"}]}]
|
[{"id": 1, "name": "Cleo", "friends": [{"name": "Pancakes"}, {"name": "Bailey"}]}]
|
||||||
""".strip()
|
""".strip()
|
||||||
== result.output.strip()
|
assert expected == result.output.strip()
|
||||||
)
|
# Test rows command too
|
||||||
|
result_rows = CliRunner().invoke(cli.cli, ["rows", db_path, "dogs", "--json-cols"])
|
||||||
|
assert expected == result_rows.output.strip()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue