Skip to content

~.sqlite

SQLiteBackend

SQLiteBackend(
    filepath: Path | str,
    *,
    backup_interval: int = 0,
    batch_size: int = 100
)

Bases: Backend

Use SQLite as the persistent cache backend.

Create a new SQLite persistent backend.

PARAMETER DESCRIPTION
filepath

The path to the SQLite database file.

TYPE: Path | str

backup_interval

If > 0, the backend should use an in-memory database for performance while using the given filepath as a backup-and-restore database for persistence. This interval configures how often the in-memory database backs up into the file in seconds.

TYPE: int DEFAULT: 0

batch_size

The size of each batched SQL execution. Iterated reads and writes will occur in batches of this amount.

TYPE: int DEFAULT: 100

RAISES DESCRIPTION
ImportError

If aiosqlite is not installed.

TypeError
  • If filepath is not Path or str.
  • If backup_interval is not int.
  • If batch_size is not int.
ValueError
  • If backup_interval is less than 0.
  • If batch_size is less than 1.

VERSION class-attribute instance-attribute

VERSION: int = 1

The database schema version; updated for automatic migrations.

Warning

Automatic migrations will not occur until 1.0.0. Until then, each update requires a deletion of cache.