Skip to content

Commit aa84c8a

Browse files
authored
pass datasetId in request body (#374)
1 parent 6779b9a commit aa84c8a

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to the [Nucleus Python Client](https://github.com/scaleapi/n
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
9+
## [0.14.28](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.14.28) - 2022-11-17
10+
11+
### Added
12+
- Support for appending to slice with Scene reference IDs
13+
- Better error handling when appending to a slice with non-existent reference IDs
14+
15+
816
## [0.14.27](https://github.com/scaleapi/nucleus-python-client/releases/tag/v0.14.27) - 2022-11-04
917

1018
### Added

nucleus/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,22 +869,25 @@ def append_to_slice(
869869
self,
870870
slice_id: str,
871871
reference_ids: List[str],
872+
dataset_id: str,
872873
) -> dict:
873874
# TODO: migrate to Slice method and deprecate
874-
"""Appends dataset items to an existing slice.
875+
"""Appends dataset items or scenes to an existing slice.
875876
876877
Parameters:
877878
slice_id: Nucleus-generated dataset ID (starts with ``slc_``). This can
878879
be retrieved via :meth:`Dataset.slices` or a Nucleus dashboard URL.
879-
reference_ids: List of user-defined reference IDs of the dataset items
880+
reference_ids: List of user-defined reference IDs of dataset items or scenes
880881
to append to the slice.
882+
dataset_id: ID of dataset this slice belongs to.
881883
882884
Returns:
883885
Empty payload response.
884886
"""
885887

886888
response = self.make_request(
887-
{REFERENCE_IDS_KEY: reference_ids}, f"slice/{slice_id}/append"
889+
{REFERENCE_IDS_KEY: reference_ids, DATASET_ID_KEY: dataset_id},
890+
f"slice/{slice_id}/append",
888891
)
889892
return response
890893

nucleus/slice.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ def append(
319319
at upload time.
320320
321321
Parameters:
322-
reference_ids: A list of user-specified IDs for DatasetItems you wish
323-
to append.
322+
reference_ids: List of user-defined reference IDs of dataset items or scenes
323+
to append to the slice.
324324
325325
Returns:
326-
Dict of the slice_id and the newly appended DatasetItem IDs. ::
326+
Dict of the slice_id and the newly appended IDs. ::
327327
328328
{
329329
"slice_id": str,
@@ -333,6 +333,7 @@ def append(
333333
response = self._client.append_to_slice(
334334
slice_id=self.id,
335335
reference_ids=reference_ids,
336+
dataset_id=self.dataset_id,
336337
)
337338
return response
338339

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exclude = '''
2121

2222
[tool.poetry]
2323
name = "scale-nucleus"
24-
version = "0.14.27"
24+
version = "0.14.28"
2525
description = "The official Python client library for Nucleus, the Data Platform for AI"
2626
license = "MIT"
2727
authors = ["Scale AI Nucleus Team <nucleusapi@scaleapi.com>"]

0 commit comments

Comments
 (0)