Alteryx Designer Desktop Discussions

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

Read in folder with SQL files and execute them

Dante311
5 - Atom

Hello everyone,

 

I want to read in every single .sql file I find in a certain folder and then execute it. Each .sql file can contain multiple statements. Can somebody explain how this would work with alteryx? I already have an IN-DB connection where I can execute queries, this works fine. 

 

Unfortunately I cannot really find what I am looking for in the community. 

 

Thanks a lot for the help!

 

 

3 REPLIES 3
LukeM
Moderator
Moderator

Hi @Dante311 ,

 

Sounds like you need to explore the Batch Macro functionality. This will allow you to build a process that is then run on each of your individual .sql files, to execute the queries. This would be done by using the Directory tool, in conjunction with a Dynamic Input within a Batch Macro.

 

https://community.alteryx.com/t5/Engine-Works-Blog/Alteryx-Simple-Batch-Macros/ba-p/2251

 

I hope this helps. If you need some more guidance and can't find extra help on the community then please provide some more information on your particular use and we can help.

 

Luke

Dante311
5 - Atom

Hi Luke,

 

this looks good. I can execute statements with this. I only get an error when I want to run a SQL file which creates or overwrites a table in my database. If I remove the line the code runs. How is it possible to create tables?

 

 

D3Baker
6 - Meteoroid

Hi

 

I am unable to open files due to restriction at my company

 

Db

Labels