COPY Statement not rejecting records when FILLER is being used
Hi,
We are reading data from a CSV and loading it into a vertica table using COPY command. The target table has a column set to NOT NULL. In COPY statement, we are using FILLER to transform data. This transformed data is then loaded into NOT NULL column. If there is null in CSV, the query fails with error like 'Cannot insert into NOT NULL column'.
However when we remove the FILLER and run the query, it sends the NULL value row to rejected table.
Can we have the same functionality while using FILLER in COPY query?
Below are the queries
CREATE TABLE CUST_CONTACT
(
Name varchar(80),
Contact varchar(15) NOT NULL
);
COPY CUST_CONTACT
(
Name,
v2 filler VARCHAR(15),
Contact as REGEXP_REPLACE(v2, '(\d{5})(\d{7})(\d{1})','\1-\2-\3')
) from 'Test5.csv' skip 1 delimiter ','
rejected data as table errortest3;
Thanks.
Answers
Set the CopyFaultTolerantExpressions parameter to 1!
Example:
See:
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/AdministratorsGuide/BulkLoadCOPY/CapturingLoadExceptionsAndRejections.htm
The solution you provided is for version 9 , is there any solution for version Vertica Analytic Database v8.1.1-0?
Maybe just insert a dummy "NULL" value temporarily... then remove those records when the load is complete?
Example:
Thanks a lot @Jim_Knicely. It was indeed helpful.
Awesome!
Consider upgrading to enjoy the benefits of all the great new functionality in Vertica 9.1 or 9.2 !!!
https://www.vertica.com/docs/ReleaseNotes/9.2.x/Vertica_9.2.x_Release_Notes.htm
https://www.vertica.com/docs/ReleaseNotes/9.1.x/Vertica_9.1.x_Release_Notes.htm