Use lists instead of sets to maintain order of column names
This commit is contained in:
parent
43e9431865
commit
e2431bc344
@ -132,7 +132,7 @@ 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 set(row.keys()).difference(set(sync_row.keys())):
|
for key in [k for k in row.keys() if k not in sync_row.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)
|
||||||
@ -192,10 +192,10 @@ class Table(object):
|
|||||||
keys = keys if type(keys) in (list, tuple) else [keys]
|
keys = keys if type(keys) in (list, tuple) else [keys]
|
||||||
|
|
||||||
chunk = []
|
chunk = []
|
||||||
columns = set()
|
columns = []
|
||||||
for index, row in enumerate(rows):
|
for index, row in enumerate(rows):
|
||||||
chunk.append(row)
|
chunk.append(row)
|
||||||
columns = columns.union(set(row.keys()))
|
columns = [col for col in row.keys() if col not in columns]
|
||||||
|
|
||||||
# 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:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user