earth-mover / icechunk

Open-source, cloud-native transactional tensor storage engine
https://icechunk.io
Apache License 2.0
291 stars 17 forks source link

[Bug] readonly kwarg not respected #404

Open TomNicholas opened 19 hours ago

TomNicholas commented 19 hours ago

_from @abarciauskas-bgse in https://github.com/zarr-developers/VirtualiZarr/pull/272#discussion_r1852564923_

It doesn't look like the read_only property is working as I would expect it to in the latest released version of icechunk (0.1.0a4):

from icechunk import IcechunkStore, StorageConfig
config = StorageConfig.filesystem("local")

store = IcechunkStore.create(storage=config, read_only=False)
print(store.mode)
# AccessMode(str='w', readonly=False, overwrite=True, create=True, update=False)

store = IcechunkStore.open_existing(storage=config)
print(store.mode) 
# AccessMode(str='r', readonly=True, overwrite=False, create=False, update=False)

store = IcechunkStore.open_existing(storage=config, read_only=False) 
print(store.mode)
# AccessMode(str='r', readonly=True, overwrite=False, create=False, update=False)

store = IcechunkStore.open_existing(storage=config, mode="a")
print(store.mode)
# AccessMode(str='a', readonly=False, overwrite=False, create=True, update=True)

store = IcechunkStore.open_existing(storage=config, mode="w")
print(store.mode)
# AccessMode(str=w', readonly=False, overwrite=True, create=True, update=False)

store = IcechunkStore.open_existing(storage=config, update=True)
print(store.mode)
# AccessMode(str='r', readonly=True, overwrite=False, create=False, update=False)

I note from the above that the only way to open the icechunk store in append mode is still using mode="a"

mpiannucci commented 18 hours ago

The latest version of icechunk still uses mode. The main branch uses read_only. We are not releasing the next version until #357 is merged.