Issue in Syncing data from Redshift to S3

raviagrawal
raviagrawal Partner, Registered Posts: 18 Partner

Hi,

I have created a small Dataiku process where I am reading from redshift table using SQL query in DataSet and trying to sync it to S3, Dataiku sync process is adding some replace query over my Sql Query while unloading the data and its failing due to this. Here is the query


UNLOAD ('SELECT "cust_id",REPLACE("npi_id",\'"\',\'""\') FROM (select distinct dmn_cust.cust_id,npi_id
from TABLE1 inner join cdp.TABLE2
on TABLE1.call_pln_sid = TABLE2.call_pln_sid
inner join TABLE3
on TABLE1.sls_dirn_sid = TABLE3.sls_dirn_sid
and TABLE2.prd_strt_dt <= \'2019-04-01 00:00:00\'
and TABLE2.prd_end_dt >= \'2019-04-01 00:00:00\'
and upper(TABLE3.sls_dirn) like \'%PROD1%\'
inner join cdp.TABLE4
on TABLE1.cust_sid = TABLE4.cust_sid
) __inner') to 's3://S3_BUCKET/Call_Plan_S3/out-s' ALLOWOVERWRITE DELIMITER AS '\t' ADDQUOTES GZIP CREDENTIALS

Error


[2019/07/31-15:48:20.683] [FRT-63-FlowRunnable] [ERROR] [dku.recipes.sync.s3toredshift] - Redshift unload failed
java.sql.SQLException: [Amazon](500310) Invalid operation: unterminated quoted identifier at or near "",'""') FROM (select distinct dmn_cust.jnj_id,npi_id

Let me know how it can be corrected.

Regards,

Ravi Agrawal

Tagged:
Setup Info
    Tags
      Help me…