Skip to main content

AlteryxEngine Python Class

重要

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 AlteryxEngine class is a reference class to extend the class members of an AlteryxEngine object instantiated within the running Alteryx process.

Engine Information

AlteryxEngine Status Types (Alphabetical Order)

Status Type

Definition

browse_everywhere_file_name

The FileName of the temporary .yxbe file containing the Browse Everywhere data for this run.

cache_temp_file

A temporary file for caching data between runs.

choose_from_multiple

Indicating that the message will be a '\n' delimited list of choices that the calling application must make a selection from. The callback handler should return one of the following values to indicate the choice that is made. Valid values are: -1 for cancel, -2 for 1st to all, -3 for none to all, 0 for none, and 1...N for a specific value from the list of choices.

complete

The tool has completed its processing.

data_profiling

Data Profiling file name.

disabled

Indicates that all output tools have been disabled.

document_temp_file

The message is the path of the temporary file.

error

Indicates that an error has occurred. The message will be the error message.

field_conversion_error

Indicates that a field conversion error has occurred. The message will be the error message.

field_conversion_limit_reached

Indicates that the field conversion error limit has been reached.

file_dependency

The dependent files associated with a compound file: - Status_File_Output, has the main file to link to. This has the main file (fully pathed), fully pathed dependent file, fully pathed dependent file, and more.

file_input

The input file of this tool.

file_output

The output file of this tool.

info

Information passed to the calling application.

low_disc_warning

The calling application is saying that the free disk space is running low and pause the workflow until action is taken.

output_field_names

The field names for this SRCT output tool in a comma-quote delimited string.

output_record

The data record for this SRCT output tool in a comma-quote delimited string.

preview_fail

In preview mode, send PREVIEW_FAIL if not supported.

record_count_string

Indicating the number and size of records output by the tool so far. The string is in the format: "OutputName|RecordCount\nTotalSize."

request_auto_config_refres

This causes the configurations to refresh in the GUI with no user interaction. This is done when the tool is already in an error state, but (maybe) the GUI can fix it with no user interaction.

restricted_data_set_error

This message has no text—it serves to notify the caller that there is at least 1 error of this type. It is followed by a STATUS_Error.

safe_mode_error

The message text is "Never" for failures that occur in Safe and SemiSafe mode, and "SemiSafeOnly" for errors that can be avoided by running in SemiSafeMode. This is followed by a STATUS_Error.

temp_directory

The directory of %Temp%.

update_output_config_xml

The message will be the XML that is the configuration for this tool.

warning

A warning has been reported. The message will be the warning message.

Read-only Values

field_conversion_error_limit: The maximum number of conversion error messages to display. This limit value only affects the number of field conversion error messages that are displayed.

Methods

create_connect_metadata

Converts the metadata dictionary into XML written to the Connect log.

create_connect_metadata((int)nToolID, (dict)metadata) -> void :

The metadata dictionary can contain any of these keys:

  1. Database: An electronically organized collection of data.

  2. DatabaseVersion: A number stamped in the boot page of a database that indicates the SQL server version of the most recent SQL server instance.

  3. DriverType: For supported database connections, see Supported Data Sources.

  4. DriverVersion: The version of the driver used to connect to a data source, like a database.

  5. Host: A network where a computer is connected to a computer network.

  6. PluginName: An entry point file.

  7. Port: A part of a computer device (hardware) that is available for connection to other devices i.e. input and output devices.

  8. Query: A request to retrieve information from a computer system that is processed by a software program rather than a person.

  9. Schema: An outline or model.

  10. Table: A collection of data organized in columns, rows, and cells.

create_temp_file_name

Returns a newly created unique temp file path from the Engine. The Engine cleans up the file later.

create_temp_file_name((str)extension='tmp', (int)options=0) -> str :

Supported options include:

  • 0: A normal temp file.

  • 1: A temp file for a GUI element, such as a browse, that the GUI is responsible for cleaning up.

  • 2: A temp file for a GUI element, such as a browse that the GUI is responsible for cleaning up. Additionally, the file name is not made to be unique. Use when the extension argument already contains a unique ID.

decrypt_password

Returns a string of encrypted or decrypted text, and works with user and machine encryption.

decrypt_password(encrypted_password, mode) -> str :

encrypted_password: The text to be treated.

Supported options include...

  • 0: Decrypt: Make the message intelligible.

  • 2: Machine encryption: The process of encoding a message in such a way that only authorized parties can access the information. Encryption is based on the machine, and cannot be decrypted on a different machine (the gallery is a good example of this).

  • 3: User encryption: The encryption is based on the user, and will not be decryptable on another machine where you are logged in as a different user (the gallery is a good example of this).

get_constant

Returns the finite ordered list [str name, str alt_name, str value, bool is_numeric] where alt_name is based on the connection name.

get_constant((int)tool_id, (int)which) -> object :

Returns None if the which argument is invalid.

get_init_var

Returns the value of a global init_var from the Engine.

get_init_var((int)tool_id, (str)var_name) -> str :

Valid variables include:

  • ActionApplies: Returns "True" or "False" if there is a wizard action referring to this tool.

  • AllowDesktopInteraction: Returns "True" or "False."

  • DefaultDir: Returns the directory that should be used for relative paths.

  • EnablePerformanceProfiling: Returns "True" or "False."

  • NumThreads: Defines the number of threads to be executed in a single thread group when a compute shader is dispatched.

  • OutputRecordCounts: Returns "True" to output record counts, False to not.

  • RunMode: Returns "Safe," "SemiSafe," or "Standard." Used for web "safe-ness."

  • RunningAsWizard: Returns "True" or "False."

  • RuntimeDataPath: Returns the full path of the RuntimeData folder from an Alteryx installation.

  • SerialNumber: Returns the Alteryx serial number.

  • SettingsPath: Returns the full path of the Settings folder from an Alteryx installation.

  • TempPat: Returns a path for a temp file. Use create_temp_file_name for similar functionality that automatically deletes the temp file when Alteryx closes.

  • UpdateMod: Returns "", "Quick," or "Full."

    Example: When you hit Run on a workflow, UpdateOnly is false, and UpdateMode is blank. When you hit F5 or open a workflow, a Full update is performed (UpdateOnly is true and Update mode is "Full"). If you drop a tool below another tool, it sends a Quick update to the upstream tool so it can get metadata (UpdateOnly is true, and UpdateMode is "Quick"). This is how a select tool gets all of the field names and types when you drop it after another tool.

  • UpdateOnly: Returns "True" or "False." Blank when UpdateOnly is false and can either be quick or full when UpdateOnly is true.

  • Version: Returns the Alteryx Engine version in the form of "2.1.0.3."

output_message

Notifies the AlteryxEngine of any messages generated by a tool. Set tool_id to -1 for a global error not related to a tool.

output_message((int)tool_id, (int)status, (str)message) -> int :

Returns 1 if the plugin should stop processing, otherwise returns 0.

status: A value of AlteryxPythonSDK.status.

debug_message_out

Displays messages in the results grid or console window if the workflow user constant EnableDebugMessages is set to True.

注記

If set to anything else or not set, it will not output messages.

debug_message_out((int)tool_id, (int)status, (str)message) -> int :

Returns 1 if the plugin should stop processing, otherwise returns 0.

status: A value of AlteryxPythonSDK.status.

output_tool_progress

Notifies the AlteryxEngine of a tool's progress.

output_tool_progress((int)tool_id, (float)percent_progress) -> int :

Returns 1 if the plugin should stop processing. Otherwise, returns 0.

  • tool_id: The ID for the tool calling the function.

  • percent_progress: The percent completion for the tool. The percentage must be in the range [0.0,1.0].

Progress Update Requests

A plugin is asked by upstream tools or the engine to update its progress through the ii_update_progress method. It is the responsibility of the plugin to request that any downstream tools likewise update their progress by calling update_progress on OutputAnchor.

pre_sort

Pre-sorts an incoming data connection. pre_sort may only be called during pi_add_incoming_connection.

pre_sort((str)incoming_connection_type, (str)incoming_connection_name, (str)sort_info) -> None :

  • incoming_connection_type: The type of the connection.

  • incoming_connection_name: The name of the connection.

  • sort_info: The XML text that defines the fields to sort and optionally filter the input data by.

Write the XML string in the following format:

<SortInfo> <Field field="SortField1" order="Asc" /> <Field field="SortField2" order="Desc" /> ... </SortInfo> <FieldFilterList> <Field field="FilterField1" /> <Field field="FilterField2" /> ... </FieldFilterList>

If the FieldFilterList section is not specified, all fields are passed through.