Skip to content

bigfunctions > refresh_tableau

refresh_tableau

Call or Deploy refresh_tableau ?

✅ You can call this refresh_tableau bigfunction directly from your Google Cloud Project (no install required).

  • This refresh_tableau function is deployed in bigfunctions GCP project in 39 datasets for all of the 39 BigQuery regions. You need to use the dataset in the same region as your datasets (otherwise you may have a function not found error).
  • Function is public, so it can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
  • You may prefer to deploy the BigFunction in your own project if you want to build and manage your own catalog of functions. This is particularly useful if you want to create private functions (for example calling your internal APIs). Discover the framework

Public BigFunctions Datasets:

Region Dataset
eu bigfunctions.eu
us bigfunctions.us
europe-west1 bigfunctions.europe_west1
asia-east1 bigfunctions.asia_east1
... ...

Description

Signature

refresh_tableau(workbook_or_datasource_title, site, server, token_name, token_secret)

Description

Refresh a tableau datasource or workbook named workbook_or_datasource_title.

Use case:

After model refresh, launch tableau datasource / workbook refresh from BigQuery in SQL

graph refresh tableau

Docs

  • Tableau's doc for creating a personnal access token on tableau server (cloud or onprem) for api usage

Encrypt your secrets

We advise NOT TO write your token in plain text in token_secret argument.

Otherwise, they will be stored in plain text in your BigQuery logs for months.

Instead, you can use the following snippet to generate an encrypted version of token_secret that you can copy safely as token_secret argument.

This public bigfunction (deployed on bigfunctions GCP project) will be able to decrypt it. But no one else can.

Examples

select bigfunctions.eu.refresh_tableau('My Great Workbook', 'site_name', 'eu-west-1a.online.tableau.com', 'token_name', 'ENCRYPTED_SECRET(GvVm...)')
select bigfunctions.us.refresh_tableau('My Great Workbook', 'site_name', 'eu-west-1a.online.tableau.com', 'token_name', 'ENCRYPTED_SECRET(GvVm...)')
select bigfunctions.europe_west1.refresh_tableau('My Great Workbook', 'site_name', 'eu-west-1a.online.tableau.com', 'token_name', 'ENCRYPTED_SECRET(GvVm...)')
+----------+
| response |
+----------+
| ok       |
+----------+

Need help using refresh_tableau?

The community can help! Engage the conversation on Slack

For professional suppport, don't hesitate to chat with us.

Found a bug using refresh_tableau?

If the function does not work as expected, please

  • report a bug so that it can be improved.
  • or open the discussion with the community on Slack.

For professional suppport, don't hesitate to chat with us.

Use cases

A common use case for the refresh_tableau function is automating the refresh of Tableau dashboards after underlying data has been updated.

Scenario: Imagine a company that uses BigQuery to store sales data and Tableau to visualize this data in dashboards. They have a daily ETL process that updates the sales data in BigQuery. They want their Tableau dashboards to reflect this updated data automatically.

Implementation using refresh_tableau:

  1. Tableau Setup: A personal access token is created in Tableau Server with appropriate permissions to refresh the target datasource or workbook.

  2. BigQuery Implementation: The refresh_tableau function is called within a BigQuery script, scheduled to run after the daily ETL process completes. This script would look something like this (using the US region example):

-- Assume the ETL process has just finished updating sales data.

SELECT bigfunctions.us.refresh_tableau(
    'Sales Dashboard',  -- Replace with the actual workbook/datasource name
    'site_name',        -- Replace with the Tableau site name
    'eu-west-1a.online.tableau.com', -- Replace with your Tableau server address
    'token_name',       -- Replace with your token name
    'ENCRYPTED_SECRET(GvVm...)' -- Replace with your encrypted token secret
);
  1. Orchestration (Optional): A workflow orchestration tool like Cloud Composer or Cloud Functions could be used to manage the dependencies between the ETL process and the BigQuery script. The orchestration tool would ensure that the refresh_tableau function is called only after the ETL process has successfully completed.

Benefits:

  • Automation: Eliminates the need for manual refreshes, saving time and ensuring data consistency.
  • Data Freshness: Dashboards always reflect the latest data.
  • Integration: Seamlessly integrates with BigQuery ETL processes.
  • Centralized Management: Tableau refresh logic is managed within BigQuery, simplifying administration.

This automation ensures that business users always have access to the most up-to-date insights in their Tableau dashboards without any manual intervention. The encrypted secret provides a secure way to manage the Tableau access token within the BigQuery environment.

Spread the word

BigFunctions is fully open-source. Help make it a success by spreading the word!

Share on Add a on