import_realm: Use cursor.execute correctly.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-05-03 16:55:55 -07:00 committed by Tim Abbott
parent fd65511fe9
commit a9651e3e43
1 changed files with 2 additions and 2 deletions

View File

@ -345,8 +345,8 @@ def allocate_ids(model_class: Any, count: int) -> List[int]:
"""
conn = connection.cursor()
sequence = idseq(model_class)
conn.execute("select nextval('%s') from generate_series(1,%s)" %
(sequence, str(count)))
conn.execute("select nextval(%s) from generate_series(1, %s)",
[sequence, count])
query = conn.fetchall() # Each element in the result is a tuple like (5,)
conn.close()
# convert List[Tuple[int]] to List[int]