mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-28 03:44:31 +02:00
Implemented sqlite-utils insert --lines
This commit is contained in:
parent
d1ed2f423d
commit
f1569c9f7f
3 changed files with 26 additions and 0 deletions
|
|
@ -322,3 +322,18 @@ def test_insert_alter(db_path, tmpdir):
|
|||
{"foo": "baz", "n": 2, "baz": None},
|
||||
{"foo": "bar", "baz": 5, "n": None},
|
||||
] == list(db.query("select foo, n, baz from from_json_nl"))
|
||||
|
||||
|
||||
def test_insert_lines(db_path):
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "from_lines", "-", "--lines"],
|
||||
input='First line\nSecond line\n{"foo": "baz"}',
|
||||
)
|
||||
assert 0 == result.exit_code, result.output
|
||||
db = Database(db_path)
|
||||
assert [
|
||||
{"line": "First line"},
|
||||
{"line": "Second line"},
|
||||
{"line": '{"foo": "baz"}'},
|
||||
] == list(db.query("select line from from_lines"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue