How to Skip data when loading data in Vertica Database

In Vertica all data should be loaded using the copy command. The copy command comes with many options that are very useful when loading data into your Vertica database.

How to skip a rows when loading data from a csv file. 

Our data.csv files has the following content.
1,1,1
2,2,2
3,3,3
And table that will receive the load is called test.
create table test( col1 int, col2 int, col3 int);
To be able to skip one or more rows we will use the SKIP option of the copy command:
(dbadmin@:5433) [dbadmin] * truncate table test;
TRUNCATE TABLE
(dbadmin@:5433) [dbadmin]  copy test from '/home/dbadmin/data.csv' delimiter ',' SKIP 1 direct;
 Rows Loaded
-------------

           2
(1 row)

(dbadmin@:5433) [dbadmin]  select * from test;
 col1 | col2 | col3
------+------+------

    2 |    2 |    2
    3 |    3 |    3
  • we can see that the line number 1 was skipped and only the rest of the lines were loaded.