Alteryx Designer Discussions

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

Using db connection in Python tool

zoltan
5 - Atom

Hello,  

 

I use python tool to create custom sql command and summit it to the source database using API which is working like a charm.

 

But for obvious reasons I don't want to store connection information (password) in the code.

 

I wonder if I could use the in-db connection - that I have already defined in the alteryx - and is part of the worklow.

(or at least...if it is possible to use the connection information from alteryx)

 

My python code looks like this 

 

import snowflake.connector

 

# create connection

con = snowflake.connector.connect(
user=vUSER,
password=vPASSWORD,
account=vACCOUNT,
database=vDATABASE,
warehouse='COMPUTE_WH'
)

 

# fetch data
cur = con.cursor().execute("Select * from mytable")

 

 

thanks in advance! 

 

3 REPLIES 3
afv2688
16 - Nebula
16 - Nebula

And if you store them in a file only accessible from your terminal? Dunno how to otherwise (from alteryx) to pass them down (without being visible). Don't really know the purpose of your WF or where you're gonna run it from, just suggesting.

zoltan
5 - Atom

Thank you for your answer!

 

I am going to create a tool with SDK and ask for the connection params if I cannot get it from the predefined Data Connections.
I still hope there is a way.

alghammari
5 - Atom

Did you find any answer for the SDK tool?

Labels