已到达记录的结尾,但预计将在SNOWFLAKE DATAWAREHOUSE中解析列'“ TRANSIENT_STAGE_TABLE

时间:2018-12-28 16:18:02

标签: amazon-s3 snowflake-datawarehouse

我在S3中有一个.csv格式的文件,当我尝试加载到Snowflake时,出现错误消息“达到记录结尾,同时预计将解析列“ TRANSIENT_STAGE_TABLE”。

我的文件看起来像

Account_Activity_Type , Batch_ID , reference, Merchant
UNRECONCILED PAYMENT, cycleRef, @#$2&,

示例数据引发错误

数据

Account_Activity_Type,Batch_ID,Batch_Sent_Date,Bank_Batch_ID,Bank_Account_Updated,Amount_Currency,Batch_Credit_Debit_Mark,Amount,Statement_Ref,Bank_Statement_Ref,Merchant_Bank_Account_Updated,Merchant_Party_ID,Merchant_Contract_ID,External_Original_Transaction_ID,External_Original_Transaction_Date
UNRECONCILED DISBURSEMENT,cycleRef,,batchId1,,USD,CREDIT,100,@#$2&,id,,,,,
UNRECONCILED DISBURSEMENT_RETURN,cycleRef,,batchId1,,USD,CREDIT,1000,${originationId},id,,,,,
UNRECONCILED DISBURSEMENT_RETURN,cycleRef,,batchId1,,USD,CREDIT,100,@#$2&,id,,,,,
UNRECONCILED DISBURSEMENT_RETURN,cycleRef,,batchId1,,USD,CREDIT,100,${originationId},id,,,,,

我用于加载到SnowFlake Datawarehouse的代码。

Create or replace FILE FORMAT SETTLEMENT_DQ

COMPRESSION = 'AUTO'
FIELD_DELIMITER = ','
RECORD_DELIMITER = '\n'
SKIP_HEADER = 1
--FIELD_OPTIONALLY_ENCLOSED_BY = '\042'
FIELD_OPTIONALLY_ENCLOSED_BY = NONE
TRIM_SPACE = FALSE
validate_UTF8=false
ERROR_ON_COLUMN_COUNT_MISMATCH = FALSE
ESCAPE = 'NONE'
--ESCAPE_UNENCLOSED_FIELD = '\134'
ESCAPE_UNENCLOSED_FIELD = NONE
DATE_FORMAT = 'mm/dd/yyyy'
TIMESTAMP_FORMAT = 'AUTO'
NULL_IF = ('NULL', 'null', '\N')
COMMENT = 'parse comma-delimited, double-quoted data'


insert into SETTLEMENT_DAILY 
(
Account_Activity_Type,
Batch_ID,
Batch_Sent_Date,
Bank_Batch_ID,
Bank_Account_Updated,
Amount_Currency,
Batch_Credit_Debit_Mark,
Amount,
Statement_Ref,
Bank_Statement_Ref,
Merchant_Bank_Account_Updated,
Merchant_Party_ID,
Merchant_Contract_ID,
External_Original_Transaction_ID,
External_Original_Transaction_Date
  )
SELECT 
T.$1,
T.$2,
T.$3,
T.$4,
T.$5,
T.$6,
T.$7,
T.$8,
T.$9,
T.$10,
T.$11,
T.$12,
T.$13,
T.$14,
T.$15
FROM @DEV_S3_DATA/SETTLEMENT/yearly_XN540000_UK.csv (FILE_FORMAT => 'SETTLEMENT_DQ') as T;  

如果已知错误,请与他人分享您的建议。

错误: 到达记录结尾,同时预计将解析列““ TRANSIENT_STAGE_TABLE” [“ $ 15”:15]'文件'SETTLEMENT / yearly_XN540000_UK.csv',第5行 字符92第4行,列“ TRANSIENT_STAGE_TABLE” [“ $ 15”:15]

0 个答案:

没有答案