How do I unload a Vertica table to a flat file?

How do I use the COPY command to unload a Vertica table to a flat file?

Comments

  • You don't need to use a copy command to export data to a text file. You can export the data using vsql such as \o /tmp/export_data.txt select * from table; \o now the data is exported in export_data.txt or directly from Linux you can do # vsql -c "select * from table;" > /tmp/export_data.txt. Check the documentation for details in how to change delimiter, replace nulls, etc. Hope this helps, Eugenia
  • Thank you!! That really helps!!
  • Can you say more about your usecase for export to a flat file?
  • In our experience the only reliable way to get data out of Vertica in CSV or similar is to use a client (ODBC/JDBC) tool. VSQL works for most situations except when you have line breaks in your data etc. Produces data that can't be re-loaded.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file