Utility for maintaining Tableau objects
Project description
tableau-utilities
A module and CLI Utility for managing Tableau objects, locally, and in Tableau Online.
Quick start
Installation
From pypi
pip install tableau-utilities
Locally using pip
cd tableau-utilities
pip install ./
Confirm installation
which tableau_utilities
- Describes where tableau-utilities has been installed
tableau_utilities --help
- Should populate a list of available commands
Module Usage
Sample
import tableau_utilities as tu
from my_secrets import tableau_creds
def main():
# The datasource can be defined either by the ID, or name and project
datasource_id = 'abc123'
datasource_name = None
project_name = None
# Create a Tableau Connection
ts = tu.TableauServer(**tableau_creds)
# Download a datasource
tdsx_path = ts.download_datasource(dsid=datasource_id, name=datasource_name, project=project_name)
# Extract the TDS file from the TDSX for making updates
tds_dict = tu.extract_tds(tdsx_path)
tds = tu.TDS(tds_dict)
# Add a column to the datasource
tds.add(
item_type='column',
column_name='Calculation_1',
remote_name='Calculation_1',
caption='Max Created Datetime',
folder_name='Time Dimensions',
role='dimension',
role_type='ordinal',
datatype='datetime',
desc='The maximum Created Datetime.',
calculation='MAX([Created Datetime])'
)
# Update the datasource from alterations made to the TDS
tu.update_tdsx(tdsx_path, tds_dict)
# Publish the datasource
ts.publish_datasource(tdsx_path, dsid=datasource_id, name=datasource_name, project=project_name)
if __name__ == '__main__':
main()
CLI Usage
tableau_utilities --user <login> --password <password> --site <site name> --server <server address> --list_datasources
- Lists all datasources in your site
tableau_utilities --user <login> --password <password> --site <site name> --server <server address> --download_ds --name "Datasource Name" --project "Project Name"
- Download a datasource
tableau_utilities --tdsx path/to/file.tdsx --add_column --name "column_name" --folder "Folder Name" --caption "Column Alias" --desc "column description"
- Add column to datasource
Maintenance
This project is actively maintained by the Data Platform team at @hoverinc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tableau_utilities-1.0.4.tar.gz
(16.0 kB
view hashes)
Built Distribution
Close
Hashes for tableau_utilities-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc0537e2557eb5c5a3063bfa4ecbdaf65be049acbe2d76fbf4fd82d3523c6e8a |
|
MD5 | aec6d16861dbdd864ff990c0a0d5945a |
|
BLAKE2b-256 | 21c1fd976d0aad0eb85d1fac14d71df1b9ba06fbe892bec961cf7c0de1122a35 |