Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add an exception for when the number of value rows and key rows don't…
Browse files Browse the repository at this point in the history
… match
  • Loading branch information
reivilibre committed Apr 5, 2022
1 parent 5ccf177 commit d3847b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion synapse/storage/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ def simple_update_many_txn(
key_names: Collection[str],
key_values: Collection[Iterable[Any]],
value_names: Collection[str],
value_values: Iterable[Iterable[Any]],
value_values: Collection[Iterable[Any]],
) -> None:
"""
Update, many times, using batching where possible.
Expand All @@ -1831,6 +1831,11 @@ def simple_update_many_txn(
value_values: A list of each row's value column values.
"""

if len(value_values) != len(key_values):
raise ValueError(
f"{len(key_values)} key rows and {len(value_values)} value rows: should be the same number."
)

# List of value names, then key names
allnames: List[str] = []
allnames.extend(value_names)
Expand Down

0 comments on commit d3847b0

Please sign in to comment.