change mode to format; db -> connection, to_csv -> csv