@@ -35,42 +35,38 @@ Personal access tokens might be disabled in your Tableau site configuration.
3535To enable them, navigate to the  ; ** Settings** page of your Tableau site
3636and click  ; ** Enable personal access tokens** .
3737
38- By default, personal access tokens are configured with an expiry period of 180 days.
39- Please check your Tableau site configuration for details. To customize the expiry
40- period, navigate to the  ; ** Settings** page of your Tableau site. Please
41- also make sure to renew your personal access token in time.
38+ Personal access tokens expire if not used for 15 consecutive days. If used
39+ regularly, they expire after one year. You can customize the default expiration
40+ period in the  ; ** Settings** page of your Tableau site. Make sure to renew
41+ your personal access token before it expires.
4242
4343</Info >
4444
45- < Warning >
45+ ### Tableau Cloud
4646
47- Personal access tokens expire if they are not used after 15 consecutive days.
48- If they are used more frequently than every 15 days, they expire after one year.
49-
50- </Warning >
51-
52- You will also need to specify a ` region ` and a Tableau ` site ` name. Consider the
53- following URL of a Tableau site: ` https://10ax.online.tableau.com/#/site/cubedev/home ` .
47+ For Tableau Cloud, you need to specify a ` region ` and a ` site ` name. Consider the
48+ following URL of a Tableau Cloud site: ` https://10ax.online.tableau.com/#/site/cubedev/home ` .
5449In this case, the region would be ` 10ax ` and the site name would be ` cubedev ` .
5550
56- Example configuration for Tableau:
51+ Example configuration for Tableau Cloud :
5752
5853<CodeGroup >
5954
6055``` python title="Python"
6156from cube import config
57+ import os
6258
6359@config (' semantic_layer_sync' )
6460def semantic_layer_sync (ctx : dict ) -> list[dict ]:
6561 return [
6662 {
6763 ' type' : ' tableau' ,
68- ' name' : ' Tableau Sync' ,
64+ ' name' : ' Tableau Cloud Sync' ,
6965 ' config' : {
7066 ' region' : ' 10ax' ,
7167 ' site' : ' mytableausite' ,
7268 ' personalAccessToken' : ' cube-cloud' ,
73- ' personalAccessTokenSecret' : ' HW8TFrBfJyen+JQleh0/bw==:1BvJLIti9Fud04rN021EfHMnh4yYD3p4 ' ,
69+ ' personalAccessTokenSecret' : os.environ[ ' CUBEJS_TABLEAU_PAT_SECRET ' ] ,
7470 ' database' : ' Cube Cloud: production-deployment' ,
7571 },
7672 },
@@ -83,12 +79,70 @@ module.exports = {
8379 return [
8480 {
8581 type: " tableau" ,
86- name: " Tableau Sync" ,
82+ name: " Tableau Cloud Sync" ,
8783 config: {
8884 region: " 10ax" ,
8985 site: " mytableausite" ,
9086 personalAccessToken: " cube-cloud" ,
91- personalAccessTokenSecret: " HW8TFrBfJyen+JQleh0/bw==:1BvJLIti9Fud04rN021EfHMnh4yYD3p4" ,
87+ personalAccessTokenSecret: process .env .CUBEJS_TABLEAU_PAT_SECRET ,
88+ database: " Cube Cloud: production-deployment"
89+ }
90+ }
91+ ]
92+ }
93+ }
94+ ```
95+
96+ </CodeGroup >
97+
98+ ### Tableau Server
99+
100+ For Tableau Server, you need to specify a ` hostname ` , ` site ` , and ` apiVersion ` .
101+
102+ To find your site name, look at your Tableau Server URL: the site name is
103+ the value that follows ` /site/ ` in the URL. If there is no ` /site/ ` segment in
104+ the URL, you are using the Default site — leave the ` site ` field blank
105+ in the Cube Cloud configuration.
106+
107+ Example configuration for Tableau Server:
108+
109+ <CodeGroup >
110+
111+ ``` python title="Python"
112+ from cube import config
113+ import os
114+
115+ @config (' semantic_layer_sync' )
116+ def semantic_layer_sync (ctx : dict ) -> list[dict ]:
117+ return [
118+ {
119+ ' type' : ' tableau' ,
120+ ' name' : ' Tableau Server Sync' ,
121+ ' config' : {
122+ ' hostname' : ' tableau.example.com' ,
123+ ' site' : ' ' ,
124+ ' apiVersion' : ' 3.19' ,
125+ ' personalAccessToken' : ' cube-cloud' ,
126+ ' personalAccessTokenSecret' : os.environ[' CUBEJS_TABLEAU_PAT_SECRET' ],
127+ ' database' : ' Cube Cloud: production-deployment' ,
128+ },
129+ },
130+ ]
131+ ```
132+
133+ ``` javascript title="JavaScript"
134+ module .exports = {
135+ semanticLayerSync : ({ securityContext }) => {
136+ return [
137+ {
138+ type: " tableau" ,
139+ name: " Tableau Server Sync" ,
140+ config: {
141+ hostname: " tableau.example.com" ,
142+ site: " " ,
143+ apiVersion: " 3.19" ,
144+ personalAccessToken: " cube-cloud" ,
145+ personalAccessTokenSecret: process .env .CUBEJS_TABLEAU_PAT_SECRET ,
92146 database: " Cube Cloud: production-deployment"
93147 }
94148 }
@@ -99,6 +153,16 @@ module.exports = {
99153
100154</CodeGroup >
101155
156+ <Tip >
157+
158+ Store your personal access token secret in an environment variable rather
159+ than hardcoding it in your configuration. Create a new environment variable
160+ called ` CUBEJS_TABLEAU_PAT_SECRET ` with your token secret as the value,
161+ then reference it using ` os.environ['CUBEJS_TABLEAU_PAT_SECRET'] ` in Python
162+ or ` process.env.CUBEJS_TABLEAU_PAT_SECRET ` in JavaScript.
163+
164+ </Tip >
165+
102166When connecting a Cube Cloud data source to your Tableau workbook, you will be prompted
103167to enter the user name and password for Cube Cloud. You can find them at the  ; ** SQL
104168API Connection** tab on the  ; ** IDE → Integrations** page in Cube Cloud.
@@ -110,15 +174,21 @@ API][tableau-api].
110174
111175### Tableau Desktop
112176
113- Click ** Download .tds** to download a Tableau [ data source] [ tds ] file:
177+ The recommended way to use Cube with Tableau Desktop is to connect to your
178+ Tableau Cloud or Tableau Server account from within Desktop and choose the
179+ synced data source from there. This ensures your data source stays up to date
180+ with any changes made through Semantic Layer Sync.
181+
182+ Alternatively, you can download a ` .tds ` file to get the data model into
183+ Tableau Desktop. Click ** Download .tds** to download a Tableau [ data source] [ tds ] file:
114184
115185<Frame >
116186 <img src = " https://ucarecdn.com/4b93196e-3128-4b01-bd3f-eab8e7d8a37f/" />
117187</Frame >
118188
119189In the modal window, select one or more cubes or views and click ** Download
120190all selected** to download a ZIP archive with Tableau data source files, one
121- per cube or view. Use can open these files in Tableau to create data sources.
191+ per cube or view. You can open these files in Tableau to create data sources.
122192
123193
124194[ tds ] : https://help.tableau.com/current/pro/desktop/en-us/export_connection.htm
0 commit comments