Yandex DB#
The Yandex DB module provides a version of the DBContextStorage
class that designed to work with
Yandex and other databases. Yandex DataBase is a fully-managed cloud-native SQL service that makes it easy to set up,
operate, and scale high-performance and high-availability databases for your applications.
The Yandex DB module uses the Yandex Cloud SDK, which is a python library that allows you to work with Yandex Cloud services using python. This allows Chatsky to easily integrate with the Yandex DataBase and take advantage of the scalability and high-availability features provided by the service.
- class YDBContextStorage(path, table_name='contexts', timeout=5)[source]#
Bases:
DBContextStorage
Version of the
DBContextStorage
for YDB.- Parameters:
path (
str
) – Standard sqlalchemy URI string. When using sqlite backend in Windows, keep in mind that you have to use double backslashes ‘' instead of forward slashes ‘/’ in the file path.table_name (
str
) – The name of the table to use.
- async set_item_async(key, value)[source]#
Asynchronous method for storing Context.
- Parameters:
key (
Hashable
) – Hashable key used to store Context instance.value (
Context
) – Context to store.
- async get_item_async(key)[source]#
Asynchronous method for accessing stored Context.
- Parameters:
key (
Hashable
) – Hashable key used to store Context instance.- Return type:
- Returns:
The stored context, associated with the given key.
- async del_item_async(key)[source]#
Asynchronous method for removing stored Context.
- Parameters:
key (
Hashable
) – Hashable key used to identify Context instance for deletion.
- async contains_async(key)[source]#
Asynchronous method for finding whether any Context is stored with given key.
- Parameters:
key (
Hashable
) – Hashable key used to check if Context instance is stored.- Return type:
bool
- Returns:
True if there is Context accessible by given key, False otherwise.