Exporting to Parquet: Quick Tip

Posted August 29, 2018 by Phil Molea, Sr. Information Developer, Vertica

Jim Knicely authored this tip. Vertica can export a table, columns from a table, or query results to files in the Parquet format. Example: dbadmin=> SELECT * FROM dim; c2 | c3 ----+------ 1 | TEST (1 row) dbadmin=> EXPORT TO PARQUET (directory = ‘/home/dbadmin/dim’) AS SELECT * FROM dim; Rows Exported ————— 1 (1 row) One restriction is the path to export must not exist. dbadmin=> EXPORT TO PARQUET (directory = '/home/dbadmin/dim') AS SELECT * FROM dim; ERROR 8193: Directory [/home/dbadmin/dim/] exists. Please remove it or specify another directory How do I get around that? Remove the directory prior to exporting! dbadmin=> \! rm -fr /home/dbadmin/dim dbadmin=> EXPORT TO PARQUET (directory = ‘/home/dbadmin/dim’) AS SELECT * FROM dim; Rows Exported ————— 1 (1 row) Helpful link: https://my.vertica.com/docs/latest/HTML/index.htm#Authoring/SQLReferenceManual/Statements/EXPORTTOPARQUET.htm Have fun!