mirror of https://github.com/zulip/zulip.git
import_realm: Use cursor.execute correctly.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
fd65511fe9
commit
a9651e3e43
|
@ -345,8 +345,8 @@ def allocate_ids(model_class: Any, count: int) -> List[int]:
|
||||||
"""
|
"""
|
||||||
conn = connection.cursor()
|
conn = connection.cursor()
|
||||||
sequence = idseq(model_class)
|
sequence = idseq(model_class)
|
||||||
conn.execute("select nextval('%s') from generate_series(1,%s)" %
|
conn.execute("select nextval(%s) from generate_series(1, %s)",
|
||||||
(sequence, str(count)))
|
[sequence, count])
|
||||||
query = conn.fetchall() # Each element in the result is a tuple like (5,)
|
query = conn.fetchall() # Each element in the result is a tuple like (5,)
|
||||||
conn.close()
|
conn.close()
|
||||||
# convert List[Tuple[int]] to List[int]
|
# convert List[Tuple[int]] to List[int]
|
||||||
|
|
Loading…
Reference in New Issue