Skip to main content

AyxPlugin Python Class

Important

This Python SDK uses outdated technology that limits your extension opportunities. We've built a new Platform SDK using Python and the latest open-source technology to deliver a vastly improved development experience. Go to Platform SDK to get started!

The AyxPlugin class is the basic building block of your tool. AlteryxEngine uses this class to instantiate an object each time your program runs. This class contains methods to build the functionality of the plugin interface, prefixed pi_, and the incoming interface, prefixed ii_.

Methods

__init__

This is the standard Python constructor, which is called each time the AlteryxEngine instantiates an instance of your plugin.

__init__(self, n_tool_id, alteryx_engine, output_anchor_mgr)

The arguments to this function are values provided by the AlteryxEngine, and will be used when communicating with the engine or with other tools.

  • n_tool_id: An integer representing a unique identifier for the instance of the tool being created. Your plugin should save this value to communicate with the AlteryxEngine.

  • alteryx_engine: A complex object representing the interface for communicating with the Alteryx Engine.

  • output_anchor_mgr: A complex object used to interface with the output connections of your tool. You need to call get_output_anchor on it with the name of your output in the config file to get the handle for the output.

pi_init

Provides the tool with its configuration data. Required method.

pi_init(self, str_xml)

  • str_xml: A string formatted as XML that holds the config data.

This function is called when the tool is first initialized and any time the tool configuration changes.

pi_close

Required method.

pi_close(self, b_has_errors)

  • b_has_errors: An option the indicates if errors occurred.

Use pi_close() if you require file cleanup that must be handled manually or to issue an error that cannot be detected before pi_close.

pi_add_incoming_connection

Manages input data, metadata, and progress for one or more incoming connections.

pi_add_incoming_connection(self, str_type, str_name)

Returns an object that implements the incoming interface functions.

pi_add_outgoing_connection

Passes output anchor and related connections.

pi_add_outgoing_connection(self, str_name)

pi_push_all_records

Called for tools that do not have inputs.

pi_push_all_records(self, n_record_limit)

ii_init

ii_init(self, record_info_in)

  • record_info_in: The incoming record structure.

ii_push_record

Pushes records downstream. If your tool processes a single record at a time, it is best to push the record downstream from within the tool.

ii_push_record(self, in_record)

Return False to indicate that no additional records are required.

ii_update_progress

Updates the upstream tool of record-processing progress.

ii_update_progress(self, d_percent)

ii_close

Closes connection to upstream tool when all records have been pushed, indicated by upstream tool calling self.output_anchor.close(). Close all resources opened in ii_init.

ii_close(self)