Skip to content

Update documentation according to code #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 73 additions & 1 deletion docs/docs/api-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,39 @@ Saves any changes to the workbook to a new file specified by the `new_file` para

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

`self.shapes` Returns a list of strings with the names of shapes found in the workbook.

## Datasources
```python
class Datasource(dsxml, filename=None)
```
A class representing Tableau Data Sources, embedded in workbook files or in TDS files.

**Params:**

**Raises:**

**Methods:**

save

save_as

add_calculation

**Properities:**

`self.name` Returns string with the name of datasource.

`self.version` Returns string of daatasource's version.

`self.caption` Returns string of user defined name of datasource if exists.

`self.connections` Returns list of connections are used in workbook.

`self.fileds` Returns key-value result of field name and their attributes.

`self.calculations` Returns calculated field of the workbook.

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

## Fields
```python
class Workbook(column_xml=None, metadata_xml=None)
class Field(column_xml=None, metadata_xml=None)
```

Represents a field in a datasource

**Raises:**

**Methods:**
`Field.create_field_xml()` Create field from scratch.

`Field.add_alias(self, key, value)` Add an alias for a given display value.

**Properities:**

`self.name` Returns a string providing a nice name for the field which is derived from the alias, caption, or the id.

`self.id` Returns a string with name of the field as specified in the file, usually surrounded by [ ].

`self.xml` Returns a ElementTree object which represents an XML of the field.

`self.caption` Returns a string with the name of the field as displayed in Tableau unless an aliases is defined.

`self.alias` Returns a string with the name of the field as displayed in Tableau if the default name isn't wanted.

`self.datatype` Returns a string with the type of the field within Tableau (string, integer, etc).

`self.role` Returns a string which identify field as a Dimension or Measure.

`self.type` Returns a string with type of field (quantitative, ordinal, nominal).

`self.aliases` Returns Key-value mappings of all aliases that are registered under this field.

`self.is_quantitative` Returns a boolean if field is quantitative.

`self.is_ordinal` Returns a boolean if field is categorical that has a specific order.

`self.is_nominal` Returns a boolean if field is categorical that does not have a specific order.

`self.calculation` Returns a string with the formula if this field is a calculated field.

`self.default_aggregation` Returns a string with he default type of aggregation on the field (e.g Sum, Avg).

`self.description` Returns a string with contents of the <desc> tag on a field.

`self.worksheets` Returns a list of strings with the worksheet's names uses this field.
5 changes: 5 additions & 0 deletions tableaudocumentapi/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,17 @@ def save_as(self, new_filename):

@property
def name(self):
""" Name of the datasource. """
return self._name

@property
def version(self):
""" Version of the datasource. """
return self._version

@property
def caption(self):
""" User defined name for the datasourse. """
return self._caption

@caption.setter
Expand All @@ -206,6 +209,7 @@ def caption(self):

@property
def connections(self):
""" List of connections are used in workbook. """
return self._connections

def clear_repository_location(self):
Expand All @@ -215,6 +219,7 @@ def clear_repository_location(self):

@property
def fields(self):
""" Key-value result of field's names and its attributes. Dict. """
if not self._fields:
self._refresh_fields()
return self._fields
Expand Down
3 changes: 2 additions & 1 deletion tableaudocumentapi/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def role(self, role):

@property
def type(self):
""" Dimension or Measure """
""" Type of field (quantitative, ordinal, nominal) """
return self._type

@type.setter
Expand Down Expand Up @@ -336,6 +336,7 @@ def description(self):

@property
def worksheets(self):
""" Worksheets which uses field. """
return list(self._worksheets)

######################################
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy