DynamoDBBackend
AWS DynamoDB result backend.
Attributes
| Attribute | Type | Description |
|---|---|---|
| table_name | string = celery | default DynamoDB table name (default) |
| read_capacity_units | int = 1 | Read Provisioned Throughput (default) |
| write_capacity_units | int = 1 | Write Provisioned Throughput (default) |
| aws_region | string = null | AWS region (default) |
| endpoint_url | string = null | The endpoint URL that is passed to boto3 (local DynamoDB) (default) |
| time_to_live_seconds | int = null | Item time-to-live in seconds (default) |
| supports_autoexpire | boolean = true | Indicates that DynamoDB supports Time to Live as an auto-expiry mechanism. |
| implements_incr | boolean = true | Indicates that the backend supports atomic increment operations for chord functionality. |
Constructor
Signature
def DynamoDBBackend(
url: str = null,
table_name: str = null,
*args: any = null,
**kwargs: any = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| url | str = null | The connection URL containing configuration details like region, credentials, and table name. |
| table_name | str = null | The name of the DynamoDB table to use for storing results. |
| *args | any = null | Variable length argument list passed to the parent class. |
| **kwargs | any = null | Arbitrary keyword arguments passed to the parent class. |
Methods
client()
@classmethod
def client() - > botocore.client.DynamoDB
Provides access to the underlying Boto3 DynamoDB client, initializing it if necessary.
Returns
| Type | Description |
|---|---|
botocore.client.DynamoDB | The active DynamoDB client instance |
get()
@classmethod
def get(
key: any
) - > bytes | null
Retrieves the value associated with a specific key from the DynamoDB table.
Parameters
| Name | Type | Description |
|---|---|---|
| key | any | The key used to look up the stored result |
Returns
| Type | Description |
|---|---|
| `bytes | null` |
set()
@classmethod
def set(
key: any,
value: bytes
) - > null
Stores a value in the DynamoDB table for a given key, including a timestamp and optional TTL.
Parameters
| Name | Type | Description |
|---|---|---|
| key | any | The key under which the value will be stored |
| value | bytes | The binary data to store |
Returns
| Type | Description |
|---|---|
null | null |
mget()
@classmethod
def mget(
keys: list
) - > list
Retrieves multiple values from the backend for a list of provided keys.
Parameters
| Name | Type | Description |
|---|---|---|
| keys | list | A collection of keys to retrieve |
Returns
| Type | Description |
|---|---|
list | A list of binary values corresponding to the input keys |
delete()
@classmethod
def delete(
key: any
) - > null
Removes the item associated with the specified key from the DynamoDB table.
Parameters
| Name | Type | Description |
|---|---|---|
| key | any | The key of the item to be deleted |
Returns
| Type | Description |
|---|---|
null | null |
incr()
@classmethod
def incr(
key: bytes
) - > int
Atomically increase the chord_count and return the new count
Parameters
| Name | Type | Description |
|---|---|---|
| key | bytes | The key identifying the counter to increment |
Returns
| Type | Description |
|---|---|
int | The new integer value of the counter after incrementing |