mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Introduce new /$DB/-/query endpoint, soft replaces /$DB?sql=... (#2363)
* Introduce new default /$DB/-/query endpoint * Fix a lot of tests * Update pyodide test to use query endpoint * Link to /fixtures/-/query in a few places * Documentation for QueryView --------- Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
parent
56adfff8d2
commit
a23c2aee00
21 changed files with 148 additions and 83 deletions
|
|
@ -250,7 +250,7 @@ def test_plugin_s_overwrite():
|
|||
"--plugins-dir",
|
||||
plugins_dir,
|
||||
"--get",
|
||||
"/_memory.json?sql=select+prepare_connection_args()",
|
||||
"/_memory/-/query.json?sql=select+prepare_connection_args()",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
|
|
@ -265,7 +265,7 @@ def test_plugin_s_overwrite():
|
|||
"--plugins-dir",
|
||||
plugins_dir,
|
||||
"--get",
|
||||
"/_memory.json?sql=select+prepare_connection_args()",
|
||||
"/_memory/-/query.json?sql=select+prepare_connection_args()",
|
||||
"-s",
|
||||
"plugins.name-of-plugin",
|
||||
"OVERRIDE",
|
||||
|
|
@ -295,7 +295,7 @@ def test_setting_default_allow_sql(default_allow_sql):
|
|||
"default_allow_sql",
|
||||
"on" if default_allow_sql else "off",
|
||||
"--get",
|
||||
"/_memory.json?sql=select+21&_shape=objects",
|
||||
"/_memory/-/query.json?sql=select+21&_shape=objects",
|
||||
],
|
||||
)
|
||||
if default_allow_sql:
|
||||
|
|
@ -309,7 +309,7 @@ def test_setting_default_allow_sql(default_allow_sql):
|
|||
|
||||
def test_sql_errors_logged_to_stderr():
|
||||
runner = CliRunner(mix_stderr=False)
|
||||
result = runner.invoke(cli, ["--get", "/_memory.json?sql=select+blah"])
|
||||
result = runner.invoke(cli, ["--get", "/_memory/-/query.json?sql=select+blah"])
|
||||
assert result.exit_code == 1
|
||||
assert "sql = 'select blah', params = {}: no such column: blah\n" in result.stderr
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue