mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
derive_named_parameters falls back to regex on SQL error, refs #1421
This commit is contained in:
parent
fc4846850f
commit
b1fed48a95
2 changed files with 13 additions and 9 deletions
|
|
@ -629,13 +629,16 @@ def test_parse_metadata(content, expected):
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("sql,expected", (
|
||||
("select 1", []),
|
||||
("select 1 + :one", ["one"]),
|
||||
("select 1 + :one + :two", ["one", "two"]),
|
||||
("select 'bob' || '0:00' || :cat", ["cat"]),
|
||||
("select this is invalid", []),
|
||||
))
|
||||
@pytest.mark.parametrize(
|
||||
"sql,expected",
|
||||
(
|
||||
("select 1", []),
|
||||
("select 1 + :one", ["one"]),
|
||||
("select 1 + :one + :two", ["one", "two"]),
|
||||
("select 'bob' || '0:00' || :cat", ["cat"]),
|
||||
("select this is invalid :one, :two, :three", ["one", "two", "three"]),
|
||||
),
|
||||
)
|
||||
async def test_derive_named_parameters(sql, expected):
|
||||
ds = Datasette([], memory=True)
|
||||
db = ds.get_database("_memory")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue