Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Import Data to Teradata from OneDrive if DATE do not exists

cito
8 - Asteroid

Hello,

Is there a way to check a condition for date before importing data from OneDrive excel file to Terada's table in order to avoid duplicate records?

So, someone else maintains an excel file on OneDrive and I just pick up this data every week and import them into the Teradata's table. 

Now, I would like to automate the process and schedule the flow to pick up this data but before INSERT the data to check if "date_month" already exists in Teradata's table. If "date" exists DO NOT import/insert data ELSE insert.

I have tried with PRE Create SQL statement in Database window (picture below) but do not know how to call OneDrive file in this statement:

 

IF NOT EXISTS (SELECT DISTINCT date_month 
FROM tedw.table1
WHERE date_month = (SELECT DISTINCT date_month FROM "OneDrive PATH folder" WHERE date_month IS NOT NULL)) 

 

 

cito_0-1629549184064.png

 

 

As I do not know how to "call" OneDrive file/path here, is there some better solution?

 

Thank you in advance.

 

 

1 REPLY 1
ArtApa
Alteryx
Alteryx

Hi @cito - I would read the data from both Excel and Teradata first and compare dates in Alteryx. The best option for this purpose may be a Join tool. Then you can write all unmatched records from R or L output anchor to Teradata.

Labels
Top Solution Authors