From 465f22fedb9b2787409bd9855e922d450421b714 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 19 Mar 2022 20:03:26 -0700 Subject: [PATCH] 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. --- voussoirkit/worms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voussoirkit/worms.py b/voussoirkit/worms.py index ba1122f..6b02a87 100644 --- a/voussoirkit/worms.py +++ b/voussoirkit/worms.py @@ -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):