Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Dynamic Replace: Run SQL Query For Multiple Dates

bradonchid
6 - Meteoroid

Hi, I have a query that I need to run to get data from the past 52 weeks. I don't have enough spool to run it for the whole time frame, so I created the below workflow to run it one day at a time and write the results in a Teradata table. The problem I'm facing is that it takes it takes an average of 20 minutes to for my workflow to run each day through the query and write it to the table, which obviously is way to long. When I run the query in Teradata, it only takes about 20 seconds. I have also attempted creating this workflow with the In-Database tools, but I haven't found a way to dynamically replace the dates in my sql query. Is there any way that I can make this workflow work faster?

 

Capture.PNG

 

 

12 REPLIES 12
bradonchid
6 - Meteoroid

I had a chance to look at your workflows this morning. Is there any way that I could modify these macros to feed a list every date through it or would I have to run it for each day of the year individually?

Claje
14 - Magnetar

Once you have it saved as a macro (.yxmc extension), and have configured your query, you can insert it like a regular tool inside another alteryx workflow.  So if you have a workflow with all the dates you want to run, you can right click on the canvas and choose Insert->Macro.. and browse to that file.  This will insert it as a new tool.  From there, you simply need to connect your date input to that tool, and configure the tool so that the drop down has your date field selected, and you should be able to run the workflow!

bradonchid
6 - Meteoroid

Thank you, that worked for me. I ended up using your in db macro and formatting it like the first one. Works like a charm. 

Labels