workingcopy

class igwn_ligolw.dbtables.workingcopy(filename, tmp_path=None, replace_file=False, discard=False, verbose=False)

Bases: object

Manage a working copy of an sqlite database file. This is used when a large enough number of manipulations are being performed on a database file that the total network I/O would be higher than that of copying the entire file to a local disk, doing the manipulations locally, then copying the file back. It is also useful in unburdening a file server when large numbers of read-only operations are being performed on the same file by many different machines.

Methods Summary

cpy(srcname, dstname[, attempts, verbose])

Copy a file to a destination preserving permission if possible.

set_temp_store_directory(connection)

Sets the temp_store_directory parameter in sqlite.

truncate(filename[, verbose])

Truncate a file to 0 size, ignoring all errors.

Methods Documentation

static cpy(srcname, dstname, attempts=5, verbose=False)

Copy a file to a destination preserving permission if possible. If the operation fails for a non-fatal reason then several attempts are made with a pause between each. The return value is dstname if the operation was successful or srcname if a non-fatal failure caused the operation to terminate. Fatal failures raise an exeption.

set_temp_store_directory(connection)

Sets the temp_store_directory parameter in sqlite.

static truncate(filename, verbose=False)

Truncate a file to 0 size, ignoring all errors. This is used internally to implement the “replace_file” feature.