Create a backup of the current database to an sqlite database stored in a file.
The backupmechanism always considers the schema of the backed up database as the master, and never that of the backup. This means that when a backup is made, the backup file is first removed, and then filled with the tables from the the database to backup. When a restore is done, the schema of the database is not touched, but the tables are emptied and the data from the backup is copied into the existing schema.
Generator function that yields tuples : (numer_of_steps_completed, total_number_of_steps, description_of_current_step) while performing a backup.
Method used to filter which tables should be backed up, overwrite this method for taking into account specific schema issues.
From_table : | the table that is considered for backup |
---|---|
Returns: | True when the table should be backed up |
This method might be subclassed to turn off/on foreign key checks
This function converts column types from the source database to to column types in the backup database. This is needed when backing up from for example MySQL to SQLite, since column types differ between both databases. Overwrite this method to support different columns and/or database types.
Parameters: | from_type – the column type in the database that is backed up |
---|---|
Returns: | the corresponding column type in the back up database |
Returns: | a camelot.core.files.storage.Storage object |
---|
Returns the storage to be used to store default backups.
By default, this will return a Storage that puts the backup files in the DataLocation as specified by the QDesktopServices
Returns: | a string with the prefix for the default name of the backup file |
---|
By default this method returns ‘backup’, overwrite this method to return a custom string, like the name of the company or such.
This method will be called inside the model thread.
This method will be called before the actual restore starts. It allows bringing the schema at the same revision as the backed up data.
Generator function that yields tuples : (numer_of_steps_completed, total_number_of_steps, description_of_current_step) while performing a restore.
Method used to filter which tables should be restored, overwrite this method for taking into account specific schema issues. restore_table_filter is different from backup_table_filter, since we might want to store data in the backup that should not be restored, like schema version information.
From_table : | the table that is considered for backup |
---|---|
Returns: | True when the table should be restored |