File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -18,4 +18,5 @@ script:
18
18
# Examples
19
19
- (cd "Examples/Replicate Workbook" && python replicateWorkbook.py)
20
20
- (cd "Examples/List TDS Info" && python listTDSInfo.py)
21
+ - (cd "Examples/GetFields" && python show_fields.py)
21
22
Original file line number Diff line number Diff line change
1
+ ../List TDS Info/World.tds
Original file line number Diff line number Diff line change
1
+ ############################################################
2
+ # Step 1) Use Datasource object from the Document API
3
+ ############################################################
4
+ from tableaudocumentapi import Datasource
5
+
6
+ ############################################################
7
+ # Step 2) Open the .tds we want to inspect
8
+ ############################################################
9
+ sourceTDS = Datasource .from_file ('World.tds' )
10
+
11
+ ############################################################
12
+ # Step 3) Print out all of the fields and what type they are
13
+ ############################################################
14
+ print ('----------------------------------------------------------' )
15
+ print ('--- {} total fields in this datasource' .format (len (sourceTDS .fields )))
16
+ print ('----------------------------------------------------------' )
17
+ for count , field in enumerate (sourceTDS .fields .values ()):
18
+ print ('{:>4}: {} is a {}' .format (count + 1 , field .name , field .datatype ))
19
+ blank_line = False
20
+ if field .calculation :
21
+ print (' the formula is {}' .format (field .calculation ))
22
+ blank_line = True
23
+ if field .aggregation :
24
+ print (' the default aggregation is {}' .format (field .aggregation ))
25
+ blank_line = True
26
+
27
+ if blank_line :
28
+ print ('' )
29
+ print ('----------------------------------------------------------' )
You can’t perform that action at this time.
0 commit comments