Update the table cache in update_table (fixes 67)
The problem occurs in the following scenario: * an instance of a Table, obtained through Database.get_table, is used to insert some data * a different instance of Table, obtained through Database.get_table call after the data has been inserted, uses a Table instance that is not up-to-date The result is that, e.g. the keys created with the first Table object aren't accessible via the second object. This fixes the problem by updating the table cache in Database.update_table.
This commit is contained in:
parent
e26bf57c39
commit
d07cc90345
@ -192,7 +192,8 @@ class Database(object):
|
||||
self.metadata = MetaData(schema=self.schema)
|
||||
self.metadata.bind = self.engine
|
||||
self.metadata.reflect(self.engine)
|
||||
return SQLATable(table_name, self.metadata)
|
||||
self._tables[table_name] = SQLATable(table_name, self.metadata)
|
||||
return self._tables[table_name]
|
||||
|
||||
def get_table(self, table_name, primary_id='id', primary_type='Integer'):
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user