def _estimate_legacy_size(self, db): try: connection = get_connection(self.config, db) size = legacy_get_db_size(db, connection) connection.close() return size except dbapi.DatabaseError, exc: raise BackupError("Failed to estimate database size for %s: %s" % (db, exc))
def __init__(self, name, config, target_directory, dry_run=False): """Create a new PgDump instance :param name: unique name of this backup (e.g. pg_dump/20100101_000000) :param target_directory: where backup files should be stored :param dry_run: boolean flag indicating whether we should only go through the motions of a backup without actually performing the heavy weight steps. """ self.name = name self.config = config self.target_directory = target_directory self.dry_run = dry_run self.config.validate_config(CONFIGSPEC) self.connection = get_connection(self.config) self.databases = pg_databases(self.config, self.connection) LOG.info("Found databases: %s", ','.join(self.databases))