Capture parameters= not params=, refs #309

This commit is contained in:
Simon Willison 2021-08-09 15:33:33 -07:00
commit a6567ec507
2 changed files with 7 additions and 7 deletions

View file

@ -795,12 +795,12 @@ def insert_upsert_implementation(
raise click.ClickException( raise click.ClickException(
"{}\n\nTry using --alter to add additional columns".format(e.args[0]) "{}\n\nTry using --alter to add additional columns".format(e.args[0])
) )
# If we can find sql= and params= arguments, show those # If we can find sql= and parameters= arguments, show those
variables = _find_variables(e.__traceback__, ["sql", "params"]) variables = _find_variables(e.__traceback__, ["sql", "parameters"])
if "sql" in variables and "params" in variables: if "sql" in variables and "parameters" in variables:
raise click.ClickException( raise click.ClickException(
"{}\n\nsql = {}\nparams={}".format( "{}\n\nsql = {}\nparameters = {}".format(
str(e), variables["sql"], variables["params"] str(e), variables["sql"], variables["parameters"]
) )
) )
else: else:

View file

@ -1259,7 +1259,7 @@ def test_upsert_alter(db_path, tmpdir):
assert ( assert (
"Error: no such column: age\n\n" "Error: no such column: age\n\n"
"sql = UPDATE [dogs] SET [age] = ? WHERE [id] = ?\n" "sql = UPDATE [dogs] SET [age] = ? WHERE [id] = ?\n"
"params=[5, 1]" "parameters = [5, 1]"
) == result.output.strip() ) == result.output.strip()
# Should succeed with --alter # Should succeed with --alter
result = CliRunner().invoke( result = CliRunner().invoke(
@ -2321,5 +2321,5 @@ def test_integer_overflow_error(tmpdir):
assert result.output == ( assert result.output == (
"Error: Python int too large to convert to SQLite INTEGER\n\n" "Error: Python int too large to convert to SQLite INTEGER\n\n"
"sql = INSERT INTO [items] ([bignumber]) VALUES (?);\n" "sql = INSERT INTO [items] ([bignumber]) VALUES (?);\n"
"params=[34223049823094832094802398430298048240]\n" "parameters = [34223049823094832094802398430298048240]\n"
) )