graphenestorage.sqlite module

class graphenestorage.sqlite.SQLiteCommon

Bases: object

This class abstracts away common sqlite3 operations.

This class should not be used directly.

When inheriting from this class, the following instance members must be defined:

  • sqlite_file: Path to the SQLite Database file
sql_execute(query, lastid=False)
class graphenestorage.sqlite.SQLiteFile(*args, **kwargs)

Bases: object

This class ensures that the user’s data is stored in its OS preotected user directory:


  • ~/Library/Application Support/<AppName>


  • C:Documents and Settings<User>Application DataLocal Settings<AppAuthor><AppName>
  • C:Documents and Settings<User>Application Data<AppAuthor><AppName>


  • ~/.local/share/<AppName>

Furthermore, it offers an interface to generated backups in the backups/ directory every now and then.


The file name can be overwritten when providing a keyword argument profile.

sqlite_file = None

Ensure that the directory in which the data is stored exists

class graphenestorage.sqlite.SQLiteStore(*args, **kwargs)

Bases: graphenestorage.sqlite.SQLiteFile, graphenestorage.sqlite.SQLiteCommon, graphenestorage.interfaces.StoreInterface

The SQLiteStore deals with the sqlite3 part of storing data into a database file.


This module is limited to two columns and merely stores key/value pairs into the sqlite database

On first launch, the database file as well as the tables are created automatically.

When inheriting from this class, the following three class members must be defined:

  • __tablename__: Name of the table
  • __key__: Name of the key column
  • __value__: Name of the value column

Create the new table in the SQLite database


Delete a key from the store

Parameters:value (str) – Value

Check if the database table exists

get(key, default=None)

Return the key if exists or a default value

  • value (str) – Value
  • default (str) – Default value if key not present

returns all items off the store as tuples

keys() → a set-like object providing a view on D's keys

Wipe the store