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.1.tar.gz
(15.5 kB
view hashes)
Built Distribution
Close
Hashes for tableau_utilities-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efc8d7f8f0a79ab44fed93dbbb1454b4a48202af32c8ec6dc0e6cfbaa55ba80d |
|
MD5 | e7d076211f8a1bd8ce477cf9f699d228 |
|
BLAKE2b-256 | acfd91a6ad86bb04b9b6b59f594ecbcd83817c3b533eb9c2868a00221924e508 |