Skip to content

Commit 7ddb29c

Browse files
authored
Merge pull request #195 from dataiku/perso/dss10-sc68952-add-multiple-flow-zone
[sc-68952] Add items to zone by batch
2 parents c95e7ce + e3b11ea commit 7ddb29c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dataikuapi/dss/flow.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,22 @@ def add_item(self, obj):
338338
self._raw = self.client._perform_json("POST", "/projects/%s/flow/zones/%s/items" % (self.flow.project.project_key, self.id),
339339
body=self.flow._to_smart_ref(obj))
340340

341+
def add_items(self, items):
342+
"""
343+
Adds items to this zone.
344+
345+
The items will automatically be moved from their existing zones. Additional items may be moved to this zone
346+
as a result of the operations (notably the recipe generating the `items`).
347+
348+
:param list items: A list of objects, either :class:`dataikuapi.dss.dataset.DSSDataset`, :class:`dataikuapi.dss.managedfolder.DSSManagedFolder`,
349+
or :class:`dataikuapi.dss.savedmodel.DSSSavedModel` to add to the zone
350+
"""
351+
smart_refs = []
352+
for item in items:
353+
smart_refs.append(self.flow._to_smart_ref(item))
354+
self._raw = self.client._perform_json("POST", "/projects/%s/flow/zones/%s/add-items" % (self.flow.project.project_key, self.id),
355+
body=smart_refs)
356+
341357
@property
342358
def items(self):
343359
"""

0 commit comments

Comments
 (0)