sqlite_backend
sqlite_backend ¶
AsyncSqliteBackend ¶
Bases: AsyncResultsBackend[T]
Async SQLite-based implementation of AsyncResultsBackend.
Uses aiosqlite for asynchronous database operations.
Initialize the AsyncSqliteBackend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db_path
|
Union[str, Path]
|
Path to the SQLite database file |
required |
create_if_missing
|
bool
|
Whether to create the database if it doesn't exist |
True
|
Source code in src/results_manager/async_backends/sqlite_backend.py
clear
async
¶
Asynchronously clear all stored results.
Source code in src/results_manager/async_backends/sqlite_backend.py
delete
async
¶
Asynchronously delete a result by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result_id
|
Union[str, List[str]]
|
Unique identifier or hierarchical path for the result |
required |
Returns:
Type | Description |
---|---|
bool
|
True if deleted, False if not found |
Source code in src/results_manager/async_backends/sqlite_backend.py
exists
async
¶
Asynchronously check if a result exists for the given ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result_id
|
Union[str, List[str]]
|
Unique identifier or hierarchical path for the result |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the result exists, False otherwise |
Source code in src/results_manager/async_backends/sqlite_backend.py
get
async
¶
get(
result_id: Union[str, List[str]],
model_class: Optional[Type[T]] = None,
namespace: Optional[str] = None,
) -> T
Asynchronously retrieve a result by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result_id
|
Union[str, List[str]]
|
Unique identifier or hierarchical path for the result |
required |
model_class
|
Optional[Type[T]]
|
Optional model class to validate against |
None
|
namespace
|
Optional[str]
|
Optional namespace to look in |
None
|
Returns:
Type | Description |
---|---|
T
|
Pydantic model instance |
Source code in src/results_manager/async_backends/sqlite_backend.py
list_ids
async
¶
Asynchronously list all result IDs, optionally filtered by a prefix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix
|
Union[str, List[str]]
|
Optional prefix path to filter results |
None
|
Returns:
Type | Description |
---|---|
List[str]
|
List of result IDs |
Source code in src/results_manager/async_backends/sqlite_backend.py
set
async
¶
set(
result_id: Union[str, List[str]],
data: BaseModel,
behavior: SetBehavior = RAISE_IF_EXISTS,
namespace: Optional[str] = None,
strict_namespace: bool = False,
) -> bool
Asynchronously store a result with the given ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result_id
|
Union[str, List[str]]
|
Unique identifier or hierarchical path for the result |
required |
data
|
BaseModel
|
Pydantic model instance to store |
required |
behavior
|
SetBehavior
|
How to handle existing data with the same ID |
RAISE_IF_EXISTS
|
namespace
|
Optional[str]
|
Optional namespace to store the model in |
None
|
strict_namespace
|
bool
|
If True, raises an error if model is in multiple namespaces |
False
|
Returns:
Type | Description |
---|---|
bool
|
True if data was written, False if skipped |
Source code in src/results_manager/async_backends/sqlite_backend.py
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 168 169 170 171 172 173 174 175 176 177 178 179 |
|