From c87bdb4d26a285fdb65d619a94a8c67f776bb578 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:42:42 -0500 Subject: [PATCH] drop and recreate tables on reindex --- frigate/embeddings/embeddings.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frigate/embeddings/embeddings.py b/frigate/embeddings/embeddings.py index 68fdc26b0..826ce6f88 100644 --- a/frigate/embeddings/embeddings.py +++ b/frigate/embeddings/embeddings.py @@ -150,6 +150,14 @@ class Embeddings: ); """) + def _drop_tables(self): + self.db.execute_sql(""" + DROP TABLE vec_descriptions; + """) + self.db.execute_sql(""" + DROP TABLE vec_thumbnails; + """) + def upsert_thumbnail(self, event_id: str, thumbnail: bytes): # Convert thumbnail bytes to PIL Image image = Image.open(io.BytesIO(thumbnail)).convert("RGB") @@ -281,6 +289,9 @@ class Embeddings: def reindex(self) -> None: logger.info("Indexing event embeddings...") + self._drop_tables() + self._create_tables() + st = time.time() totals = { "thumb": 0,