mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-10 10:34:10 +02:00
Use sqlean if available in environment (#560)
Closes #559 Closes #235 Refs https://github.com/simonw/llm/issues/60 - Uses `sqlean` in place of `sqlite3` if `sqlean.py` is installed - Uses `sqlite-dump` if available and `conn.iterdump()` does not exist - New `with db.ensure_autocommit_off()` method for ensuring autocommit is off, used by `enable_wal()` and `disable_wal()`.
This commit is contained in:
parent
2747257a33
commit
f5c63088e1
12 changed files with 136 additions and 19 deletions
|
|
@ -164,9 +164,9 @@ def test_memory_dump(extra_args):
|
|||
input="id,name\n1,Cleo\n2,Bants",
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
assert result.output.strip() == (
|
||||
expected = (
|
||||
"BEGIN TRANSACTION;\n"
|
||||
'CREATE TABLE "stdin" (\n'
|
||||
'CREATE TABLE IF NOT EXISTS "stdin" (\n'
|
||||
" [id] INTEGER,\n"
|
||||
" [name] TEXT\n"
|
||||
");\n"
|
||||
|
|
@ -176,6 +176,9 @@ def test_memory_dump(extra_args):
|
|||
"CREATE VIEW t AS select * from [stdin];\n"
|
||||
"COMMIT;"
|
||||
)
|
||||
# Using sqlite-dump it won't have IF NOT EXISTS
|
||||
expected_alternative = expected.replace("IF NOT EXISTS ", "")
|
||||
assert result.output.strip() in (expected, expected_alternative)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("extra_args", ([], ["select 1"]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue