S3
S3DBKVStore #
Bases: BaseKVStore
S3 Key-Value store. Stores key-value pairs in a S3 bucket. Can optionally specify a path to a folder where KV data is stored. The KV data is further divided into collections, which are subfolders in the path. Each key-value pair is stored as a JSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s3_bucket
|
Any
|
boto3 S3 Bucket instance |
required |
path
|
Optional[str]
|
path to folder in S3 bucket where KV data is stored |
'./'
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
from_s3_location
classmethod
#
from_s3_location(bucket_name: str, path: Optional[str] = None) -> S3DBKVStore
Load a S3DBKVStore from a S3 URI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket_name
|
str
|
S3 bucket name |
required |
path
|
Optional[str]
|
path to folder in S3 bucket where KV data is stored |
None
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
put #
put(key: str, val: dict, collection: str = DEFAULT_COLLECTION) -> None
Put a key-value pair into the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
key |
required |
val
|
dict
|
value |
required |
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
aput
async
#
aput(key: str, val: dict, collection: str = DEFAULT_COLLECTION) -> None
Put a key-value pair into the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
key |
required |
val
|
dict
|
value |
required |
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
get #
get(key: str, collection: str = DEFAULT_COLLECTION) -> Optional[dict]
Get a value from the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
key |
required |
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
aget
async
#
aget(key: str, collection: str = DEFAULT_COLLECTION) -> Optional[dict]
Get a value from the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
key |
required |
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
105 106 107 108 109 110 111 112 113 114 115 |
|
get_all #
get_all(collection: str = DEFAULT_COLLECTION) -> Dict[str, dict]
Get all values from the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
aget_all
async
#
aget_all(collection: str = DEFAULT_COLLECTION) -> Dict[str, dict]
Get all values from the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
134 135 136 137 138 139 140 141 |
|
delete #
delete(key: str, collection: str = DEFAULT_COLLECTION) -> bool
Delete a value from the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
key |
required |
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
adelete
async
#
adelete(key: str, collection: str = DEFAULT_COLLECTION) -> bool
Delete a value from the store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
key |
required |
collection
|
str
|
collection name |
DEFAULT_COLLECTION
|
Source code in llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-s3/llama_index/storage/kvstore/s3/base.py
159 160 161 162 163 164 165 166 167 |
|