Skip to main content

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


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.3.tar.gz (15.8 kB view hashes)

Uploaded Source

Built Distribution

tableau_utilities-1.0.3-py3-none-any.whl (16.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page