Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

Python Tool Challenge | BUILD a Python tool and win a prize!

NeilR
Alteryx Alumni (Retired)

Python Tool Challenge

 

With the release of Alteryx Designer 2018.2, the Python SDK has finally shed its Beta flag!

 

 grown_up.png

 

Now it's time to celebrate!


To enter the contest:

  1. Create a Python tool (like Nick did) and package it as a YXI file.
  2. Reply to this thread with a description of your tool. Don't forget to link to or attach your YXI.
  3. Get stars! Threaten, bribe, or maybe just tweet. Whoever gets the most stars by July 31st wins!

You'll have to make a decision: keep working on your tool closer to the deadline to make it as perfect as possible, or submit it early so you have time to socialize your post to get as many stars as possible?


Grand prize hotnessGrand prize hotness

☝️☝️☝️ The winner will receive a custom WASD mechanical keyboard 🌋🌋🌋

👇👇👇 All entrants will be rewarded with the Python Contest badge 🔥🔥🔥

 

Participation trophy (Community badge)Participation trophy (Community badge)

Remember to make sure you've upgraded to 2018.2.

 

Subscribe to this thread or check back here (pythoncontest.alteryx.com) to vote as new tools are submitted!


35 REPLIES 35
elatt
7 - Meteor

Hi,

 

The DataRobot Tools Team are big proponents of the Python SDK. We were able to quickly and easily convert our Macro+R based tool into one that utilized the HTML and Python SDKs. For Alteryx users, the tool is only useful if you currently have access to a DataRobot account and it looks as follows:

 

dr-alteryx.png

 

 

However, for Python tool developers, we have developed some useful helper classes for making it easier to work with the Alteryx Python SDK that we encourage folks to have a look at. Some of the features include:

  • A custom LogHandler class that marries Alteryx logging with the standard Python logging framework.
  • Abstract base classes for the Plugin and IncomingInterface classes which include useful helper methods.
  • A declarative interface for dealing with the passed in XML tool config so you don't have to worry about parsing XML to read in the configuration set by the HTML SDK.

For now, developers will need to open up the YXI file and examine the code. Eventually we would like to split out our common code and publish it to PyPi as a stand-alone library so it can easily be included into other tools via addition to a tool's requirements.txt file. You can grab our YXI package from our posting on the Alteryx Gallery.

tlarsen7572
11 - Bolide
11 - Bolide

Hey @Nick612Haylund, neat tool!  I would be willing to help put a GUI on top of your tool and get it hooked into the engine.  I will send something to you once I run a problem past Alteryx...

Nick612Haylund
10 - Fireball
10 - Fireball
Rock on @tlarsen7572 ! I’ll PM you with some more details!
LaurenU
Alteryx Alumni (Retired)

@Nick612Haylund, hmmmm now there's an idea! The AUG team is currently accessing and exploring new galaxies in the User Group Universe. Stay tuned! 

Treyson
13 - Pulsar
13 - Pulsar

@Nick612Haylund have a gold star.

 

Dad Joke: Why did all the cows get Gold Stars? 

A: Because they were out standing in their fields! 

 

I should get one of those keyboards just for that amazing joke.

Treyson Marks
Senior Analytics Engineer
jwalder
10 - Fireball

Ever needed a workflow to just stop processing because of a lack of stuff to process? Like no files for a dynamic input tool. If you don't want the error from it or you want there to be enough files to bother processing or any number of other scenarios in which having Alteryx pass 0 records through the workflow is not good, then I have the tool for you.

 

I give you Terminator. There is one configuration value for the minimum number of records to continue. If the minimum records are received on the input connector, then the records proceed unchanged on the output. If the minimum is not met, then the output is never initialized and no down stream tools process. The 'n' output always output the total number of input records received, even if 0...unlike the Summary tool.

 

Thanks!

terminator_example.png

Nick612Haylund
10 - Fireball
10 - Fireball
@jwalder can the output message for meeting Terminator criteria say “I’ll be back.”

:)
SydneyF
Alteryx Alumni (Retired)

I wanted to build out a simple proof on concept of what a predictive tool built with the Python SDK might look like. The tricky part about building a predictive tool with the Python SDK is that the SDK is designed to pass records through for processing one by one, where most predictive models require access to all input records at once. To work around this, I followed the lead of @NeilR and @Chriszou outlined in this Developer Discussion Thread. I adapted code from the Example Output Python Tool, in ii_push_record to create a temporary table of data, and then performed the clustering analysis in ii_close.

 

The Tool will shown an error message before the workflow is run. I believe this is related to how the workflow/tool is updated. The tool should run without issue and create clusters for your input data.

 

 

2018-07-23_10-30-19.png

 

There is definitely a lot of room for refinement in the code and tool. I am really excited to take it in new directions, expand it's abilities, and run some comparisons against our R-based tools. I just wanted to post this tool to demonstrate how something like this can be done with the SDK, and to make sure I got one of the super cool Python Badges :)

 

Many thanks and acknowledgements to @RafaelH for his help getting the final output working correctly, @PaulN for all of his support and guidance along the way, and to @HossC for his help testing. 

jwalder
10 - Fireball

@SydneyF I did something similar for my tool. It wasn't immediately obvious that you couldn't simply stack the input records as it is merely a pointer and every incoming record has the same pointer.

What Python Badge?

SydneyF
Alteryx Alumni (Retired)

@jwalder

 

This Python Badge!

 

2018-07-23_11-15-50.png