[issue45138] [sqlite3] expand bound values in traced statements if possible

Erlend E. Aasland report at bugs.python.org
Wed Sep 8 10:05:15 EDT 2021


New submission from Erlend E. Aasland <erlend.aasland at innova.no>:

For SQLite 3.14.0 and newer, we're using the v2 trace API. This means that the trace callback receives a pointer to the sqlite3_stmt object. We can use the sqlite3_stmt pointer to retrieve expanded SQL string.

The following statement...:
cur.executemany("insert into t values(?)", ((v,) for v in range(3)))

...will produce the following traces:
  insert into t values(0)
  insert into t values(1)
  insert into t values(2)

...instead of:
  insert into t values(?)
  insert into t values(?)
  insert into t values(?)

----------
assignee: erlendaasland
components: Extension Modules
messages: 401383
nosy: erlendaasland
priority: low
severity: normal
status: open
title: [sqlite3] expand bound values in traced statements if possible
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45138>
_______________________________________


More information about the Python-bugs-list mailing list