Alteryx designer Discussions

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

Issue running workflow on gallery that works in designer

Meteor

I have created a macro that does the following: 

  1. Reads in data and saves it to a csv at a specified location so it can be read by the next steps
  2. Reads in a .pem private key file from a specified location on the users computer and connects to an sftp using this
  3. 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)

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: 

  1. 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? 
  2. 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. 

 

Thanks in advance for your help!

 

 

Highlighted
Alteryx
Alteryx

@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. 

 

https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Attaching-additional-files-to-a-workflow-pac...

Digan
Alteryx
Labels