File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ 3.22.0
2+ ======
3+ UNRELEASED
4+
5+ Features
6+ --------
7+ * Add all() function to the ResultSet API (PYTHON-1203)
8+
193.21.0
210======
311January 15, 2020
3139* Remove *read_repair_chance table options (PYTHON-1140)
3240* Avoid warnings about unspecified load balancing policy when connecting to a cloud cluster (PYTHON-1177)
3341* Add new DSE CQL keywords (PYTHON-1122)
42+ * Publish binary wheel distributions (PYTHON-1013)
3443
3544Deprecations
3645------------
Original file line number Diff line number Diff line change @@ -4934,6 +4934,15 @@ def current_rows(self):
49344934 """
49354935 return self ._current_rows or []
49364936
4937+ def all (self ):
4938+ """
4939+ Returns all the remaining rows as a list. This is basically
4940+ a convenient shortcut to `list(result_set)`.
4941+
4942+ This function is not recommended for queries that return a large number of elements.
4943+ """
4944+ return list (self )
4945+
49374946 def one (self ):
49384947 """
49394948 Return a single row of the results or None if empty. This is basically
Original file line number Diff line number Diff line change @@ -195,6 +195,13 @@ def test_one(self):
195195
196196 self .assertEqual (rs .one (), first )
197197
198+ def test_all (self ):
199+ first , second = Mock (), Mock ()
200+ rs1 = ResultSet (Mock (has_more_pages = False ), [first , second ])
201+ rs2 = ResultSet (Mock (has_more_pages = False ), [first , second ])
202+
203+ self .assertEqual (rs1 .all (), list (rs2 ))
204+
198205 @patch ('cassandra.cluster.warn' )
199206 def test_indexing_deprecation (self , mocked_warn ):
200207 # normally we'd use catch_warnings to test this, but that doesn't work
You can’t perform that action at this time.
0 commit comments