pyinterp.core.storage.unqlite.Database

class pyinterp.core.storage.unqlite.Database

Bases: pybind11_builtins.pybind11_object

Key/Value store

__init__(self: pyinterp.core.storage.unqlite.Database, name: str, mode: Optional[str] = None, compression_type: pyinterp.core.storage.unqlite.CompressionType = <CompressionType.snappy: 1>) None

Opening a database.

Parameters
  • name (str) – path to the target database file. If name is “:mem:” then a private, in-memory database is created.

  • mode (str, optional) –

    optional string that specifies the mode in which the database is opened. Default to r which means open for readind. The available mode are:

    Character

    Meaning

    'r'

    open for reading (default)

    'w'

    open for reading/writing. Create the database if needed

    'a'

    open for writing. Database file must be existing.

    'm'

    open in read-only memory view of the whole database

    Mode m works only in conjunction with r mode.

  • compression_mode (CompressionMode, optional) – Type of compression used to compress values stored into the database. Only has an effect for new data written in the database.

Methods

Database.clear(self)

Remove all entries from the database.

Database.commit(self)

Commit all changes to the database.

Database.error_log(self)

Reads the contents of the database error log.

Database.extend(self, map)

Extend or create the database with the key/value pairs from map

Database.items(self[, keys])

Return the dictionary's items ((key, value) pairs).

Database.keys(self)

Return a list containing all the keys from the database.

Database.rollback(self)

Rollback a write-transaction.

Database.update(self, map)

Update the database with the key/value pairs from map, overwriting" existing keys.

Database.values(self[, keys])

Read all values from the database for the keys provided

Database.__contains__(self, key)

Database.__delitem__(self, key)

Database.__getitem__(self, key)

Database.__getstate__(self)

Database.__len__(self)

Database.__setitem__(self, key, value)

Database.__setstate__(self, arg0)