Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

[Help]: Calling Redshift Copy Command in Alteryx Workflow

anuj_mangal
6 - Meteoroid

Dear Members of the Community,

 

I am relatively new to Alteryx and hence having difficulty in one of the use cases that I am encountering at present. I need to use the Redshift Copy command to copy data from AWS S3 buckets to the Redshift database, but the command needs to be invoked through an Alteryx workflow.

 

I am able to accomplish this via the use of Copy commands over SQL workbench but there is a specific requirement of having to make use of these commands through Alteryx workflows. Is it possible? If yes, how can I do so? 

 

Thank you for your responses and your time in reading this thread.

 

Warm Regards,

Anuj Mangal

2 REPLIES 2
tdsanalytics
7 - Meteor

Yes, it is possible. I create a workflow with a single Input tool connected to the Redshift database. In the Options panel, I use a generic Query (#4) such as:

 

select TOP 20 * from staging.redshifttable

 

I put the Redshift command in as the Pre SQL Statement (#9). An example might be: 

 

TRUNCATE staging.redshifttable;
copy staging.redshifttable from 's3://bucketname/filename'
credentials 'aws_access_key_id=XXXXXXXX;aws_secret_access_key=XXXXXXXX'
emptyasnull
blanksasnull
IGNOREHEADER 1
csv;

 

Run the workflow and the Redshift command is executed.

 

anuj_mangal
6 - Meteoroid

Thanks for the Solution. I tried this and it seems to have worked.

Labels