Fix error introduced in #305.

This commit is contained in:
Friedrich Lindenberg 2020-01-11 12:37:50 +01:00
parent db3ef16566
commit 5a09e72fd1

View File

@ -132,7 +132,8 @@ class Table(object):
sync_row = {} sync_row = {}
for row in rows: for row in rows:
# Only get non-existing columns. # Only get non-existing columns.
for key in [k for k in row.keys() if k not in sync_row.keys()]: sync_keys = list(sync_row.keys())
for key in [k for k in row.keys() if k not in sync_keys]:
# Get a sample of the new column(s) from the row. # Get a sample of the new column(s) from the row.
sync_row[key] = row[key] sync_row[key] = row[key]
self._sync_columns(sync_row, ensure, types=types) self._sync_columns(sync_row, ensure, types=types)
@ -197,7 +198,9 @@ class Table(object):
columns = [] columns = []
for index, row in enumerate(rows): for index, row in enumerate(rows):
chunk.append(row) chunk.append(row)
columns = [col for col in row.keys() if col not in columns] 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: