changeset 7699:e10d0b262abd

fix: diagnose/report use of SQLite without FTS5 support As of 2.2.0 Roundup requires FTS5 support in SQLite. FTS5 has been part of the main SQLite distribution since October 2015. Tonu Mikk found this when trying to run 2.3.0 under RedHat 7. He got a traceback when trying to spin up 2.3.0. It took us a bit to figure out that FTS5 was missing from the SQLite library used by Python3. See: https://sourceforge.net/p/roundup/mailman/message/51783129/ This change catches the sql error and checks to see if the ENABLE_FTS5 compile option is defined. If not it raises NotImplementedError with a more useful error message and reports the version of SQLite in use. This will at least ease diagnosis. Trying to support SQLite without FTS5 support raises a number of issues including tracking the internal schema used by Roundup. So not going to attempt that. Details: https://sourceforge.net/p/roundup/mailman/message/51783321/
author John Rouillard <rouilj@ieee.org>
date Sun, 12 Nov 2023 19:35:07 -0500
parents 4e37a7833708
children 939e2edeab40
files CHANGES.txt roundup/backends/back_sqlite.py
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Sat Nov 11 19:39:57 2023 -0500
+++ b/CHANGES.txt	Sun Nov 12 19:35:07 2023 -0500
@@ -71,7 +71,7 @@
   newer. dicttoxml uses a type alias: collection.Iterator that is
   dropped in Python 3.10. (found by Norbert Schlemmer, fix John
   Rouillard)
-- fix repeated password id with user.item.html in all templates except
+- fix duplicate html id 'password' in user.item.html in all templates except
   jinja2. (John Rouillard)
 - fix unclosed file when saving index in indexer_dbm.py. (John Rouillard)
 - fix task index in devel tracker so it doesn't cause a crash if all
@@ -83,6 +83,10 @@
   John Rouillard)
 - fix roundup-demo, interactive mode would nuke an existing tracker.
   (Found Tonu Mikk, fix John Rouillard)
+- fix detection/reporting when using a SQLite3 library without FTS5
+  support. Install docs updated to state that FTS5 support is required
+  when using SQLite for back end. (Found Tonu Mikk, fix John
+  Rouillard)
 
 Features:
 
--- a/roundup/backends/back_sqlite.py	Sat Nov 11 19:39:57 2023 -0500
+++ b/roundup/backends/back_sqlite.py	Sun Nov 12 19:35:07 2023 -0500
@@ -252,8 +252,21 @@
         pass
 
     def _add_fts5_table(self):
-        self.sql('CREATE virtual TABLE __fts USING fts5(_class, '
+        try:
+            self.sql('CREATE virtual TABLE __fts USING fts5(_class, '
                  '_itemid, _prop, _textblob)')
+        except sqlite.OperationalError:
+            available_options = self.cursor.execute(
+                'pragma compile_options;').fetchall()
+            if 'ENABLE_FTS5' in [opt['compile_options'] for opt 
+                                     in available_options]:
+                # sqlite supports FTS5 something else has gone wrong
+                raise
+            else:
+                # report a useful error message
+                raise  NotImplementedError(
+                    "This version of SQLite was not built with support "
+                    "for FTS5. SQLite version: %s" % sqlite.sqlite_version)
 
     def fix_version_6_tables(self):
         # note sqlite has no limit on column size so v6 fixes

Roundup Issue Tracker: http://roundup-tracker.org/