From fb5022199461e3b5b6aed22bcec132e470f3cc43 Mon Sep 17 00:00:00 2001 From: Ryan Abernathey Date: Mon, 14 Oct 2024 10:21:45 -0400 Subject: [PATCH] update quickstart and add configuration (#210) --- docs/docs/icechunk-python/configuration.md | 5 +++ docs/docs/icechunk-python/quickstart.md | 44 ++++++++++++++++++---- docs/mkdocs.yml | 1 + 3 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 docs/docs/icechunk-python/configuration.md diff --git a/docs/docs/icechunk-python/configuration.md b/docs/docs/icechunk-python/configuration.md new file mode 100644 index 00000000..a15f032d --- /dev/null +++ b/docs/docs/icechunk-python/configuration.md @@ -0,0 +1,5 @@ +# Configuration + +## Storage Config + +## Creating and Opening Repos \ No newline at end of file diff --git a/docs/docs/icechunk-python/quickstart.md b/docs/docs/icechunk-python/quickstart.md index 5143b59f..64de5b83 100644 --- a/docs/docs/icechunk-python/quickstart.md +++ b/docs/docs/icechunk-python/quickstart.md @@ -27,13 +27,18 @@ However, you can also create a store on your local filesystem. === "S3 Storage" ```python - # TODO + storage_config = icechunk.StorageConfig.s3_from_env( + bucket="icechunk-test", + prefix="quickstart-demo-1" + ) + store = await icechunk.IcechunkStore.create(storage_config) ``` === "Local Storage" ```python - # TODO + storage_config = icechunk.StorageConfig.filesystem("./icechunk-local") + store = await icechunk.IcechunkStore.create(storage_config) ``` ## Write some data and commit @@ -71,14 +76,39 @@ array[:5] = 2 ...and commit the changes -``` +```python await store.commit("overwrite some values") ``` -### Explore version history +## Explore version history -We can now see both versions of our array +We can see the full version history of our repo: ```python -# TODO: use ancestors -``` \ No newline at end of file +hist = [anc async for anc in store.ancestry()] +for anc in hist: + print(anc.id, anc.message, anc.written_at) + +# Output: +# AHC3TSP5ERXKTM4FCB5G overwrite some values 2024-10-14 14:07:27.328429+00:00 +# Q492CAPV7SF3T1BC0AA0 first commit 2024-10-14 14:07:26.152193+00:00 +# T7SMDT9C5DZ8MP83DNM0 Repository initialized 2024-10-14 14:07:22.338529+00:00 +``` + +...and we can go back in time to the earlier version. + +```python +# latest version +assert array[0] == 2 +# check out earlier snapshot +await store.checkout(snapshot_id=hist[1].id) +# verify data matches first version +assert array[0] == 1 +``` + +--- + +That's it! You now know how to use Icechunk! +For your next step, dig deeper into [configuration](./configuration.md), +explore the [version control system](./version-control.md), or learn how to +[use Icechunk with Xarray](./xarray.md). \ No newline at end of file diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 15e6ac1d..c44ed405 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -139,6 +139,7 @@ nav: - FAQ: faq.md - Icechunk Python: - icechunk-python/quickstart.md + - icechunk-python/configuration.md - icechunk-python/xarray.md - icechunk-python/version-control.md - Virtual Datasets: icechunk-python/virtual.md