Skip to content

Commit

Permalink
Correctly support element deletion in TileDB Cloud (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl authored Jul 12, 2022
1 parent dd09906 commit 657ef7f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions apis/python/src/tiledbsc/tiledb_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,19 @@ def _add_object(self, obj: TileDBObject, relative: Optional[bool] = None) -> Non
obj.uri = self._get_child_uri(obj.name)

def _remove_object(self, obj: TileDBObject) -> None:
with self._open("w") as G:
G.remove(obj.name)
self._remove_object_by_name(obj.name)

def _remove_object_by_name(self, member_name: str) -> None:
with self._open("w") as G:
G.remove(member_name)
if self.uri.startswith("tiledb://"):
mapping = self._get_member_names_to_uris()
if member_name not in mapping:
raise Exception(f"name {member_name} not present in group {self.uri}")
member_uri = mapping[member_name]
with self._open("w") as G:
G.remove(member_uri)
else:
with self._open("w") as G:
G.remove(member_name)

def _get_member_names(self) -> Sequence[str]:
"""
Expand Down

0 comments on commit 657ef7f

Please sign in to comment.