# Tableau Server Export Integration Using [Tableau Server](http://www.tableausoftware.com/products/server) with Treasure Data allows you to interactively explore substantial amounts of data and share data information across your organizations. ![](/assets/image2020-12-2_17-7-23.aa1dbb6b2c4b1cf723905a90d52d52e61dd6cc69d409029cc659576148c565a1.6bbebcc1.png) For sample workflows of exporting to Tableau Server, view [Treasure Boxes](https://github.com/treasure-data/treasure-boxes/tree/master/td/tableau). ## Prerequisites - Basic knowledge of Treasure Data. - A license and its installation of the Tableau Server. - You must set up HTTPS (SSL). [Configure SSL](http://onlinehelp.tableau.com/current/server/en-us/ssl_config.htm) on your Tableau Server. ## Limitations - Tableau doesn't support fractional seconds in a timestamp. Remove fractional seconds (e.g., using the subtle () function) before casting the timestamp to the TIMESTAMP type in the query. - The maximum result record is 250,000,000 records. If exceeded, the log displays the message: Extract file records limit exceeded: 250000000. - The lowest Timestamp value is 1000-01-01 00:00:00. If exceeded, the log displays the invalid date value message. - .hyper extracts published to Tableau Server 10.5 via REST API will have the .tde file extension on the Tableau Console. These extracts were still in .hyper file format and functioned similarly to other .hyper extracts. The issue is fixed in **2018.1**. More details: [Tableau Server 2018.1 Release Notes](https://www.tableau.com/support/releases/server/2018.1) (search for Issue ID 754677) - A Data Source belonging to a nested Project cannot be appended by using a REST API. A **Resource Not Found** error is returned. **Replace mode** does not have this issue. A fix is planned for **Tableau Server 2018.1.4**. If you encounter this error, it's recommended that you upgrade to the latest version of Tableau Server. - When you authenticate with a PAT, you can only run one process using that PAT at a time (unlike when you authenticate using a username and password). If you run a second authentication using the same PAT while the first job is still running, it causes the authentication/authorization for the first job to be dropped and results in errors. It results in the following message in the job logs: ``` 2021-12-26 07:55:47.926 +0000 [WARN] (0001:transaction): Retrying 2/7 after 2 seconds. Message: javax.ws.rs.WebApplicationException: HTTP 401 Unauthorized .... 2021-12-26 07:57:53.523 +0000 [ERROR] (main): org.embulk.util.retryhelper.RetryGiveupException: java.lang.NullPointerException ``` Tableau will deprecate support for the TDE file format across the suite of Tableau products. Starting in June 2022 with the release of 2022.2, Tableau Online and Public will not allow TDE content to be published. Beginning in March 2023 with release 2023.1, Tableau Server, Desktop, and Prep will no longer support the TDE file format. ### Migrating Existing Output Configurations to Tableau Hyper Tableau has updated its data engine with a technology called Hyper. To take advantage of this, you must update your existing Treasure Data output configurations. New Treasure Data configurations automatically use the latest version. To upgrade your existing configurations: 1. Go to Queries and select your scheduled query. 2. In Query Editor, select **Export Results** target. 3. Choose your saved Tableau connection. 4. Input the **Site ID** value; it’s **required** for multi-tenant Tableau Server (leave it empty if you sign in to Default site). 5. Select 'hyper' for **Data Source Type**. 6. Select **Done** to save your configuration. When migrating from the legacy Tableau to the current Tableau, you do not need to change the timezone configuration. You can leave the default value (UTC). See also the [timezone](http://docs.treasuredata.com/display/PD/Tableau+Online+Export+Integration) in this article. ## Obtain Tableau Connection Information From the command line from within the Tableau apps or from your Tableau administrator, obtain the following: - Host - Username - Password - Server Version Your user profile to connect to Tableau should have read and export rights. To determine the value to use for the `site` attribute, sign in to Tableau Server, and examine the value that appears after `/site/` in the URL. For example, in the following URL, the `site` value is `MarketingTeam`: `https://MyServer/#/site/MarketingTeam/projects` If the `site` The attribute is an empty string, and you are signed in to the default site. You are always signed in to a specific site, even if you don’t specify a site when you sign in. Read the [REST API reference](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#Sign_In?TocPath=API%2520Reference%7C_____89) for the Tableau Server. The Tableau Online Authentication method with User/Password was deprecated and replaced by PAT (personal access token) To obtain PAT: [https://help.tableau.com/current/pro/desktop/en-us/useracct.htm#create-and-revoke-personal-access-tokens](https://help.tableau.com/current/pro/desktop/en-us/useracct.htm#create-and-revoke-personal-access-tokens) ## Project There should be at least one 'Default' project on the Tableau Server. You can't delete or rename this project. The' Default' project is used if you omit the **Project Name** option. In some rare cases, primarily non-English Tableau Server, the 'Default' project name is localized, and jobs fail if you don't provide a **Project Name** (because it couldn't find a project with 'Default' as the name). ## Use the TD Console to Create Your Connection ### Create a New Connection You must create and configure the data connection in Treasure Data before running your query. As part of the data connection, you provide authentication to access the integration. 1. Open **TD Console**. 2. Navigate to **Integrations Hub** > **Catalog**. 3. Search for and select Tableau. ![](/assets/image2021-3-12_13-20-5.a1071a0937757e2df6b94965f5844e53d90053643dc3b01a7d929f677b160028.6bbebcc1.png) Select Create Authentication. Type the credentials to authenticate. ![](/assets/image2023-5-29_21-4-28.d225e8bffa723db3b44d3bf050d9ce08bdc563d8fde94e12bb5ffb783b2050a1.6bbebcc1.png)![](/assets/image2023-5-29_21-5-28.875a458d082f0d0485c58e126ab98c6e245f8c6b200b1c36604f2ac4ec050c01.6bbebcc1.png) Type a name for your connection. Select Done. ### Define your Query ### Integration Parameters for Tableau ![](/assets/screenshot-2024-11-27-at-15.32.58.e0318acf80f8c82d6fda7fc04da7270b687e55cb23c473e05cbc3b134233ed8f.6bbebcc1.png) | Parameter | Values | Description | | --- | --- | --- | | Datasource Name | | The name you want to use for this data export. | | Site ID | | Required for a multi-tenant server configuration, such as Tableau Online. If you don’t have a specific Site, set `EMPTY String` for Tableau Server The URL of the site to sign in to (optional) To determine the value to use for the `site` attribute, sign in to Tableau Server, and examine the value that appears after `/site/` in the URL. For example, in the following URL, the `site` value is `MarketingTeam`: `https://MyServer/#/site/MarketingTeam/projects` If the `site` attribute is an empty string, you are signed in to the default site. You are always signed in to a specific site, even if you don’t specify a site when you sign in. Read the [REST API reference](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#Sign_In?TocPath=API%2520Reference | | Project Name | | Required if your Tableau Server does not have a 'Default' project. It is recommended that you fill it out for non-English locales. Go to your Tableau Server to get a list of projects. | | Mode | append replace | `replace` to replace Data Source each time, `append` to append to existing Data Source Append Mode ignores new columns if it is exporting data inserted from an existing data source because of the [specification of the Tableau](https://onlinehelp.tableau.com/current/pro/desktop/en-us/extracting_addfromfile.md). | | Data Source Type | hyper tde | Hyperfiles contain one or more tables worth of data. tde is a file format for Tableau data extraction. | | Extract File Chunk Size | | An extract file is split into chunks before it is exported to Tableau. Indicate a chunk size between 50 to 512 MB Chunk file size (in MB) to be uploaded each time, default: 200, min: 100, max: 1024 | | HTTP read timeout | | Value in milliseconds | | Failed the job when timeout? | | If checked, the running job will fail in publishing data source timeout. | | Timezone | | The timezone timestamp values will be stored as in Tableau. Timezone ID to use when converting from Timestamp (timezone-independent) to Tableau DateTime (timezone-dependent). The timestamp value is timezone-independent. For example, `1548979200`. The Tableau DateTime includes day, hour, minute, etc. The connector needs to know the target timezone to convert from timestamp value to Tableau DateTime. If your query contains a `TIMESTAMP` column or cast a DateTime column, the value is exported to the Tableau server as DateTime. This means there is a conversion, and you must provide a target timezone. Treasure Data stores the DateTime value using the UTC timezone. In most cases, leave `timezone` configured as default (UTC), to preserve the value from Treasure Data, unless you particularly want to convert the value to another timezone. | #### Example Queries The following example query uses the access log example data set and calculates the distribution of the HTTP method per day. For convenience, it casts the Datetime column to TIMESTAMP from String in Tableau. HIVE: ```sql SELECT CAST(TD_TIME_FORMAT(time, "yyyy-MM-dd 00:00:00") AS TIMESTAMP) AS "dates", method AS `Method`, COUNT(1) AS `Count` FROM www_access GROUP BY TD_TIME_FORMAT(time, "yyyy-MM-dd 00:00:00"), method ``` PRESTO: For convenience, we recommend using TD_TIME_FORMAT instead of TD_TIME_STRING in Presto queries. ```sql SELECT CAST(TD_TIME_FORMAT(time, 'yyyy-MM-dd 00:00:00') AS TIMESTAMP) AS "dates", method AS `Method`, COUNT(1) AS `Count` FROM www_access GROUP BY TD_TIME_FORMAT(time, 'yyyy-MM-dd 00:00:00'), method ``` ### (Optional) Schedule Query Export Jobs You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify. Treasure Data's scheduler feature supports periodic query execution to achieve high availability. When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored. For example, if the cron schedule is `'0 0 1 * 1'`, then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed. #### Scheduling your Job Using TD Console 1. Navigate to **Data Workbench > Queries** 2. Create a new query or select an existing query. 3. Next to **Schedule**, select None. ![](/assets/image2021-1-15_17-28-51.f1b242f6ecc7666a0097fdf37edd1682786ec11ef80eff68c66f091bc405c371.0f87d8d4.png) 4. In the drop-down, select one of the following schedule options: ![](/assets/image2021-1-15_17-29-47.45289a1c99256f125f4d887e501e204ed61f02223fde0927af5f425a89ace0c0.0f87d8d4.png) | Drop-down Value | Description | | --- | --- | | Custom cron... | Review [Custom cron... details](#custom-cron-details). | | @daily (midnight) | Run once a day at midnight (00:00 am) in the specified time zone. | | @hourly (:00) | Run every hour at 00 minutes. | | None | No schedule. | #### Custom cron... Details ![](/assets/image2021-1-15_17-30-23.0f94a8aa5f75ea03e3fec0c25b0640cd59ee48d1804a83701e5f2372deae466c.0f87d8d4.png) | **Cron Value** | **Description** | | --- | --- | | `0 * * * *` | Run once an hour. | | `0 0 * * *` | Run once a day at midnight. | | `0 0 1 * *` | Run once a month at midnight on the morning of the first day of the month. | | "" | Create a job that has no scheduled run time. | ``` * * * * * - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +---------- month (1 - 12) | | +--------------- day of month (1 - 31) | +-------------------- hour (0 - 23) +------------------------- min (0 - 59) ``` The following named entries can be used: - Day of Week: sun, mon, tue, wed, thu, fri, sat. - Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec. A single space is required between each field. The values for each field can be composed of: | Field Value | Example | Example Description | | --- | --- | --- | | A single value, within the limits displayed above for each field. | | | | A wildcard `'*'` to indicate no restriction based on the field. | `'0 0 1 * *'` | Configures the schedule to run at midnight (00:00) on the first day of each month. | | A range `'2-5'`, indicating the range of accepted values for the field. | `'0 0 1-10 * *'` | Configures the schedule to run at midnight (00:00) on the first 10 days of each month. | | A list of comma-separated values `'2,3,4,5'`, indicating the list of accepted values for the field. | `0 0 1,11,21 * *'` | Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month. | | A periodicity indicator `'*/5'` to express how often based on the field's valid range of values a schedule is allowed to run. | `'30 */2 1 * *'` | Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. `'0 0 */5 * *'` configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month. | | A comma-separated list of any of the above except the `'*'` wildcard is also supported `'2,*/5,8-10'`. | `'0 0 5,*/10,25 * *'` | Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month. | 1. (Optional) You can delay the start time of a query by enabling the Delay execution. ### Execute the Query Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination. Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications. (Optional) You can delay the start time of a query by enabling the Delay execution. ### Validate the Data Export 1. Open your Tableau Server. 2. Select **Data Sources** at the top left bar. You can view the list of data sources, including your TDE file. ![](/assets/image-20191016-211351.4667974c17c9a7ad2b16ec3fa12ae3453e5576c4dfab1e36e504503afa74d386.6bbebcc1.png) 3. Select **New Workbook** to create the charts and dashboard from the browser. 4. To create graphs, drag and drop the dimensions and measures from the left navigation to the top right navigation. 5. Select **Save** to store the result. ![](/assets/image-20191016-211405.b7e75000b994c7c8d8934d01ccfa61923fde5012ba00c349524743454b4bc781.6bbebcc1.png) ## Activate a Segment in Audience Studio You can also send segment data to the target platform by creating an activation in the Audience Studio. 1. Navigate to **Audience Studio**. 2. Select a parent segment. 3. Open the target segment, right-mouse click, and then select **Create Activation.** 4. In the **Details** panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters. 5. Customize the activation output in the **Output Mapping** panel. ![](/assets/ouput.b2c7f1d909c4f98ed10f5300df858a4b19f71a3b0834df952f5fb24018a5ea78.8ebdf569.png) - Attribute Columns - Select **Export All Columns** to export all columns without making any changes. - Select **+ Add Columns** to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select **+ Add Columns**to add new columns for your activation output. - String Builder - **+ Add string** to create strings for export. Select from the following values: - String: Choose any value; use text to create a custom value. - Timestamp: The date and time of the export. - Segment Id: The segment ID number. - Segment Name: The segment name. - Audience Id: The parent segment number. 1. Set a **Schedule**. ![](/assets/snippet-output-connector-on-audience-studio-2024-08-28.a99525173709da1eb537f839019fa7876ffae95045154c8f2941b030022f792c.8ebdf569.png) - Select the values to define your schedule and optionally include email notifications. 1. Select **Create**. If you need to create an activation for a batch journey, review [Creating a Batch Journey Activation](/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation). ## Optionally Configure Export Results in Workflow Within Treasure Workflow, you can specify the use of this data connector to export data. Learn more at [Using Workflows to Export Data with the TD Toolbelt](https://api-docs.treasuredata.com/en/tools/cli/api/#workflow-commands). ### Example Workflow for Tableau ```yaml timezone: UTC _export: td: database: sample_datasets tableau: datasource: datasource_name site_id: site_id project: project_name mode: append legacy: false datasource_type: hyper +td-result-output-tableau: td>: queries/sample.sql result_connection: tableau_connection result_settings: datasource: ${tableau.datasource} site: ${tableau.site_id} project: ${tableau.project} mode: ${tableau.mode} legacy: ${tableau.legacy} target_type: ${datasource_type} ```