Fix race condition when getting column keys of new table

_columns_keys() sets _columns to {}, but _sync_table() empties _columns
when table is empty.
This commit is contained in:
Frank Villaro-Dixon 2020-02-24 13:02:31 +01:00
parent c01e717436
commit b6ed0587ed

View File

@ -57,8 +57,10 @@ class Table(object):
if not self.exists:
return {}
if self._columns is None:
# Initialise the table if it doesn't exist
table = self.table
self._columns = {}
for column in self.table.columns:
for column in table.columns:
name = normalize_column_name(column.name)
key = normalize_column_key(name)
if key in self._columns: