Exporting to Parquet

Jim_KnicelyJim_Knicely Administrator, Moderator, Employee, Registered User, VerticaExpert

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/9.1.x/HTML/index.htm#Authoring/SQLReferenceManual/Statements/EXPORTTOPARQUET.htm

Sign In or Register to comment.