|
1 | 1 | ############################################################
|
2 | 2 | # Step 1) Use Datasource object from the Document API
|
3 | 3 | ############################################################
|
4 |
| -from tableaudocumentapi import Datasource |
| 4 | +from tableaudocumentapi import Workbook |
5 | 5 |
|
6 | 6 | ############################################################
|
7 |
| -# Step 2) Open the .tds we want to replicate |
| 7 | +# Step 2) Open the .tds we want to explore |
8 | 8 | ############################################################
|
9 |
| -sourceTDS = Datasource.from_file('world.tds') |
| 9 | +sourceTWBX = Workbook('geocoding.twbx') |
10 | 10 |
|
11 | 11 | ############################################################
|
12 |
| -# Step 3) List out info from the TDS |
| 12 | +# Step 3) List out info from the TWBX |
13 | 13 | ############################################################
|
14 | 14 | print('----------------------------------------------------------')
|
15 |
| -print('-- Info for our .tds:') |
16 |
| -print('-- name:\t{0}'.format(sourceTDS.name)) |
17 |
| -print('-- version:\t{0}'.format(sourceTDS.version)) |
| 15 | +print('-- Info for our .twbx:') |
| 16 | +print('-- name:\t{0}'.format(sourceTWBX.filename)) |
| 17 | +print('-- CONTENTS') |
| 18 | +print('-- dashboards:\t{0}'.format(len(sourceTWBX.dashboards))) |
| 19 | +for dash in sourceTWBX.dashboards: |
| 20 | + print("-- {}".format(dash)) |
| 21 | + |
| 22 | +print('-- datasources:\t{0}'.format(len(sourceTWBX.datasources))) |
| 23 | +for data in sourceTWBX.datasources: |
| 24 | + print("-- {}".format(data.name)) |
| 25 | + |
| 26 | +print('-- worksheets:\t{0}'.format(len(sourceTWBX.worksheets))) |
| 27 | +for data in sourceTWBX.worksheets: |
| 28 | + print("-- {}".format(data)) |
| 29 | + |
| 30 | +print('-- shapes:\t{0}'.format(len(sourceTWBX.shapes))) |
| 31 | +for shape in sourceTWBX.shapes: |
| 32 | + print("-- {}".format(shape)) |
18 | 33 | print('----------------------------------------------------------')
|
0 commit comments