Deta Base Python Async SDK
The Deta Base Python Async SDK can be used for reading and writing data asynchronously with Deta Base in Python.
warning
These are docs for an alpha version of the Python Deta Base Async SDK. The SDK API may change in a stable release.
#
Installing#
Instantiating#
MethodsThe AsyncBase
class offers the same API to interact with your Base as the Base
class:
#
Put- data (required): The data to be stored.
- key (optional): The key to store the data under. It will be auto-generated if not provided.
- expire_in (optional) - Accepts:
int
andNone
- Description: seconds after which the item will expire in, see also expiring items
- expire_at (optional) - Accepts:
int
,float
,datetime.datetime
andNone
- Description: time at which the item will expire in, can provide the timestamp directly(
int
orfloat
) or a datetime.datetime object, see also expiring items
- Description: time at which the item will expire in, can provide the timestamp directly(
#
Example#
Get- key (required): The key of the item to be retrieved.
#
Example#
Delete- key (required): The key of the item to delete.
#
Example#
Insertinsert
is unique from put
in that it will raise an error if the key
already exists in the database, whereas put
overwrites the item.
- data (required): The data to be stored.
- key (optional): The key to store the data under, will be auto generated if not provided.
- expire_in (optional) - Accepts:
int
andNone
- Description: seconds after which the item will expire in, see also expiring items
- expire_at (optional) - Accepts:
int
,float
,datetime.datetime
andNone
- Description: time at which the item will expire in, can provide the timestamp directly(
int
orfloat
) or a datetime.datetime object, see also expiring items
- Description: time at which the item will expire in, can provide the timestamp directly(
#
Example#
Put Many- items (required): list of items to be stored.
- expire_in (optional) - Accepts:
int
andNone
- Description: seconds after which the item will expire in, see also expiring items
- expire_at (optional) - Accepts:
int
,float
,datetime.datetime
andNone
- Description: time at which the item will expire in, can provide the timestamp directly(
int
orfloat
) or a datetime.datetime object, see also expiring items
- Description: time at which the item will expire in, can provide the timestamp directly(
#
Example#
Update- updates (required): A dict describing the updates on the item, refer to updates for more details.
- key (required): The key of the item to update.
- expire_in (optional) - Accepts:
int
andNone
- Description: seconds after which the item will expire in, see also expiring items
- expire_at (optional) - Accepts:
int
,float
,datetime.datetime
andNone
- Description: time at which the item will expire in, can provide the timestamp directly(
int
orfloat
) or a datetime.datetime object, see also expiring items
- Description: time at which the item will expire in, can provide the timestamp directly(
#
Example#
Fetchfetch(query=None, limit=1000, last=None)
- query : a query or a list of queries
- limit : the limit of the number of items you want to recieve, min value
1
if used. - last: the last key seen in a previous paginated response.
#
Example#
IssuesIf you run into any issues, consider reporting them in our Github Discussions. We also appreciate any feedback.