gws.plugin.storage_provider.sqlite

SQLite storage provider.

The sqlite storage provider keeps saved user entries in an SQLite database file, by default storage8.sqlite in the GWS misc directory. The storage table is created on first use. Each entry is a row keyed by category and name, with the serialized data, the UID of the user who wrote it, and the creation and update timestamps.

Example:

storage {
    providers+ {
        type "sqlite"
        path "/data/storage.sqlite"
    }
}

Source code: gws.plugin.storage_provider.sqlite

Package Contents

class gws.plugin.storage_provider.sqlite.Config(*args, **kwargs)

Bases: gws.Config

Storage provider that keeps saved user data in an SQLite file.

path: str | None

Database file.

class gws.plugin.storage_provider.sqlite.Object

Bases: gws.StorageProvider

Storage provider backed by an SQLite database file.

dbPath: str

Path to the database file.

table = 'storage'

Name of the table that holds the entries.

configure()

Configuration hook.

Called when the node is initialized. Raising an exception here aborts the creation of the node.

delete(category, name)

Delete a record.

Parameters:
  • category – Category name.

  • name – Record name.

list_names(category)

List the record names in a category.

Parameters:

category – Category name.

Returns:

Record names.

read(category, name)

Read a record.

Parameters:
  • category – Category name.

  • name – Record name.

Returns:

The record, or None if not found.

write(category, name, data, user_uid)

Create a record or update an existing one.

Parameters:
  • category – Category name.

  • name – Record name.

  • data – Serialized record data.

  • user_uid – Uid of the user who writes the record.