mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:16:07 -04:00
Use execute_batch in more places (#9188)
* Use execute_batch in more places * Newsfile
This commit is contained in:
parent
c55e62548c
commit
7a43482f19
12 changed files with 26 additions and 31 deletions
|
@ -262,6 +262,12 @@ class LoggingTransaction:
|
|||
return self.txn.description
|
||||
|
||||
def execute_batch(self, sql: str, args: Iterable[Iterable[Any]]) -> None:
|
||||
"""Similar to `executemany`, except `txn.rowcount` will not be correct
|
||||
afterwards.
|
||||
|
||||
More efficient than `executemany` on PostgreSQL
|
||||
"""
|
||||
|
||||
if isinstance(self.database_engine, PostgresEngine):
|
||||
from psycopg2.extras import execute_batch # type: ignore
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue