Merge pull request #376 from Remalloc/master
Remove all keys from values
This commit is contained in:
commit
41b7552df1
@ -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:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user