You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: Named parameter binding not consistent with DBAPI (stdlib sqlite) #3520
Whereas other DBAPI implementations such as the Python sqlite standard library do not expect the paramstyle special character to be part of the name. E.g.,
importsqlite3importadbc_driver_sqlite.dbapiquery="SELECT :a"forparam_valuein [
{"a": 1}, # Correct per DBAPI, fails with ADBC
{":a": 1}, # Works with ADBC, but not sqlite
]:
print(f"{param_value=}")
withadbc_driver_sqlite.dbapi.connect() asadbc_conn:
adbc_cursor=adbc_conn.cursor()
try:
adbc_cursor.execute(query, param_value)
adbc_res=adbc_cursor.fetchone()
print(f"{adbc_res=}")
exceptExceptionase:
print(f"adbc_res = {str(e)}")
adbc_cursor.close()
withsqlite3.connect(":memory:") assqlite_conn:
sqlite_cursor=sqlite_conn.cursor()
try:
sqlite_cursor.execute(query, param_value)
sqlite_res=sqlite_cursor.fetchone()
print(f"{sqlite_res=}", end="\n\n")
exceptExceptionase:
print(f"sqlite_res = {str(e)}", end="\n\n")
sqlite_cursor.close()
Output
param_value = {'a': 1}
adbc_res = INVALID_ARGUMENT: could not find parameter `a`
sqlite_res = (1,)
param_value = {':a': 1}
adbc_res = (1,)
sqlite_res = You did not supply a value for binding parameter :a.
Hmm, I should more explicitly document that paramstyle is the part of DB-API that we intentionally don't try to emulate very well. But it seems reasonable for the SQLite driver to be more forgiving here.
I will work on accepting unprefixed SQLite named parameters while preserving exact prefixed names and rejecting ambiguous matches. I plan to add native and Python regression tests. This comment and the implementation work are AI-assisted using OpenAI Codex.
Activity
lidavidm commentedon Oct 6, 2025
Hmm, I should more explicitly document that
paramstyleis the part of DB-API that we intentionally don't try to emulate very well. But it seems reasonable for the SQLite driver to be more forgiving here.emecii commentedon Sep 10, 2026
take
emecii commentedon Sep 10, 2026
I will work on accepting unprefixed SQLite named parameters while preserving exact prefixed names and rejecting ambiguous matches. I plan to add native and Python regression tests. This comment and the implementation work are AI-assisted using OpenAI Codex.