Skip to content

Commit 9c3d0f9

Browse files
Update usage.md with append method for icechunk (#409)
* Update usage.md * Update usage.md
1 parent 92f04de commit 9c3d0f9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

docs/usage.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,27 @@ We can also write these references out as an [IcechunkStore](https://icechunk.io
431431
```python
432432
# create an icechunk repository, session and write the virtual dataset to the session
433433
from icechunk import Repository, Storage, VirtualChunkContainer, local_filesystem_storage
434-
storage = local_filesystem_storage(str('combined'))
434+
storage = local_filesystem_storage("./local/icechunk/store")
435435

436436
# By default, local virtual references and public remote virtual references can be read wihtout extra configuration.
437437
repo = Repository.create(storage=storage)
438438
session = repo.writeable_session("main")
439439

440440
# write the virtual dataset to the session with the IcechunkStore
441-
combined_vds.virtualize.to_icechunk(session.store)
441+
vds1.virtualize.to_icechunk(session.store)
442+
session.commit("Wrote first dataset")
443+
```
444+
445+
#### Append to an existing Icechunk Store
446+
447+
You can append a virtual dataset to an existing Icechunk store using the `append_dim` argument. This is especially useful for datasets that grow over time. Note that Zarr does not currently support concatenating datasets with different codecs or chunk shapes.
448+
449+
```python
450+
session = repo.writeable_session("main")
451+
452+
# write the virtual dataset to the session with the IcechunkStore
453+
vds2.virtualize.to_icechunk(session.store, append_dim="time")
454+
session.commit("Appended second dataset")
442455
```
443456

444457
See the [Icechunk documentation](https://icechunk.io/icechunk-python/virtual/#creating-a-virtual-dataset-with-virtualizarr) for more details.

0 commit comments

Comments
 (0)