Alteryx Designer Desktop Discussions

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

Download files from S3 using Python

CokeLuke
8 - Asteroid

In the past, I would open a browser and select the S3 file(s) or use Alteryx workflow with S3 download tool. S3 download tool works great if the daily file follows the proper naming convention and it kicks off at the scheduled time - file includes the execution timestamp. Then a macro can easily pull the file with today's date.

 

But.... if the file runs at another time. Back to opening Edge/Chrome and downloading it manually.

 

I came across a great article Amazon S3 Download – Use Wildcards to Select a Single or Multiple Objects - Alteryx Community sélect... 

 

With this great idea from @DanC, wrote some Python code to pull any files generated today. See below using the Python tool:

 
 

PythonS3.JPG

 

Note my variables for AccessKey, SecretKey, and BucketName. Other than that, it's just the bottom two cells. After a few blanks, figured out Package.installPackages(['boto3']) was missing. Then it ran fine, also on Alteryx Server.

 

Hope this helps you, too!

PythonS30.JPG

 

2 REPLIES 2
Kushagra01
5 - Atom

Hi ,

Please refer to the link below which is part of the tool mastery series of Alteryx. It also comprises of the issues and resolutions as well

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-Amazon-S3-Upload-and-D...

 

Hope this helps!!

CokeLuke
8 - Asteroid

My post is how to do it dynamically instead of the usual S3 download tool's way. That is the key point.

Labels