def dump_database(id):
tmp_dir = tempfile.mkdtemp()<EOL>current_dir = os.getcwd()<EOL>os.chdir(tmp_dir)<EOL>FNULL = open(os.devnull, "<STR_LIT:w>")<EOL>heroku_app = HerokuApp(dallinger_uid=id, output=FNULL)<EOL>heroku_app.backup_capture()<EOL>heroku_app.backup_download()<EOL>for filename in os.listdir(tmp_dir):<EOL><INDENT>if filename.startswith("<STR_LIT>"):<EOL><INDENT>os.rename(filename, "<STR_LIT>")<EOL><DEDENT><DEDENT>os.chdir(current_dir)<EOL>return os.path.join(tmp_dir, "<STR_LIT>")<EOL>
Dump the database to a temporary directory.