This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
04-03-2019 09:52 AM - edited 08-03-2021 03:24 PM
# 3rd Party Libraries import AlteryxPythonSDK as sdk from snakeplane.plugin_factory import PluginFactory # Our added libraries import matplotlib.pyplot as plt from math import pi import re
# Initialization of the plug in factory, used for making the AyxPlugin class factory = PluginFactory("radarPlot")
# Get the selected value from the GUI and save it for later use in the user_data user_data.fields = (input_mgr.workflow_config["fields"]) user_data.names = (input_mgr.workflow_config["names"])
initSuccess = True if user_data.fields is None: logger.display_error_msg("Select Fields to Plot") initSuccess = False if user_data.names is None: logger.display_error_msg("Select the Field that Contains the Plot Labels") initSuccess = False
return initSuccess
@factory.process_data(mode="stream", input_type="dataframe")
Suggestion - Part 1 step 3.3 requires access to pip domains (e.g. pythonhosted.org). If you work for a company that uses a proxy, make sure your proxy has these domains available before starting the "env\setup_environ.bat" script.
Another tip - In Part 3, "Debugging your Tool" step 1, make sure you set the fields you want to plot to numeric data types (Int works nicely). I thought my copy/paste skills were failing until I tried ploting the name field and saw it was faliing to proces the string data type. All I had to do was change the data types for the numeric fields in the Select tool, and voila!
@SydneyF - I finished up the tutorial yesterday, and it worked nicely! Thank you for the demo! :)
Couple questions if that's okay ...
Thanks once again!
Hi @cam_w,
1. I spoke with one of the developers of SnakePlane, and he said that there are actually typically improvements in processing time for tools built with SnakePlane versus those built without.
2. You got it! Just build all of your tools into a shared directory, and then package that directory. The tools will all be included in the resulting .yxi. As a side note, there is some funky behavior with using multiple SDK tools on a single canvas in 2019.1. This is set to be resolved in 2019.2, and also does not occur in 2018.4.
3. Have you registered for BUILD2? It's on Tuesday, and people will be developing and analyzing all sorts of neat things. There is a specific SDK track, where you can compete (alone or with a team) to build an awesome Python SDK tool. The event is staffed by Alteryx Employees to provide help and answer questions - this might be exactly what you are looking for. I hope to see you there!
I am so glad you found the tutorial valuable! I am excited to see/hear/read about what you create with SnakePlane!
Hey @SydneyF ,
That's good to hear, thank you!
Shoot, I think I registered for a platform training on Tuesday afternoon. I'll have to check my registration tomorrow and see what I want to/can do.
Thanks!
I've built a couple custom tools from scratch, just starting in on SnakePlane.
It might be obvious to others, but what's the difference between a Batch, Source and Stream tool as it pertains to the Python SDK? (ie - the @factory.process_data() modes)
Mode allows us to specify how we want the plugin to operate in terms of bringing in data. Batch mode brings in all of the data being fed into the tool at once, which is handy if you are building a tool that needs to see all records simultaneously (like a predictive tool). Stream mode brings in the input records a single row at a time (i.e., bring in a row, do the process defined by the script, write the output to the Engine, repeat with the next row). Source mode is for when the tool doesn't expect an input stream of data at all (e.g., an input tool).
You might also find the documentation on the GitHub page helpful for understanding the difference.
Hope this helps!
Sydney
Perfect! Thank you Sydney, that's an excellent, clear description. I appreciate it.