问题
I need to import a csv file (122 GB, all fields are integer or string) to a table on IBM netezza sql database through Aginity Netteza workbench.
I have created the table with fields that names match with ones in the csv file.
When I imported the data I got error:
Unable to export the data to a file. Error: required option for internal format is not set: Compress
I am confused because I am doing import not export. This is my sql query:
CREATE TABLE my_table
(
id integer ,
value1 integer ,
value2 character varying(2) ,
value3 integer ,
value4 character varying(32) ,
value5 integer ,
value6 double precision
);
INSERT INTO my_table
SELECT * FROM
EXTERNAL 'E:\\my_path\\my_file.csv'
USING
(
DELIMITER ','
LOGDIR 'C:\\my_log'
Y2BASE 2000
ENCODING 'internal'
SKIPROWS 1
REMOTESOURCE 'ODBC'
ESCAPECHAR '\'
)
Any help would be appreciated.
thanks
回答1:
This is a case of misleading error text, I think. If you are importing from a CSV then you should be using Text as the FORMAT. It looks as if it is defaulting to 'internal' which is not what you want. Try adding FORMAT 'text' to the USING section to explicitly state you are working with a text file.
INSERT INTO my_table
SELECT * FROM
EXTERNAL 'E:\\my_path\\my_file.csv'
USING
(
DELIMITER ','
LOGDIR 'C:\\my_log'
Y2BASE 2000
ENCODING 'internal'
SKIPROWS 1
REMOTESOURCE 'ODBC'
ESCAPECHAR '\'
FORMAT 'text'
)
来源:https://stackoverflow.com/questions/26129317/error-of-importing-data-from-csv-file-to-ibm-netezza-sql-database