Running Python code inside Alteryx
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Team,
Hope you are well. I am trying to run a Machine learning algorithm written in python code say (100 lines of code) within alteryx. But it's too long or sometime crash. As my management would like to run this inside a alteryx beause of the end user requirement, i would like to know if this is a efficient way of doing this.
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@sriniprad08 is the requirement that the Python code be run within the Alteryx workflow? If not, you could also trigger the code to run before or after workflow run using workflow events, or even a Run Command tool. This would allow you to run the code as part of a larger effort while being triggered independently in its own environment.
If this isn't what you are looking for, maybe you can provide additional context as to why your Python runs for a long time and/or crashes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@BrandonB Thank you for the kind reply and clarification. Yes it has to be run within alteryx. Please find below the sample flow diagram.
But what you shared about run tool command and also the workflow events sounds interesting. Can you please some examples or information on this how it will probably work .
Thanks,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Sri,
If you have it configured via a Run Command tool you can kick off a script as part of the workflow, but have it execute in its own environment. Here is an example of how to do so: https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Run-a-Python-Script-in-Alter...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @BrandonB
Thank you so much. Will go through it. But the blog says this applies for (If you are using a version of Designer≥2018.3, use the Python tool! If you are on an older version, this article is for you.)
Cheers,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The reason it says this is because the Python tool allows for code to be run in the Python environment that installs with the Designer install, so you can execute code in this environment and pass data into and out of a script via data frames. Even though this exists, you can still execute scripts outside of Alteryx using the methods mentioned above. This is why I was asking for clarification as to whether the Python code needs to live within your workflow as a requirement or purely execute as part of the process. If there is no requirement to include it within the workflow itself, then you can use the method that I proposed.
