oldTable = tempTable + "_" + str(int(time.time()))
cursor.execute("RENAME TABLE "+originalTable +" to " + oldTable + ", "+ tempTable + " to "+ originalTable)
print "Swapped the tables now"
print ("*"*20) + "PHASE 5 : Delta dump (data changed phase 3) " + ("*"*20)
deltaFile = "/mnt/hotswap/"+ tempTable + "_3.sql"
subprocess.call(secondaryDump + " --where 'id > "+ str(max_values["max_id"]) + " '> " + deltaFile , shell=True)
subprocess.call(secondaryDump + " --where '"+autoUpdateCol+" > \""+ str(max_values["max_time"]) + "\" AND id < "+str(max_values["max_id"])+ "' >> " + deltaFile , shell=True)
secondaryDump = "mysqldump -p"+ password +" -u "+ username+" " + dbname + " " + originalTable.replace(".", " ", 1) \
+ " --no-create-info --skip-tz-utc --complete-insert --compact --skip-comments --skip-lock-tables --replace " `
"mysqldump -p"+ password +" -u "+ username+" " + dbname + " " + oldTable.replace(".", " ", 1) \
+ " --no-create-info --skip-tz-utc --complete-insert --compact --skip-comments --skip-lock-tables --replace "