Instead of checking get_tables, just check the COLUMN_INDEX.

This reduces the number of frivolous sql queries we make, since
the index contians all the tables anyway. The side effect is that
the function won't acknowledge tables created during the run time,
which I kind of think is a good thing since it reduces accident
surface area to the tables outlined by the programmer during init.
This commit is contained in:
voussoir 2022-03-19 20:03:26 -07:00
parent 59df12a23f
commit 465f22fedb
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -122,7 +122,7 @@ class Database(metaclass=abc.ABCMeta):
raise NotImplementedError
def assert_table_exists(self, table) -> None:
if table not in self.get_tables():
if table not in self.COLUMN_INDEX:
raise BadTable(f'Table {table} does not exist.')
def close(self):