Recently I have been exploring how to use Tableau’s command line tool to update published extracts on Tableau Server. “Productinizing” more and more aspects of Tableau. This is an easy way to trigger an extract to update after the job has completed. The problem with schedules in Tableau is that by definition they are schedules, and sometimes your data just doesn’t come in on a predictable schedule. You could trigger a refresh manually by using “Add Full Refresh” option under scheduled tasks and pressing “(Run Now).” However if you learn how to use the tableau command line, then you could put it into a batch file and run it automatically from a server. SQL server can execute a batch file as a job step, and it can also execute it from a stored procedure.
Here is Tableau’s online documentation for this feature:
Additional features are listed here. Apparently there is also way to print to a default printer!
Now there are some pitfalls that I have come across and wanted to share them so it could potentially decrease headaches. Specifically I encountered this nice error:
Tableau Data Engine Error: 4: Invalid Command: database: Path does not exist
Possible Problem #1) The data source must me made with the current version of the server.
So lets say you build a cool report and you schedule it. It runs perfectly for dozens of weeks. You download 8.2 or 9.0 and forget about this report. Ages later you come around to needed to update that extract via the command line program. You will encounter that nice message above. Um, yeah so which path is that? The server? The Site? The Project? or the datasource? After searching the internet, I found a few things that could have been the problem. Finally I read something that said my extract was made with a past version of Tableau. I knew that had to be the case because I am very eager to update my Tableau desktop versions as soon as new ones are released.
Solution: Create the extract from scratch.
Now if you are like me and use fewer SQL formulas and more Tableau formulas then the thought of duplicating all the groups / sets / calculations / parameters into a new dataset is boring and lame. Fortunately the amazing people at Tableau made copying and pasting calculated things extremely easy. All you need to do is open up the new extract and the old. Right click the calculated field and choose “copy”, (DO NOT CTRL+C YOU SLACKERS). Then go into the other dataset, right-click and press “paste”. Boom! Simple. Hold down control, select several fields, menu-copy, menu-paste and Boom “That was easy”, to quote Staples.
Possible Problem #2) Datasource is live. It must be an extract.
This is obvious and should be an easy fix. I almost exclusively use and publish extracts. This is because most data I work with is fairly large. If however if you are publishing many data sources, you may occasionally forget which ones are extracts and which ones are live connections. This tripped me up once. I was certain that it couldn’t be problem #1 because I had just made and published the dataset, but I got the same error. This makes sense, since the extension for a Tableau Data Extract (.tde) is not the same again as a data source connection ().
Solution: Make it an extract
This is what success looks like: