from obstore.auth.planetary_computer import PlanetaryComputerCredentialProvider
from obstore.store import AzureStore
import pystac_client
catalog = pystac_client.Client.open(
"https://planetarycomputer.microsoft.com/api/stac/v1/"
)
asset = catalog.get_collection("io-lulc-9-class").assets["geoparquet-items"]
account_name = asset.extra_fields["table:storage_options"]
credential_provider = PlanetaryComputerCredentialProvider(
url=asset.href,
account_name=account_name,
)
store = AzureStore(credential_provider=credential_provider)
This gives a confusing error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[16], line 6
1 account_name = asset.extra_fields["table:storage_options"]
2 credential_provider = PlanetaryComputerCredentialProvider(
3 url=asset.href,
4 account_name=account_name,
5 )
----> 6 store = AzureStore(credential_provider=credential_provider)
TypeError: argument 'credential_provider': 'dict' object cannot be converted to 'PyString'
It's because
credential_provider.config
# {'account_name': {'account_name': 'pcstacitems'}, 'container_name': 'items'}
we should have validation that account_name is a str
This gives a confusing error
It's because
we should have validation that
account_nameis a str