Skip to content

Commit cc8eed7

Browse files
authored
[AL-6294] | Bug Fix | Support for setting a 'from cursor for dataset.data_rows() (#1185)
2 parents 888db37 + 87567fe commit cc8eed7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

labelbox/pagination.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class _CursorPagination(_Pagination):
134134
def __init__(self, cursor_path: List[str], *args, **kwargs):
135135
super().__init__(*args, **kwargs)
136136
self.cursor_path = cursor_path
137-
self.next_cursor: Optional[Any] = None
137+
self.next_cursor: Optional[Any] = kwargs.get('params', {}).get('from')
138138

139139
def increment_page(self, results: Dict[str, Any]):
140140
for path in self.cursor_path:

tests/integration/test_data_rows.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ def test_data_row_bulk_creation(dataset, rand_gen, image_url):
173173
assert {data_row.row_data for data_row in data_rows} == {image_url}
174174
assert {data_row.global_key for data_row in data_rows} == {None}
175175

176+
data_rows = list(dataset.data_rows(from_cursor=data_rows[0].uid))
177+
assert len(data_rows) == 1
178+
176179
# Test creation using file name
177180
with NamedTemporaryFile() as fp:
178181
data = rand_gen(str).encode()

0 commit comments

Comments
 (0)