Netezza CSV load

◇◆丶佛笑我妖孽 提交于 2020-01-04 04:38:06

问题


We are new to netezza and currently trying to import a CSV file, via script, into netezza.

What is the best way to get this working.

Ideally we would like to 1) Create the table structure we want 2) Import the CSV and map the CSV column names to the stucture we want

all in one import.

This code brings back the error: count of bad input rows reached maximum

INSERT INTO DBO.TABLE
SELECT * FROM
EXTERNAL 'C:\\log\\FILE.csv'
USING
(
 DELIMITER ','
 MAXROWS 300
 logdir 'C:\log'
 SKIPROWS 1
 Y2BASE 2000
 ENCODING 'internal'
 REMOTESOURCE 'ODBC'
 ESCAPECHAR '\'
 )

Importing by the wizard works but we can not automate this

is Nzload the way to go? If so whats the best practise with this?

--EDIT We have got this issue down to commas being in some of the fields we are importing and no text qualifier being specified in the import script.

How do we specify this?


回答1:


Generally speaking, when your record delimiter present in your data you will want to make sure it is escaped with a backslash. However, in your case you can load CSV data using an option to allow double quotes around column data (which Netezza does not normally require).

Alter your code to include this external table option: QUOTEDVALUE 'DOUBLE'

INSERT INTO DBO.TABLE
SELECT * FROM
EXTERNAL 'C:\\log\\FILE.csv'
USING
(
 DELIMITER ','
 MAXROWS 300
 logdir 'C:\log'
 SKIPROWS 1
 Y2BASE 2000
 ENCODING 'internal'
 REMOTESOURCE 'ODBC'
 ESCAPECHAR '\'
 QUOTEDVALUE 'DOUBLE'
 )



回答2:


PLZ use the duble slase \

INSERT INTO DBO.TABLE SELECT * FROM EXTERNAL 'C:\log\FILE.csv' USING ( DELIMITER ',' MAXROWS 300 logdir 'C:\log' SKIPROWS 1 Y2BASE 2000 ENCODING 'internal' REMOTESOURCE 'ODBC' ESCAPECHAR '\' )



来源:https://stackoverflow.com/questions/36447950/netezza-csv-load

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!