I have created a macro that does the following:
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)
def sftpPush():
try:
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
sftp = pysftp.Connection(host="HOSTNAME", username="USERNAME", private_key="PRIVATEKEY_LOCATION", port='PORT', cnopts=cnopts)
sftp.put('LOCAL_LOCATION', 'LOCATION_ON_SFTP')
sftp.close()
# 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:
print(e)
sftpPush()
My problems are:
Thanks in advance for your help!
Solved! Go to Solution.
@JonnyR You have to add an asset to the workflow using the input tool. When you upload the workflow, it will show up as an asset and you will be able to package it when uploading to the gallery.