Get rid of the flush statement, but I'm not sure this has no side effects

This commit is contained in:
Friedrich Lindenberg 2020-08-23 12:30:30 +02:00
parent 3fe0ae10aa
commit 4034a12f62

View File

@ -77,10 +77,6 @@ class Table(object):
self._columns[key] = name self._columns[key] = name
return self._columns return self._columns
def _flush_metadata(self):
with self.db.lock:
self._columns = None
@property @property
def columns(self): def columns(self):
"""Get a listing of all columns that exist in the table.""" """Get a listing of all columns that exist in the table."""
@ -312,7 +308,7 @@ class Table(object):
def _reflect_table(self): def _reflect_table(self):
"""Load the tables definition from the database.""" """Load the tables definition from the database."""
with self.db.lock: with self.db.lock:
self._flush_metadata() self._columns = None
try: try:
self._table = SQLATable( self._table = SQLATable(
self.name, self.db.metadata, schema=self.db.schema, autoload=True self.name, self.db.metadata, schema=self.db.schema, autoload=True
@ -331,7 +327,6 @@ class Table(object):
def _sync_table(self, columns): def _sync_table(self, columns):
"""Lazy load, create or adapt the table structure in the database.""" """Lazy load, create or adapt the table structure in the database."""
self._flush_metadata()
if self._table is None: if self._table is None:
# Load an existing table from the database. # Load an existing table from the database.
self._reflect_table() self._reflect_table()