Skip to content
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

Buggy del sdata.table #222

Closed
LucaMarconato opened this issue Apr 11, 2023 · 2 comments · Fixed by #455
Closed

Buggy del sdata.table #222

LucaMarconato opened this issue Apr 11, 2023 · 2 comments · Fixed by #455

Comments

@LucaMarconato
Copy link
Member

After the planned io refactoring this problem will disappear. So not fixing this bug now, just tracking that we know it exists.

Currently if we try to delete a table we may get an error like this:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[73], line 1
----> 1 del sdata_patient1_visium.table

File ~/embl/projects/basel/spatialdata/src/spatialdata/_core/spatialdata.py:1090, in SpatialData.table(self)
   1088 store = parse_url(self.path, mode="r+").store
   1089 root = zarr.group(store=store)
-> 1090 del root["table/table"]

File ~/miniconda3/envs/ome/lib/python3.10/site-packages/zarr/hierarchy.py:464, in Group.__delitem__(self, item)
    463 def __delitem__(self, item):
--> 464     return self._write_op(self._delitem_nosync, item)

File ~/miniconda3/envs/ome/lib/python3.10/site-packages/zarr/hierarchy.py:895, in Group._write_op(self, f, *args, **kwargs)
    892     lock = self._synchronizer[group_meta_key]
    894 with lock:
--> 895     return f(*args, **kwargs)

File ~/miniconda3/envs/ome/lib/python3.10/site-packages/zarr/hierarchy.py:472, in Group._delitem_nosync(self, item)
    470     rmdir(self._store, path)
    471 else:
--> 472     raise KeyError(item)

KeyError: 'table/table'
@LucaMarconato
Copy link
Member Author

This happens if sdata.table = table fails (for instance in this case #221) and then we call del sdata.table on it.

@LucaMarconato
Copy link
Member Author

Closed by the multi-table PR #455 since it just deletes the table in-memory and not from disk.

@LucaMarconato LucaMarconato linked a pull request Feb 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant