Browse Source

Log values at DEBUG level with execute_values (#16281)

tags/v1.93.0rc1
David Robertson 8 months ago
committed by GitHub
parent
commit
c1c6c95d72
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions
  1. +1
    -0
      changelog.d/16281.misc
  2. +3
    -2
      synapse/storage/database.py

+ 1
- 0
changelog.d/16281.misc View File

@@ -0,0 +1 @@
Include values in SQL debug when using `execute_values` with Postgres.

+ 3
- 2
synapse/storage/database.py View File

@@ -422,10 +422,11 @@ class LoggingTransaction:
return self._do_execute(
# TODO: is it safe for values to be Iterable[Iterable[Any]] here?
# https://www.psycopg.org/docs/extras.html?highlight=execute_batch#psycopg2.extras.execute_values says values should be Sequence[Sequence]
lambda the_sql: execute_values(
self.txn, the_sql, values, template=template, fetch=fetch
lambda the_sql, the_values: execute_values(
self.txn, the_sql, the_values, template=template, fetch=fetch
),
sql,
values,
)

def execute(self, sql: str, parameters: SQLQueryParameters = ()) -> None:


Loading…
Cancel
Save