lidavidm commented on code in PR #4773:
URL: https://github.com/apache/arrow-adbc/pull/4773#discussion_r4181123857
##########
docs/source/driver/sqlite.rst:
##########
@@ -138,6 +138,24 @@ shared across all connections.
Supported Features
==================
+Named Parameters
+----------------
+
+When binding by name, parameter names may include their ``:``, ``@``, or ``$``
+prefix, or omit it when the remaining name identifies a unique SQL parameter.
+For example, Python's ``cursor.execute("SELECT :a", {"a": 1})`` and
+``cursor.execute("SELECT :a", {":a": 1})`` are both supported.
+Exact prefixed names take precedence. If a query contains both ``:a`` and
+``@a``, an unprefixed ``a`` is ambiguous and must be replaced by the exact
+prefixed names.
+
+These rules differ from Python's standard library ``sqlite3`` module, which
+requires unprefixed dictionary keys, uses the same key for SQL parameters with
+different prefixes (for example, ``:a`` and ``@a``), and ignores extra keys.
+ADBC retains exact prefixed names and requires the number of supplied fields
+to match the number of SQLite parameter slots; each field must resolve to a
+different slot.
Review Comment:
```suggestion
When specifying bind parameters by name, the driver tries to match parameters
to fields in the schema of the supplied bind parameters. The names may
include
the prefixes (``:``, ``@``, or ``$``), or omit the prefix if unambiguous. For
example, in Python, both ``cursor.execute("SELECT :a", {"a": 1})`` and
``cursor.execute("SELECT :a", {":a": 1})`` are acceptable, but
``cursor.execute("SELECT :a, @a", {"a": 1})`` is not. (Note that this differs
from Python's standard library sqlite3 module.)
```
##########
python/adbc_driver_sqlite/tests/test_dbapi.py:
##########
Review Comment:
I didn't ask to add tests here and I don't think testing the stdlib is
reasonable, I just wanted to ask about comparing against stdlib sqlite and/or
justifying any difference. It appears sqlite itself considers the prefix part
of the name so the current behavior was reasonable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]