This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Reads in data and saves it to a csv at a specified location so it can be read by the next steps
Reads in a .pem private key file from a specified location on the users computer and connects to an sftp using this
Uploads a file to the sftp
The python for this is as follows. It works in designer but I'm having issues in porting it to the gallery to be scheduled.
from ayx import Package
import pysftp as pysftp
import pandas as pd
from ayx import Alteryx
data = Alteryx.read("#1")
data.to_csv( 'LOCAL_LOCATION' , encoding = 'utf-8', index = False)
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
sftp = pysftp.Connection(host="HOSTNAME", username="USERNAME", private_key="PRIVATEKEY_LOCATION", port='PORT', cnopts=cnopts)
# hostname, username and port are usually filled in but have been removed for security here.
#The rest is provided by macro inputs
except Exception as e:
My problems are:
The .pem private key file is not being picked up a workflow dependency, and as it sits on users' local PCs, it is not accessible from the gallery. Is there a way to package it in with the workflow?
Ideally, I wouldn't want to save datasets locally before uploading them to the sftp - this isn't that important but it would be nice.