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!
The Product Idea boards have gotten an update to better integrate them within our Product team's idea cycle! However this update does have a few unique behaviors, if you have any questions about them check out our FAQ.

Alteryx Designer Desktop Ideas

Share your Designer Desktop product ideas - we're listening!
Submitting an Idea?

Be sure to review our Idea Submission Guidelines for more information!

Submission Guidelines

Python Tool - container to manage parameters

The Python tool has been a tremendous boon in being able to add capability that is not yet available in the Alteryx platform.

 

It would make the Python Tool much more usable and useful if you can define the inputs explicitly rather than just relying on the good behaviour of both the user; and also the python code that reads the inbound data (Alteryx.Read('#1'))

 

This is not something that the Jupyter notebook code-interface may handle directly (because the Jupyter notebook has no priveledged knowledge of the workflow outside it); so this may be best handled by the container itself.

 

The key here is that if my python app requires 2 inputs - it should be possible to define these explicitly so that we can test; and also so that we can prevent errors and make this more bullet-proof.

 

The same would apply on the outbound nodes for the Python tool.

 

5 Comments
HeatherMHarris
11 - Bolide

This could be really useful for Python APIs such as those used for survey data platforms where you are regularly passing survey identifiers, tokens and data center information (i.e. Qualtrics) in multi-step API handshake protocols. 

MacRo
Alteryx
Alteryx

@SeanAdams -- I know this is an old thread, but just came across it... Does renaming the connection not do what you want? Here's what I mean:

 

1.) Click on the connection line between two tools. The configuration panel displays the connection name (eg, "#1"). Replace the connection name with anything you'd like.

 

MacRo_0-1582650466496.png

 

2.) Now you've got your explicitly named connections

 

MacRo_1-1582650606325.png

3.) ...and your Python tool code should now reference those connections by name

 

MacRo_2-1582651202032.png

 

The outbound connection anchors do not have names, just numbers, so this doesn't address that part, but since you define what goes to those anchors in your Python code, there shouldn't be any uncertainty around them.

MacRo
Alteryx
Alteryx

Oh! I also wanted to mention the Alteryx.getConnectionNames() function, which will return the connection names as a list of strings.

 

MacRo_0-1582656290839.png

 

You could then verify that the inputs "data" and "model" are present before moving on in your code... or, if you wanted to make it more generic, you could loop through the input connection names, use Alteryx.readMetadata() to access the metadata for each connection, and identify a connection that has a certain set of columns. (The Score tool does something similar, where it looks for the input containing "Name" and "Object" columns representing a model object, so that the order and names of the input connections don't matter. The Score tool uses the R tool instead of the Python tool, but same idea.)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team
Status changed to: Accepting Votes
 
clmc9601
13 - Pulsar
13 - Pulsar

Thanks, MacRo!