Skip to content

[X-0] batch_id -> batch_ids #1133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions labelbox/schema/export_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class SharedExportFilters(TypedDict):


class ProjectExportFilters(SharedExportFilters):
batch_id: Optional[str]
""" Batch id to export
batch_ids: Optional[List[str]]
""" Batch ids to export
Example:
>>> "clgo3lyax0000veeezdbu3ws4"
>>> ["clgo3lyax0000veeezdbu3ws4"]
"""


Expand Down Expand Up @@ -183,11 +183,18 @@ def _get_timezone() -> str:
"type": "data_row_id"
})

batch_id = filters.get("batch_id")
if batch_id:
batch_ids = filters.get("batch_ids")
if batch_ids:
if not isinstance(batch_ids, list):
raise ValueError("`batch_ids` filter expects a list.")
if len(batch_ids) > MAX_DATA_ROW_IDS_PER_EXPORT_V2:
raise ValueError(
f"`batch_ids` filter only supports a max of {MAX_DATA_ROW_IDS_PER_EXPORT_V2} items."
)
search_query.append({
"ids": [batch_id],
"ids": batch_ids,
"operator": "is",
"type": "batch"
})

return search_query
2 changes: 1 addition & 1 deletion labelbox/schema/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def export_v2(self,
"last_activity_at": None,
"label_created_at": None,
"data_row_ids": None,
"batch_id": None,
"batch_ids": None,
})

mutation_name = "exportDataRowsInProject"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_batch_project_export_v2(
filters = {
"last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
"label_created_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
"batch_id": batch.uid,
"batch_ids": [batch.uid],
}
params = {
"include_performance_details": True,
Expand Down