toyz.utils.db_interfaces package

Submodules

toyz.utils.db_interfaces.sqlite_interface module

Database interface to sqlite

toyz.utils.db_interfaces.sqlite_interface.check_user_type(param_type, params)

Set the user_type to either user_id or group_id depending on which parameter is contained in params. This allows a client to specify a group using either group_id='group_name' or user_id='group_name', user_type='group_id'.

Parameters
param_type ( string ):
  • Parameter from toyz.utils.db.param_formats used to identify how the parameter is stored
params ( dict ):
  • dictionary containing either a user_id or group_id key (other kwargs) may be included as well but have no affect on this function
toyz.utils.db_interfaces.sqlite_interface.create_toyz_database(db_settings)

Creates a new toyz database with all of the necessary tables needed.

See toyz.utils.db for more info.

toyz.utils.db_interfaces.sqlite_interface.delete_param(db_settings, param_type, wildcards=False, **params)

Delete a parameter entry from the database. See toyz.utils.db for more info.

toyz.utils.db_interfaces.sqlite_interface.delete_workspace(db_settings, user_id, work_id)
toyz.utils.db_interfaces.sqlite_interface.get_all_ids(db_settings, user_type)

Get all user_ids or group_ids depending on user_type.

See toyz.utils.db for more info.

toyz.utils.db_interfaces.sqlite_interface.get_db_info(db_settings)

Get db_info for the database (includes the Toyz version that created the DB, any updates made, and the current version of Toyz that the DB is configured for)

toyz.utils.db_interfaces.sqlite_interface.get_param(db_settings, param_type, wildcards=False, **params)

Get a parameter from the database. See toyz.utils.db for more info.

toyz.utils.db_interfaces.sqlite_interface.get_path_info(db_settings, path)

Get all of the users and permissions for a given path.

See toyz.utils.db for more info.

toyz.utils.db_interfaces.sqlite_interface.get_table_names(db_settings)

Get a list of all tables in the database.

Parameters
  • db_settings (*object( ): Database settings
Returns
tables (list): List of table names in the current database
toyz.utils.db_interfaces.sqlite_interface.get_workspace_sharing(db_settings, **kwargs)

Get shared workspace information

toyz.utils.db_interfaces.sqlite_interface.init(**params)

Because some databases might need to have their connections initialized, every database interface is require to have an init function, even if it is empty, that is called when the application is first opened

toyz.utils.db_interfaces.sqlite_interface.insert_ws_row(db, user_id, work_id, row)
toyz.utils.db_interfaces.sqlite_interface.update_all_params(db_settings, param_type, **params)

Update all parameters. See toyz.utils.db for more info.

toyz.utils.db_interfaces.sqlite_interface.update_param(db_settings, param_type, **params)

Update a parameter. See toyz.utils.db for more info.

toyz.utils.db_interfaces.sqlite_interface.update_version(db_settings, params)

Update the database when a Toyz version changes (if necessary). At the time params is a dictionary that requires the keys ‘toyz_version’ and ‘db_version’, the versions of the Toyz instance and database respectively. In the future, updates to the DB may require other parameters.

toyz.utils.db_interfaces.sqlite_interface.update_workspace(db_settings, user_id, work_id, update_all=True, **kwargs)

Update sharing for a workspace

Module contents

Common non-package specific utility functions