Optimize create table calls using executescript=True

Refs #1555, #1569
This commit is contained in:
Simon Willison 2021-12-18 10:30:53 -08:00
commit 2e4ba71b53
4 changed files with 18 additions and 43 deletions

View file

@ -950,7 +950,9 @@ def test_trace(trace_debug):
"select ",
)
for prefix in expected:
assert any(sql.startswith(prefix) for sql in sqls)
assert any(
sql.startswith(prefix) for sql in sqls
), "No trace beginning with: {}".format(prefix)
@pytest.mark.parametrize(

View file

@ -401,7 +401,7 @@ async def test_execute_write_executescript(db):
await db.execute_write(
"create table foo (id integer primary key); create table bar (id integer primary key); ",
executescript=True,
block=True
block=True,
)
table_names = await db.table_names()
assert {"foo", "bar"}.issubset(table_names)
@ -413,7 +413,7 @@ async def test_execute_write_executescript_not_allowed_with_params(db):
await db.execute_write(
"update roadside_attractions set name = ? where pk = ?",
["Mystery!", 1],
executescript=True
executescript=True,
)