diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index b6315dd..0bf93bd 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -2162,6 +2162,11 @@ class View(Queryable): def drop(self): self.db.execute("DROP VIEW [{}]".format(self.name)) + def enable_fts(self, *args, **kwargs): + raise NotImplementedError( + "enable_fts() is supported on tables but not on views" + ) + def chunks(sequence, size): iterator = iter(sequence) diff --git a/tests/test_fts.py b/tests/test_fts.py index 94650bf..a3efa54 100644 --- a/tests/test_fts.py +++ b/tests/test_fts.py @@ -369,6 +369,14 @@ def test_enable_fts_replace_does_nothing_if_args_the_same(): assert all(q[0].startswith("select ") for q in queries) +def test_enable_fts_error_message_on_views(): + db = Database(memory=True) + db.create_view("hello", "select 1 + 1") + with pytest.raises(NotImplementedError) as e: + db["hello"].enable_fts() + assert e.value.args[0] == "enable_fts() is supported on tables but not on views" + + @pytest.mark.parametrize( "kwargs,fts,expected", [