From 5dffe52830ba64b33628ee1a155afcd80cddd9a6 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 15 Apr 2020 16:31:47 -0700 Subject: [PATCH] Start _cached_sql_tables as None, and in the SQL mixin. --- etiquette/photodb.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index 282443c..bf9bbd7 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -677,8 +677,11 @@ class PDBSQLMixin: self.on_commit_queue = [] self.on_rollback_queue = [] self.savepoints = [] + self._cached_sql_tables = None def assert_table_exists(self, table): + if not self._cached_sql_tables: + self._cached_sql_tables = self.get_sql_tables() if table not in self._cached_sql_tables: raise exceptions.BadTable(table) @@ -1390,8 +1393,6 @@ class PhotoDB( self.log.setLevel(self.config['log_level']) # OTHER - self._cached_sql_tables = self.get_sql_tables() - self._cached_frozen_children = None self.caches = {