Pass Expressions with Analytics Extensions

Tableau supports a set of functions that you can use to pass expressions to external services for integration with R, MATLAB, and Python. Previously, this feature was referred to "external services."  Beginning in version 2020.1, this functionality is referred to as analytics extensions.

Tableau supports integration with the following services:

SCRIPT functions for expressions

In Tableau Desktop, a set of four SCRIPT functions are available for passing expressions to analytics extensions and obtaining a result. The functions are:

SCRIPT_BOOL

SCRIPT_INT

SCRIPT_REAL

SCRIPT_STR

See SCRIPT_BOOL for details and examples. Because these SCRIPT_ functions are table calculations functions, addressing and partitioning concepts apply. (For an explanation of these concepts, see The basics: addressing and partitioning.) Tableau makes one call to an the analytics extension per partition.

Because connecting to an analytics extension involves some overhead, try to pass values as vectors rather than as individual values whenever possible. For example if you set addressing to Cell (for example, by clicking the field in the view and choosing Compute Along > Cell), Tableau will make a separate call per row to the analytics extension; depending on the size of the data, this can result in a very large number of individual calls. If you instead use a column that identifies each row that you would use in the level of detail, you could compute along that column so that Tableau could pass those values in a single call.

Configure an analytics extensions connection

Tableau allows connections to analytics extensions via a set of SCRIPT functions. In order to use these analytics extensions, you must establish a connection to an external server. Connections to Rserve, MATLAB Server, and Python Server are currently supported.

For R, you need access to a server which allows applications to access R functionality. See Rserve(Link opens in a new window) for details. For information on installing, running, and configuring Rserve, as well as on optimizing R scripts and R security, see the Tableau Community post R Implementation Notes(Link opens in a new window). For more information about using R with Tableau, see the blog post Tableau 8.1 and R(Link opens in a new window).

Tableau Desktop can connect to R via either plaintext or SSL-encrypted traffic. For direction on which type to use, consult your system administrator.

Note: For R integration, Tableau has been tested with R versions 3.4.4 through 3.5.1, and with Rserve versions 0.6-8 through 1.7.3.

To configure an analytics extensions connection:

  1. In Tableau Desktop, click the Help menu, and then select Settings and Performance > Manage Analytics Extension Connection.

    Example of Analytics Extensions connection dialog box set up for an Rserve or TabPy connection.

  2. Specify the type of analytics extension you want to connect to: RServe or TabPy/External API. The TabPy/External API option covers connections to TabPy and MATLAB.

  3. Enter or select a server by domain name or IP address. The drop-down list includes Localhost and the server you most recently connected to, as well as the Disable option.

  4. Enter or select a server name using a domain or an IP address. The drop-down list includes localhost and the server you most recently connected to.

  5. Specify a port.

    • Port 6311 is the default port for plaintext Rserve servers.

    • Port 4912 is the default port for SSL-encrypted RServe servers.

    • Port 9004 is the default port for TabPy.

  6. If the server requires credentials, select Sign in with a username and password to enable the Username and Password fields. Add your credentials for these fields.

    If your server is using SSL encryption, select the Require SSL option. Tableau Server will read certificates installed in the operating system key store to establish the secured connection.

    Note: Tableau only supports PEM encoded certificates when connecting to TabPy or RServe.

  7. Click Test Connection.

  8. Click OK.

If no connection can be established, an error message is displayed. Click Show Details in the message to see any diagnostic information returned by the server.

Share a workbook that requires an analytics extension connection

You might need to send a workbook that contains analytics extension functionality to other users, who may be using different copies of Tableau Desktop on other computers. Or, users may download a workbook from Tableau Server that contains analytics extension functionality. If you share your workbook with someone, they must configure analytics extension connections on their computers.

Publish a workbook that requires an analytics extension connection

Before you publish a workbook that relies on an analytics extension connection to Tableau Server, you must configure Tableau Server to have its own analytics extension connection. See "Configure Connection with Analytics Extension" (Windows(Link opens in a new window)Linux(Link opens in a new window)) in the Tableau Server Help.

You cannot publish a workbook that contains analytics extension scripting to Tableau Online.

Intermediate certificate chain for Rserve analytics extension

As of Tableau Server version 2020.1, you must install a full certificate chain on Tableau Desktop computers (Windows and Mac) that are connecting to a Rserve external connection through Tableau Server. This requirement is due to how Rserve manages the handshake on secure connections.

Importing a root certificate on the Tableau Desktop is not sufficient, the entire certificate chain must be imported onto the client computer.

Thanks for your feedback! There was an error submitting your feedback. Please try again.