tableau_tools 4.0 is coming soon

I don’t normally post about things before they are ready, but tableau_tools 4.0 is getting close to release, and I am excited about how much it has improved. This is the big one, and if will probably break all your old scripts, so get ready for some cleanup, but I promise it is worth it.

The 4.0.0 branch is available on GitHub, and you can preview the README files now

tableau_rest_api README

Here are all the big changes:

  • Up to date for version 10.3 / API version 2.6: All methods from all versions are now supported
  • tableau_documents updated to handle version 10 style data sources with cross-database connections.
    • Vastly simplified model of: TableauFile->TableauDocument (Datasource or Workbook)->Datasources->Connections
    • Most getter/setters replaced with properties
    • Merging of the DatasourceGenerator with the actual TableauDatasource class so that single class can work with existing datasources to modify or build one entirely from scratch
    • Improved handling of large workbooks and datasources
  • Massive cleanup of all REST API methods: There is now one method to do anything related to that action, with optional parameters if you need more specificity.
  • Name vs. LUID lookup built in: Every method that can autodetects whether a LUID is being passed, and if not, does a name lookup automatically. You can use real names in almost every method without having to do the lookup first
  • Versioning handled by subclass inheritance. “What is this?” you may be asking. Basically, tableau_tools now implements each new version of the Tableau REST API as a subclass of the previous class, so it retains all features of the older versions, while adding new methods and updating those that have new features. Subclasses for versions are named like: TableauRestApiConnection23 or TableauRestApiConnection26
  • All permissions are handled through the PublishedContent classes: Project, Workbook, Datasource
    • All work on Projects is handled through a Project object.
    • Workbooks and Datasources still require requesting their PublishedContent objects
    • GranteeCapabilities object renamed to Permissions
    • Changes to Permissions must be accomplished via Permissions object
  • lxml removed and replaced fully with Python standard library ElementTree. No more need to install lxml binaries on Windows!
  • All XML requests are now built via ElementTree rather than as text strings
  • docstring typing for all parameters and returns. If there’s no docstring, the method hasn’t been updated yet. This means PyCharm or your other IDE can tell if you are passing in the right types to a given method. Some people will complain this is less Pythonic, but I promise type-safety is incredibly useful

Future goals for the 4.X series:

  • Python 3.3 compatibility
  • Using the requests library for HTTP calls (if there is any benefit, might be worth it for Python 3)

Behold! Emailer 1.2 Introduces Bulk E-mail Mode

The original release of Behold! Emailer was focused on the need of Tableau Server users who wanted to schedule e-mail reports of a PDF from a full workbook. In version 1.2.0, available on GitHub, a Bulk tab has been added to allow for running through lists of jobs to send out to any users. This is useful when you need to push out static results, perhaps filtered on certain factors, to sets of users who are not on the Tableau Server. As long as the output is a static PDF or CSV and not a TWBX, this falls within the Tableau EULA (at the time of writing).

How does it work? Create a CSV file (including the headers) on the following pattern:

To:,CC:,BCC:,Site,View Location,Filter Field Name 1,Filter Values 1,Filter Field Name 2,Filter Values 2,Filter Name 3,Filter Values 3,...

You’ll notice the ellipses at the end (don’t actually include them). That signals that you can make as many slots for additional parameters and filters as you need (up to 25). Just follow the naming convention for the additional fields.

To include multiple items for filtering, separate them with a semi-colon (“;”), like the following:

To:,CC:,BCC:,Site,View Location,Filter Field Name 1,Filter Values 1,Filter Field Name 2,Filter Values 2,Filter Name 3,Filter Values 3
aperson@tableau.com,,,default,BasicSuperstoreSQLServer/Sheet1,Category,Technology;Office Supplies,YEAR(Order Date),2013;2014,,

The program will automatically convert things into lists or change the semi-colons into the right separators. All URL encoding is handled automatically — just make the CSV and load it in. Reference things exactly as you would in Tableau (notice the YEAR(Order Date) example above), with no spaces between the commas.

 

Developing and Deploying Tableau Content

When you use Tableau in an embedded solution, the “Tableau method” of Desktop users publishing in a free-form method to the Tableau Server on a single site often doesn’t cover the requirements for controls and QA that a software development effort requires. While the classic “dev-test-qa-prod” is not as necessary with Tableau,  any SaaS customer that is embedding Tableau will need a process for deploying Tableau to their customer’s sites from templates.

In this post, I’ll go over the deployment methodology my team recommends to customers. We’ll be looking at the two separate phases, which are often split into different teams: (1) Development (2) Deployment.

Many thanks to Tyler Dugal who helped develop much of this content for our presentation at TC16.

(more…)

Defaulting to Today (Relative Date) on a Date Range Filter in Tableau

Tableau has two different type of Continuous Date Filters: Relative Date Filters and Date Range filters. While it’s easy enough to switch between them in Desktop, there is no way to flip a Relative Date filter into a Date Range Selector in a view published in Server (without using Web Edit). What if you’d like a default date range relative to today to be selected, but give the user the option to make their own selection?

The classic solutions have involved parameters , but if that is too clunky, here’s a new solution, based on Tamás Földi’s fantastic solution for using the JavaScript API within a published dashboard. A similar solution could set Parameters to a default value rather than Date Range filter. You could even pipe the Tableau Username back into the viz as a parameter automatically for use as a Parameter in Custom SQL (not secure, but at least automatic).

(more…)

Introducing Behold! Emailer – Scheduled PDF Emails from Tableau Server

Tableau Server has long had the capability to export into the PDF format — with the appropriate design, it will even export all of the data in a viz that can scroll. However, an end user cannot currently choose to receive their daily scheduled e-mails with a PDF export rather than a PNG, and that also means they can’t receive a “full detail” export, even if the workbook is configured correctly.

For many of the customers I’ve worked with, this functionality isn’t something they are excited about from an analytics perspective, but one that is required of them, either from a regulatory perspective or from business process. Simply put, it can be valuable to prove at a given time what numbers were used to make a decision, whether you are being audited or just trying to double check a decision.

Today I’m releasing Behold! Emailer version 1.0.0, a Windows program available on GitHub both as source and as a released binary with all necessary resources. As with all of the code I’ve released, this is NOT OFFICIALLY SUPPORTED BY TABLEAU, which means the Tableau Technical Support team will not help you one bit with it. However, I am very interested in improving and hearing feedback.

Read more to see how to use the tool, and how it works. Download the latest version here.

(more…)

Exporting Scrolling Worksheets in a Dashboard to PDF

Let’s say you have a Dashboard in Tableau, where at least one Worksheet is a list long enough to have a vertical scrollbar. If you export to PDF in Tableau Server, you will only get an single page, with an image of the scrollable sheet at the top of its scrolling. If you want to give your users the ability to get a PDF with ALL of the data included, you’ll need to set up your workbook in a particular fashion, based on the following rule:

Worksheets that scroll will export out as multiple pages, showing all of the data. Dashboards export out as a single page always.

With this in mind, you can build your Workbooks in the following way:

  1. Put your Dashboard tab first
  2. Put any sheets that scroll in a dashboard directly after the Dashboard tab
  3. Hide any sheets that do not scroll in a dashboard

scrollable-pdf

The user needs to choose “Sheets in Workbook” to get both the Dashboard and the Sheets with all the details, but you can choose which sheets you want in the selector at the bottom.

(more…)

Ad Hoc Tableau Server Reports with Default Formatting

Prior to Tableau 10, all formatting was done on a worksheet by worksheet basis. Tableau Desktop now has a concept of “workbook formatting” which become the default for any new worksheet. Each version of Tableau is bringing more formatting options into the scope of workbook formatting (for example, line formatting is being added in 10.2), but not everything is available yet.

Make a Template Worksheet and Dashboard

For any option available in workbook formatting, you should set it there (in the Format->Workbook menu at the top). For other things, like background shading, you should create both a template worksheet and a template workbook.

For the template worksheet, I suggest creating a Calculated Field with a simple message indicating that it is a template to be copied. Drag the field onto Text and change the fill type selector at the top from “Standard” to “Entire View” to make your message show up.  Use the Format->Worksheet menu to set everything you’d like.

Next make a template dashboard the same way, and drag out the Template Worksheet. In the end, it will look something like this:

formatting-template

Now publish it to Tableau Server. Rather than having users start their ad hoc analysis from a Data Source, have them start from the Ad Hoc Template Workbook. When they Save As to a new workbook, they can delete the templates sheet and dashboard because the new sheets will have that formatting which they can duplicate from.