Repository: betodealmeida/shillelagh

Issue:
LIKE operator throws "No valid filter found"
Thanks for this wonderful library!

**Describe the bug**

LIKE operator throws "No valid filter found"

**To Reproduce**
Take the query from the README:

```
SELECT country, SUM(cnt)
FROM "https://docs.google.com/spreadsheets/d/1_rN3lm0R_bU3NemO0s9pbFkY5LQPcuy1pscv8ZXPtg8/edit#gid=0"
WHERE cnt > 0
GROUP BY country
```

Add a LIKE:

```
SELECT country, SUM(cnt)
FROM "https://docs.google.com/spreadsheets/d/1_rN3lm0R_bU3NemO0s9pbFkY5LQPcuy1pscv8ZXPtg8/edit#gid=0"
WHERE cnt > 0 AND country LIKE 'CR'
GROUP BY country
```

**Other info**:

In `get_bounds()`, `all_bounds` is something like:

```
defaultdict(<class 'set'>,
            {'country': {(<Operator.LT: '<'>, 'cru'),
                        (<Operator.GE: '>='>, 'CR'),
                        (<Operator.LIKE: 'LIKE'>, 'CR')}})
```

Discussion:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 2240b45..7ea20a8 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -5,6 +5,8 @@ Changelog
 Next
 ====
 
+- Fix unneeded error when an operators is not supported by adapter (#378)
+
 Version 1.2.6 - 2023-07-20
 ==========================
 
diff --git a/src/shillelagh/backends/apsw/vt.py b/src/shillelagh/backends/apsw/vt.py
index d2c583c..eb56ab8 100644
--- a/src/shillelagh/backends/apsw/vt.py
+++ b/src/shillelagh/backends/apsw/vt.py
@@ -257,9 +257,6 @@ def get_bounds(
             if all(operator in class_.operators for operator in operators):
                 bounds[column_name] = class_.build(operations)
                 break
-        else:
-            # pylint: disable=broad-exception-raised
-            raise Exception("No valid filter found")
 
     return bounds
 


Test patch:
diff --git a/tests/backends/apsw/vt_test.py b/tests/backends/apsw/vt_test.py
index 5ec8a1f..897690d 100644
--- a/tests/backends/apsw/vt_test.py
+++ b/tests/backends/apsw/vt_test.py
@@ -397,33 +397,33 @@ def test_cursor_with_constraints_invalid_filter() -> None:
 def test_cursor_with_constraints_no_filters() -> None:
     """
     Test passing a constraint to an adapter that cannot be filtered.
+
+    The filtering should be done by SQLite in this case.
     """
     table = VTTable(FakeAdapterNoFilters())
     cursor = table.Open()
-    with pytest.raises(Exception) as excinfo:
-        cursor.Filter(
-            42,
-            json.dumps({"indexes": [[1, 2]], "orderbys_to_process": []}),
-            ["Alice"],
-        )
-
-    assert str(excinfo.value) == "No valid filter found"
+    cursor.Filter(
+        42,
+        json.dumps({"indexes": [[1, 2]], "orderbys_to_process": []}),
+        ["Alice"],
+    )
+    assert cursor.current_row == (0, 20, "Alice", "0")
 
 
 def test_cursor_with_constraints_only_equal() -> None:
     """
     Test passing a constraint not supported by the adapter.
+
+    The filtering should be done by SQLite in this case.
     """
     table = VTTable(FakeAdapterOnlyEqual())
     cursor = table.Open()
-    with pytest.raises(Exception) as excinfo:
-        cursor.Filter(
-            42,
-            json.dumps({"indexes": [[1, 32]], "orderbys_to_process": []}),
-            ["Alice"],
-        )
-
-    assert str(excinfo.value) == "No valid filter found"
+    cursor.Filter(
+        42,
+        json.dumps({"indexes": [[1, 32]], "orderbys_to_process": []}),
+        ["Alice"],
+    )
+    assert cursor.current_row == (0, 20, "Alice", "0")
 
 
 def test_adapter_with_no_columns() -> None: