-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite3 seems to consider ?1
a named placeholder
#117995
Comments
Thanks for the report! I overlooked the Footnotes
|
… params Filter out '?NNN' type placeholders when looking for named params.
Thanks for putting together a PR so quickly! |
#118001) Filter out '?NNN' placeholders when looking for named params. Co-authored-by: AN Long <aisk@users.noreply.github.com>
… params (pythonGH-118001) Filter out '?NNN' placeholders when looking for named params. (cherry picked from commit 550483b) Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: AN Long <aisk@users.noreply.github.com>
Thanks for the report and the reproducer, @kalekundert :) |
Bug report
Bug description:
Starting in python 3.12, the following snippet generates a deprecation warning:
Here's the warning for the first placeholder (there's another identical one for the second):
I'll admit to not having a great understanding of how databases are supposed to work in python, but I don't think this warning should be issued. The sqlite docs specify that the
?<number>
syntax is used to specify a parameter index, not a parameter name. So this kind of placeholder is meant to be used with sequence-style parameters like[3, 4]
. I think the above warning should be issued only when the user tries to use:<word>
placeholders with sequence-style parameters.The above example is very simplified, so I think it might also be helpful to show the real-life query that triggered this warning for me. The goal is to insert key/value pairs from a dictionary, updating any keys that are already in the table. The query requires referring to the value in two places.
?<number>
placeholders seem like the right syntax to use here, because they allow themetadata.items()
to be used directly:CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: