Skip to content

Commit 600ca48

Browse files
jacalatadev-mkc19
andauthored
Jac/geocoding (#229)
* Update documentation * add workbook interiors listing * add some pretty printing of field data * Update filtering.twb to include newly supported geocoding data * switch from ElementTree to lxml Co-authored-by: Mikhail K <[email protected]>
1 parent f7b8aa2 commit 600ca48

File tree

18 files changed

+1869
-938
lines changed

18 files changed

+1869
-938
lines changed

docs/docs/api-ref.md

+73-1
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,39 @@ Saves any changes to the workbook to a new file specified by the `new_file` para
3838

3939
`self.filename:` Returns the filename of the workbook.
4040

41+
`self.shapes` Returns a list of strings with the names of shapes found in the workbook.
42+
4143
## Datasources
4244
```python
4345
class Datasource(dsxml, filename=None)
4446
```
47+
A class representing Tableau Data Sources, embedded in workbook files or in TDS files.
48+
49+
**Params:**
50+
51+
**Raises:**
52+
53+
**Methods:**
54+
55+
save
56+
57+
save_as
58+
59+
add_calculation
60+
61+
**Properities:**
62+
63+
`self.name` Returns string with the name of datasource.
64+
65+
`self.version` Returns string of daatasource's version.
66+
67+
`self.caption` Returns string of user defined name of datasource if exists.
68+
69+
`self.connections` Returns list of connections are used in workbook.
70+
71+
`self.fileds` Returns key-value result of field name and their attributes.
72+
73+
`self.calculations` Returns calculated field of the workbook.
4574

4675
## Connections
4776
```python
@@ -74,5 +103,48 @@ The Connection class represents a tableau data connection. It can be from any ty
74103

75104
## Fields
76105
```python
77-
class Workbook(column_xml=None, metadata_xml=None)
106+
class Field(column_xml=None, metadata_xml=None)
78107
```
108+
109+
Represents a field in a datasource
110+
111+
**Raises:**
112+
113+
**Methods:**
114+
`Field.create_field_xml()` Create field from scratch.
115+
116+
`Field.add_alias(self, key, value)` Add an alias for a given display value.
117+
118+
**Properities:**
119+
120+
`self.name` Returns a string providing a nice name for the field which is derived from the alias, caption, or the id.
121+
122+
`self.id` Returns a string with name of the field as specified in the file, usually surrounded by [ ].
123+
124+
`self.xml` Returns a ElementTree object which represents an XML of the field.
125+
126+
`self.caption` Returns a string with the name of the field as displayed in Tableau unless an aliases is defined.
127+
128+
`self.alias` Returns a string with the name of the field as displayed in Tableau if the default name isn't wanted.
129+
130+
`self.datatype` Returns a string with the type of the field within Tableau (string, integer, etc).
131+
132+
`self.role` Returns a string which identify field as a Dimension or Measure.
133+
134+
`self.type` Returns a string with type of field (quantitative, ordinal, nominal).
135+
136+
`self.aliases` Returns Key-value mappings of all aliases that are registered under this field.
137+
138+
`self.is_quantitative` Returns a boolean if field is quantitative.
139+
140+
`self.is_ordinal` Returns a boolean if field is categorical that has a specific order.
141+
142+
`self.is_nominal` Returns a boolean if field is categorical that does not have a specific order.
143+
144+
`self.calculation` Returns a string with the formula if this field is a calculated field.
145+
146+
`self.default_aggregation` Returns a string with he default type of aggregation on the field (e.g Sum, Avg).
147+
148+
`self.description` Returns a string with contents of the <desc> tag on a field.
149+
150+
`self.worksheets` Returns a list of strings with the worksheet's names uses this field.

docs/docs/contributing.md

+9
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,12 @@ For all other things, please submit a PR that includes the fix, documentation, o
5656
If the feature is complex or has multiple solutions that could be equally appropriate approaches, it would be helpful to file an issue to discuss the
5757
design trade-offs of each solution before implementing, to allow us to collectively arrive at the best solution, which most likely exists in the middle
5858
somewhere.
59+
60+
61+
## Release process
62+
63+
We expect that everything merged into the development branch is ready to release on master. Releases can be made at any time - ideally it would be on a regular cadence but currently it is basically on request.
64+
- bump the version in setup.py
65+
- update the changelog: all commits to development should contain a meaningful message, the changelog can be built from these
66+
- merge to master.
67+
This kicks off an automated release in github and then publish to pypi.

samples/list-tds-info/list_tds_info.py

-18
This file was deleted.

samples/preserve-namespaces/filtering.twb

+12
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@
5454
</attributes>
5555
<_.fcp.ObjectModelEncapsulateLegacy.true...object-id>[TestData_44D2C885FAEF453C846AC2CCD3577055]</_.fcp.ObjectModelEncapsulateLegacy.true...object-id>
5656
</metadata-record>
57+
<metadata-record class='column'>
58+
<remote-name>SPAM</remote-name>
59+
<remote-type>1</remote-type>
60+
<remote-alias>SPAM</remote-alias>
61+
<ordinal>19</ordinal>
62+
<aggregation>Count</aggregation>
63+
<contains-null>true</contains-null>
64+
<attributes>
65+
<attribute datatype='string' name='DebugRemoteType'>&quot;xml&quot;</attribute>
66+
<attribute datatype='string' name='DebugWireType'>&quot;SQL_C_DEFAULT&quot;</attribute>
67+
</attributes>
68+
</metadata-record>
5769
<metadata-record class='column'>
5870
<remote-name>Account Number</remote-name>
5971
<remote-type>5</remote-type>

0 commit comments

Comments
 (0)