From d6831fba2800085a04b8e0296ca601ee0fa88102 Mon Sep 17 00:00:00 2001 From: George Yohng Date: Wed, 3 Jul 2024 10:16:11 +0200 Subject: [PATCH] Index creation: fix a problem with the table not existing initially --- library.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.py b/library.py index 26ee417..b240f1b 100644 --- a/library.py +++ b/library.py @@ -530,7 +530,7 @@ def download(self): self.logger.debug("Indexing parts table...") wx.PostEvent(self.parent, UpdateGaugeEvent(value=0)) with contextlib.closing(sqlite3.connect(self.partsdb_file)) as con: - con.execute('DROP TABLE parts_by_lcsc;') + con.execute('DROP TABLE IF EXISTS parts_by_lcsc;') con.execute('CREATE TABLE IF NOT EXISTS parts_by_lcsc (partsId INTEGER, lcsc TEXT);') con.execute('DROP INDEX IF EXISTS LCSCpartIdx;') cur = con.execute('SELECT rowid, `LCSC Part` FROM parts')