universal_pathlib icon indicating copy to clipboard operation
universal_pathlib copied to clipboard

How to get the storage account name with AzurePath?

Open Alex0x4b opened this issue 11 months ago • 1 comments

Version:

  • Python 3.10.13
  • universal_pathlib==0.2.6

The following

UPath('abfs://container_name@storage_account_name.dfs.core.windows.net/')

return AzurePath('abfs://container_name/')

How to get the AzurePath with storage account?

Alex0x4b avatar Apr 01 '25 14:04 Alex0x4b

it's parsed as your account name and available in storage_options

>>> import upath
>>> p = upath.UPath("abfs://container_name@storage_account_name.dfs.core.windows.net/")
>>> p
AzurePath('abfs://container_name/')
>>> p.protocol
'abfs'
>>> p.path
'container_name/'
>>> p.storage_options
mappingproxy({'account_name': 'storage_account_name'})

ap-- avatar Apr 01 '25 14:04 ap--