Load CSV file to Vertica table

Dears,

 

I recently installed vertica cluster ( 2 nodes ) on Centos 6 .. I need to ask about the method of table creation then load data in CSV file to it.

 

I am using the below command

 

COPY table_name FROM '/home/dbadmin/csv_file.csv' PARSER fcsvparser();

 

after executing the above commands, the table is created, column names exist but no data inside ( 0 Rows ).

 

Can you please help ?

 

Comments

  •  Is becouse he load data is not valid. 

     

    Look into the rejected data location

    /catalog/dbname/v_dbname_node0001_catalog/CopyErrorLogs

     

    or you can try using rejection tables or abort on error when you load data.

    using table

    COPY table_name FROM '/home/dbadmin/csv_file.csv' PARSER fcsvparser() rejected data as table tbl_name;

    then query the table to look at the errors.

     

    Using abort on error

    COPY table_name FROM '/home/dbadmin/csv_file.csv' PARSER fcsvparser() abort on error no commit;
  • Thanks for your reply.

     

    COPY: Input record 100 has been rejected (Too many columns found).

     

    All data in CSV went to rejection log file and the above exeptions appeared in exceptions log.

  •  That means you feed to many values or your data delimiter is not well set, you might get delimiter chars inside the columns.

     

     

  • you can include even column name with vertica table like :
    COPY table_name(col1,col2,col3) FROM '/home/dbadmin/csv_file.csv' PARSER fcsvparser();
    Make sure your csv file contains only these columns values (datatype sequence should match), header is not necessary.

Leave a Comment

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