We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5e6260e + cd2f7ee commit 57a2f88Copy full SHA for 57a2f88
src/acquisition/covidcast/database.py
@@ -333,7 +333,11 @@ def delete_batch(self, cc_deletions):
333
if isinstance(cc_deletions, str):
334
self._cursor.execute(load_tmp_table_infile_sql)
335
elif isinstance(cc_deletions, list):
336
- self._cursor.executemany(load_tmp_table_insert_sql, cc_deletions)
+ def split_list(lst, n):
337
+ for i in range(0, len(lst), n):
338
+ yield lst[i:(i+n)]
339
+ for deletions_batch in split_list(cc_deletions, 100000):
340
+ self._cursor.executemany(load_tmp_table_insert_sql, deletions_batch)
341
else:
342
raise Exception(f"Bad deletions argument: need a filename or a list of tuples; got a {type(cc_deletions)}")
343
self._cursor.execute(add_id_sql)
0 commit comments