def duplicateDB(oldDB, newDB):
    con = sqlite3.connect(oldDB)
script = ''.join(con.iterdump())
con.close()
con = sqlite3.connect(newDB)
con.executescript(script)
con.close()
print('duplicated %s into %s' % (oldDB, newDB))
Dump data from malformed SQLite in Python