public class LanceNamespaceStorageOptionsProvider extends Object implements StorageOptionsProvider
This provider automatically fetches fresh storage options by calling the namespace's describeTable() method, which returns both the table location and time-limited storage options. This is currently only used for refreshing AWS temporary access credentials.
This is the recommended approach for LanceDB Cloud and other namespace-based deployments, as it handles storage options refresh automatically.
// Connect to a namespace (e.g., LanceDB Cloud)
LanceNamespace namespace = LanceNamespaces.connect("rest", Map.of(
"url", "https://api.lancedb.com",
"api_key", "your-api-key"
));
// Create storage options provider
LanceNamespaceStorageOptionsProvider provider = new LanceNamespaceStorageOptionsProvider(
namespace,
Arrays.asList("workspace", "table_name")
);
// Use with dataset - storage options auto-refresh!
Dataset dataset = Dataset.open(
"s3://bucket/table.lance",
new ReadOptions.Builder()
.setStorageOptionsProvider(provider)
.build()
);
| Constructor and Description |
|---|
LanceNamespaceStorageOptionsProvider(com.lancedb.lance.namespace.LanceNamespace namespace,
List<String> tableId)
Create a storage options provider that fetches storage options from a LanceNamespace.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,String> |
fetchStorageOptions()
Fetch credentials from the namespace.
|
String |
providerId()
Return a human-readable unique identifier for this provider instance.
|
public LanceNamespaceStorageOptionsProvider(com.lancedb.lance.namespace.LanceNamespace namespace,
List<String> tableId)
namespace - The namespace instance to fetch storage options fromtableId - The table identifier (e.g., ["workspace", "table_name"])public Map<String,String> fetchStorageOptions()
This calls namespace.describeTable() to get the latest credentials and their expiration time.
fetchStorageOptions in interface StorageOptionsProviderRuntimeException - if the namespace doesn't return storage credentials or expiration timepublic String providerId()
This creates a semantic ID based on the namespace's ID and the table ID, enabling proper equality comparison and caching.
providerId in interface StorageOptionsProviderCopyright © 2025. All rights reserved.