State Persistence

-

Burr provides a set of tools to make loading and saving state easy. These are functions +

Burr provides a set of tools to make loading and saving state easy. These are functions that will be used by lifecycle hooks to save and load state.

+

We currently support the following database integrations:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Burr Implemented Persisters

Database

Sync

Async

SQLite

sqlite3

SQLitePersister

aiosqlite

AsyncSQLitePersister

PostgreSQL

psycopg2

PostgreSQLPersister

asyncpg

AsyncPostgreSQLPersister

Redis

redis

RedisBasePersister

redis.asyncio

AsyncRedisBasePersister

MongoDB

pymongo

MongoDBBasePersister

+
+

We follow the naming convention b_dependency-library, where the b_ is used to avoid name +clashing with the underlying library. We chose the library name in case we implement the same database +persister with different dependency libraries to keep the class naming convention.

If you want to implement your own state persister (to bridge it with a database), you should implement -the BaseStatePersister interface.

+the BaseStatePersister or the AsyncBaseStatePersister interface.

class burr.core.persistence.BaseStatePersister
@@ -789,8 +830,8 @@

State Persistence

Supported Sync Implementations

-

Currently we support the following, although we highly recommend you contribute your own! We will be adding more shortly.

-
+

Currently we support the following, although we highly recommend you contribute your own! We will be adding more shortly.

+
class burr.core.persistence.SQLitePersister( @@ -799,6 +840,7 @@

Supported Sync Implementationstable_name: str = 'burr_state',