Changing Parameters in Workbook XML

Parameters allow for a lot of awesome Tableau functionality. When working with template publishing, it makes sense that you might want to do variations on the display names for a parameter, or even set the options arbitrarily for each site you will publish to. However, despite looking like part of a data source, Parameters are actually stored as their own data source within a workbook. This means we’ll need to consider how to insert and modify them in each workbook.


Assigning Colors via XML Modification

In Tableau, colors are assigned to a given dimension across the workbook (as opposed to just per sheet). This assignment actually happens in the XML, which means you can substitute in different color assignments if you are publishing from templates. Even better, in Tableau 10.0, if you assign colors from one of the included color palettes, new items will automatically be assigned a color from that palette.


Triggering Extract Refreshes with tableau_tools

If you have ETL processes that must run before your extracts can generate, it may make more sense to trigger an extract refresh (or the schedules) to run after the ETL has finished, rather than setting the extracts on a schedule. It maximizes your backgrounder processes by feeding their queues immediately when data is ready, and saves wasted effort if the ETL process fails.

As of Tableau Server version 10.0, there are no REST API commands to do this triggering, but tabcmd does have commands that can accomplish this. The tableau_tools Python library  has a Tabcmd class that wraps the most common tabcmd commands, including those for extract refreshes. Together with the tableau_rest_api sub-package, you can trigger off extract refreshes.

Note: Please use the latest version of tableau_tools (3.1.0+) to do the following.


Setting, Auditing, and Modifying Permissions Programmatically Using tableau_tools

One of the biggest benefits of the Tableau Server REST API is that it allows you to set permissions programmatically. Tabcmd can’t do this, so it’s a feature unique to the REST API. In a multi-tenant deployment, it’s absolutely a necessity. But Tableau’s permissions are have a lot of options, and thus working with them in the REST API requires setting a lot of options. In the process of working through common customer use cases, I’ve ended up working through a lot of the complexities, with the aim to add useful shortcuts and examples so that others can more easily get started.

Section 4 – Permissions of the guide to the tableau_rest_api sub-package of the tableau_tools library covers the basics of the permissions functionality in the the tableau_rest_api package. In this post, I’ll give further examples of many common permissions requests.

Note: Please upgrade to the latest tableau_tools package (minimum 3.1.0) for the following to work.


Using getData in Tableau 10 to create tables from any Viz

Tableau 10’s JavaScript API has a new getData interface which allows you to get summary and underlying data directly as JavaScript objects. I’ve already shown a use case to use these methods for simply grabbing values. But a wider use case is creating an HTML table from any Tableau visualization, particularly if 508 compliance requires that you make all data available via a screen reader. Even if you don’t need compliance, you may just want to control how Tableau displays its underlying data. The full working example is here on GitHub.