Remove all keys from values

This commit is contained in:
remalloc.virtual@gmail.com 2021-06-09 14:16:40 +08:00
parent f7254e5021
commit 7f49e89350

View File

@ -228,14 +228,13 @@ class Table(object):
chunk = [] chunk = []
columns = [] columns = []
for index, row in enumerate(rows): for index, row in enumerate(rows):
chunk.append(row) columns.extend(col for col in row.keys() if (col not in columns) and (col not in keys))
for col in row.keys():
if col not in columns:
columns.append(col)
# bindparam requires names to not conflict (cannot be "id" for id) # bindparam requires names to not conflict (cannot be "id" for id)
for key in keys: for key in keys:
row["_%s" % key] = row[key] row["_%s" % key] = row[key]
row.pop(key)
chunk.append(row)
# Update when chunk_size is fulfilled or this is the last row # Update when chunk_size is fulfilled or this is the last row
if len(chunk) == chunk_size or index == len(rows) - 1: if len(chunk) == chunk_size or index == len(rows) - 1: