Skip to content

Commit 4ef379c

Browse files
authored
[X-0] batch_id -> batch_ids (#1133)
1 parent f9bcd45 commit 4ef379c

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

labelbox/schema/export_filters.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class SharedExportFilters(TypedDict):
3737

3838

3939
class ProjectExportFilters(SharedExportFilters):
40-
batch_id: Optional[str]
41-
""" Batch id to export
40+
batch_ids: Optional[List[str]]
41+
""" Batch ids to export
4242
Example:
43-
>>> "clgo3lyax0000veeezdbu3ws4"
43+
>>> ["clgo3lyax0000veeezdbu3ws4"]
4444
"""
4545

4646

@@ -183,11 +183,18 @@ def _get_timezone() -> str:
183183
"type": "data_row_id"
184184
})
185185

186-
batch_id = filters.get("batch_id")
187-
if batch_id:
186+
batch_ids = filters.get("batch_ids")
187+
if batch_ids:
188+
if not isinstance(batch_ids, list):
189+
raise ValueError("`batch_ids` filter expects a list.")
190+
if len(batch_ids) > MAX_DATA_ROW_IDS_PER_EXPORT_V2:
191+
raise ValueError(
192+
f"`batch_ids` filter only supports a max of {MAX_DATA_ROW_IDS_PER_EXPORT_V2} items."
193+
)
188194
search_query.append({
189-
"ids": [batch_id],
195+
"ids": batch_ids,
190196
"operator": "is",
191197
"type": "batch"
192198
})
199+
193200
return search_query

labelbox/schema/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def export_v2(self,
442442
"last_activity_at": None,
443443
"label_created_at": None,
444444
"data_row_ids": None,
445-
"batch_id": None,
445+
"batch_ids": None,
446446
})
447447

448448
mutation_name = "exportDataRowsInProject"

tests/integration/test_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_batch_project_export_v2(
5555
filters = {
5656
"last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
5757
"label_created_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
58-
"batch_id": batch.uid,
58+
"batch_ids": [batch.uid],
5959
}
6060
params = {
6161
"include_performance_details": True,

0 commit comments

Comments
 (0)