From 5a09e72fd1f96672ac5ee7a1c090db977d95603e Mon Sep 17 00:00:00 2001 From: Friedrich Lindenberg Date: Sat, 11 Jan 2020 12:37:50 +0100 Subject: [PATCH] Fix error introduced in #305. --- dataset/table.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dataset/table.py b/dataset/table.py index 45600ff..119d155 100644 --- a/dataset/table.py +++ b/dataset/table.py @@ -132,7 +132,8 @@ class Table(object): sync_row = {} for row in rows: # 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. sync_row[key] = row[key] self._sync_columns(sync_row, ensure, types=types) @@ -197,7 +198,9 @@ class Table(object): columns = [] for index, row in enumerate(rows): 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) for key in keys: