linotp.cli.dbsnapshot_cmd module

Database “snapshot” backup implementation.

The difference between this and the backup command in mysql_cmd.py is that backup uses the MySQL-specific mysqldump shell command, while this implementation uses SQLAlchemy’s object-dump facilities.

This means that backup can be used to make backups that can be restored on MySQL-based LinOTP instances of different versions, while dbsnapshot can be used to make backups that are independent of the actual database engine but can run into issues as the definitions of LinOTP objects evolve.

In other words, backup is probably more useful in daily life (as long as MySQL is your thing) but dbsnapshot lets you migrate your LinOTP instance from MySQL to PostgreSQL (for example).

linotp.cli.dbsnapshot_cmd.backup_database_tables() int

use the sqlalchemy serializer to dump the database mapped objects

linotp.cli.dbsnapshot_cmd.list_database_backups() list

find all backup files in the backup directory

@return list of backup dates

linotp.cli.dbsnapshot_cmd.restore_database_tables(filename: Optional[str] = None, date: Optional[str] = None, table: Optional[str] = None) int
restore the database tables from a file or for a given date

optionally restore only one table

@param filename - the absolute or relative backup file name @param date - find a backup file by date @param table - restore only one database table e.g. tokens