TabPy server installation and setup for Tableau
Introduction
TabPy (the Tableau Python Server) is an Analytics Extension implementation which expands Tableau’s capabilities by allowing users to execute Python scripts and saved functions via Tableau’s table calculations.
Requirements
Python 3.6 +
Pip
Running Tableau server
Installation directions
Note
Its recommended that tabpy be executed in a virtual environment and that is the installation and setup process highlighted below
Update pip
Install virtualenv package
Create the Tabpy folder structures. This will be used to hold files needed by Tabpy and those generated by it such as logs. See example below in /opt/tabpy_server/ i.e.
Create virtual environment
Activate the environment
Install Tabpy
Create a password file. This file will be used to hold username and encrypted password details for Tabpy users
Create a Tabpy user
Create a configuration file. This file allows you to pass runtime options to Tabpy easily when starting up
Create a startup script to run tabpy in the background using nohup
Check that server is running successfully and listening to port 9004
Setting up Tabpy extension on Tableau
After installing Tabpy, we need to add it under Analytics Extensions on Tableau. To do this:-
Navigate to Settings → Extensions → Analytic Extensions
Enable Analytics Extension for Site and restart Tableau
Once done, click on Create new connection and select Tabpy
Fill out the details on the form as below:-
Connection name: Unique name to identify this connection entry
Require SSL: Select No unless you have enabled HTTPS on Tabpy config
Hostname: FQDN or IP of node where Tabpy is installed
Port: 9004
Sign in with username and password: Yes
Username and Password: Enter details of user you created earlier
Configuration File Content
Configuration file consists of settings for TabPy itself and Python logger settings. You should only set parameters if you need different values than the defaults.
[TabPy] parameters:
TABPY_PORT - port for TabPy to listen on. Default value - 9004.
TABPY_QUERY_OBJECT_PATH - query objects location. Used with models, see TabPy Tools documentation for details. Default value - /tmp/query_objects.
TABPY_STATE_PATH - state folder location (absolute path) for Tornado web server. Default value - tabpy/tabpy_server subfolder in TabPy package folder.
TABPY_STATIC_PATH - absolute path for location of static files (index.html page) for TabPy instance. Default value - tabpy/tabpy_server/static subfolder in TabPy package folder.
TABPY_PWD_FILE - absolute path to password file. Setting up this parameter makes TabPy require credentials with HTTP(S) requests. More details about authentication can be found in Authentication section. Default value - not set.
TABPY_TRANSFER_PROTOCOL - transfer protocol. Default value - http. If set to https two additional parameters have to be specified: TABPY_CERTIFICATE_FILE and TABPY_KEY_FILE. Details are in the Configuring HTTP vs HTTPS section.
TABPY_CERTIFICATE_FILE - absolute path to the certificate file to run TabPy with. Only used with TABPY_TRANSFER_PROTOCOL set to https. Default value - not set.
TABPY_KEY_FILE - absolute path to private key file to run TabPy with. Only used with TABPY_TRANSFER_PROTOCOL set to https. Default value - not set.
TABPY_LOG_DETAILS - when set to true additional call information (caller IP, URL, client info, etc.) is logged. Default value - false.
TABPY_MAX_REQUEST_SIZE_MB - maximal request size supported by TabPy server in Megabytes. All requests of exceeding size are rejected. Default value is 100 Mb.
TABPY_EVALUATE_ENABLE - enable evaluate api to execute ad-hoc Python scripts Default value - true.
TABPY_EVALUATE_TIMEOUT - script evaluation timeout in seconds. Default value - 30. This timeout does not apply when evaluating models either through the /query method, or using the tabpy.query(...) syntax with the /evaluate method.
TABPY_GZIP_ENABLE - Enable Gzip support for requests. Enabled by default.
Sample configuration file
Links
That’s it. Just restart and use it.
Comments
Post a Comment