Alteryx Designer Desktop Discussions

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

Help to Parse complex SQL queries

GloriousWater
8 - Asteroid

Hello Community. 


I am currently building a workflow, that "scans" other .yxmd workflows for inputs and outputs.


For many inputs its somewhat straightforward to parse out what fields are being input from the source.

But when it comes to database inputs where complex SQL queries are used it becomes very difficult.

 

Do you know of any resources or tools to parse SQL queries into which columns are being input from which tables?


Currently i can parse simple "select table.x from schema.xxxxx" by using regex. 
When the SQL query consists of several nested layers of select statements it becomes a whole different scenario. 

Ideally i am hoping that there is some python code or macro that i can read the sql code into, which then outputs tables and columns.

 

 

All help will be greatly appreciated! 

 

Best Regards

4 REPLIES 4
mbarone
16 - Nebula
16 - Nebula

Not sure if this is what you're looking for, but I have a series of parsing tools that take a query with subqueries and display it in a more readable format like this:
2021-03-31 11_47_28-Window.png

TrevorS
Alteryx Alumni (Retired)

Hello @GloriousWater 
Thanks for posting to the Community!
I did some digging, and have found some other posts that tackle the same general idea you have.
I haven't been able to find an existing workflow that's been shared to do this, but this post covers the rough steps you would need to complete. 
This second article also contains some additional conversations that may be useful for you as you work through this process!

Additionally, are you able to provide a sample of what your SQL looks like? This will give the Community a better idea of what you are trying to parse.

I hope these help to get you moving in the right direction!
Thanks,
TrevorS

Community Moderator
GloriousWater
8 - Asteroid

First of all sorry for the slow response. I was occupied by higher priorities, however i will return to this once opportunity presents. I will update once so. In the meantime thank you very much for your inputs!

preston_vock
5 - Atom

Hello,

 

Could you share those tools? I am interested in parsing some existing sqls so that I can update the naming convention as we will be upgrading databases here shortly.

Labels