Skip to content

Commit 82c49cd

Browse files
authored
Merge branch 'master' into master
2 parents e5e781c + 52db59a commit 82c49cd

4 files changed

Lines changed: 27 additions & 0 deletions

File tree

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
3.13.0
22
======
33

4+
Features
5+
--------
6+
* cqlengine: LIKE filter operator (PYTHON-512)
7+
48
Bug Fixes
59
---------
610
* Support retry_policy in PreparedStatement (PYTHON-861)
711

12+
813
3.12.0
914
======
1015
November 6, 2017

cassandra/cqlengine/operators.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,8 @@ class LessThanOrEqualOperator(BaseWhereOperator):
9393
class ContainsOperator(EqualsOperator):
9494
symbol = "CONTAINS"
9595
cql_symbol = 'CONTAINS'
96+
97+
98+
class LikeOperator(EqualsOperator):
99+
symbol = "LIKE"
100+
cql_symbol = 'LIKE'

docs/cqlengine/queryset.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,21 @@ Filtering Operators
191191
192192
Note that we need to use allow_filtering() since the *options* column has no secondary index.
193193

194+
:attr:`LIKE (__like) <query.QueryOperator.LikeOperator>`
195+
196+
The LIKE operator is available for text columns that have a SASI secondary index.
197+
198+
.. code-block:: python
199+
200+
q = Automobile.objects.filter(model__like='%Civic%').allow_filtering()
201+
202+
Limitations:
203+
- Currently, cqlengine does not support SASI index creation. To use this feature,
204+
you need to create the SASI index using the core driver.
205+
- Queries using LIKE must use allow_filtering() since the *model* column has no
206+
standard secondary index. Note that the server will use the SASI index properly
207+
when executing the query.
208+
194209
TimeUUID Functions
195210
==================
196211

tests/integration/cqlengine/operators/test_where_operators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def check_lookup(symbol, expected):
3535
check_lookup('LT', LessThanOperator)
3636
check_lookup('LTE', LessThanOrEqualOperator)
3737
check_lookup('CONTAINS', ContainsOperator)
38+
check_lookup('LIKE', LikeOperator)
3839

3940
def test_operator_rendering(self):
4041
""" tests symbols are rendered properly """
@@ -46,5 +47,6 @@ def test_operator_rendering(self):
4647
self.assertEqual("<", six.text_type(LessThanOperator()))
4748
self.assertEqual("<=", six.text_type(LessThanOrEqualOperator()))
4849
self.assertEqual("CONTAINS", six.text_type(ContainsOperator()))
50+
self.assertEqual("LIKE", six.text_type(LikeOperator()))
4951

5052

0 commit comments

Comments
 (0)