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

Documentation on how to access Azure stores #92

Open
caiostringari opened this issue Apr 24, 2024 · 2 comments
Open

Documentation on how to access Azure stores #92

caiostringari opened this issue Apr 24, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@caiostringari
Copy link

I am trying to use zappend to append to an Azure data store. However, I cannot figure out what the configuration should be for that case.

What I tried so far:

config = {
    "target_dir": "https://mystore.blob.core.windows.net/mycontainer/myfile.zarr",
    "target_storage_options": {
       "account_name": "name",
       "account_key": "key",
    }
}
zappend(ds_code, append_dim="time", config=config)

This fails with TypeError: ClientSession._request() got an unexpected keyword argument 'account_name'

I also tried:

from azure.storage.blob import ContainerClient
container_client = ContainerClient.from_connection_string(conn_str="my_string", container_name="mycontainer")        
# store = zarr.ABSStore(client=container_client, prefix = "myfile.zarr")  this works

config = {
    "target_dir": "https://mystore.blob.core.windows.net/mycontainer/myfile.zarr",
    "target_storage_options": {
        "client": container_client,
    }
}
zappend(my_dataset, append_dim="time", config=config)

This fails with TypeError: ClientSession._request() got an unexpected keyword argument 'client'

It would be nice to have it in documentation how you access datastores other local data and S3.

Thank you

@caiostringari caiostringari added the enhancement New feature or request label Apr 24, 2024
@forman
Copy link
Member

forman commented May 28, 2024

@caiostringari, sorry I missed your report! I agree, it would be good to give examples for other common datastores.

As you can see from the code, zappend passes target_storage_options directly to the underlying data store. Therefore the valid keyword arguments are prescribed by the specific fsspec filesystem implementation. Look here for Azure:
https://github.com/fsspec/adlfs?tab=readme-ov-file#details

@okz
Copy link

okz commented Jun 11, 2024

Hi, to add @forman's note, I don't think a https:// would correctly get decoded as an azure path.

the following configuration patterns worked for me

target_dir: az://<blob-name>/target2.zarr
target_storage_options:
  account_name: <account-name>
  sas_token: st=2024-##-#xxxxxxxxxxxxxxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants