From 36919b1f415cdc895548c253d4583fe8380201ca Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Thu, 13 Jan 2022 11:47:41 -0500 Subject: [PATCH] Remove unused simple_insert_many_txn. --- synapse/storage/database.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/synapse/storage/database.py b/synapse/storage/database.py index 4dd855f2399b..b3b7d61f2ada 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py @@ -933,41 +933,6 @@ def simple_insert_txn( txn.execute(sql, vals) - @staticmethod - def simple_insert_many_txn( - txn: LoggingTransaction, table: str, values: List[Dict[str, Any]] - ) -> None: - """Executes an INSERT query on the named table. - - The input is given as a list of dicts, with one dict per row. - Generally simple_insert_many_values_txn should be preferred for new code. - - Args: - txn: The transaction to use. - table: string giving the table name - values: dict of new column names and values for them - """ - if not values: - return - - # This is a *slight* abomination to get a list of tuples of key names - # and a list of tuples of value names. - # - # i.e. [{"a": 1, "b": 2}, {"c": 3, "d": 4}] - # => [("a", "b",), ("c", "d",)] and [(1, 2,), (3, 4,)] - # - # The sort is to ensure that we don't rely on dictionary iteration - # order. - keys, vals = zip( - *(zip(*(sorted(i.items(), key=lambda kv: kv[0]))) for i in values if i) - ) - - for k in keys: - if k != keys[0]: - raise RuntimeError("All items must have the same keys") - - return DatabasePool.simple_insert_many_values_txn(txn, table, keys[0], vals) - async def simple_insert_many_values( self, table: str,