shared.processing

processing.py

This module provides functions to process Tableau Workbook (TWB/TWBX) files, extracting and analyzing data sources, fields, and their dependencies. It includes context managers for suppressing console output and functionality for visualizing field dependencies.

Key Functionalities:

This application processes Tableau workbooks to extract data sources and fields, generates visual representations of field dependencies, and manages output file organization and logging.

Usage:

The process_twb function serves as the main entry point, taking a file path and optional parameters for output handling and execution context.

shared.processing.process_twb(filepath, uploadfolder=None, is_executable=True)

Process a Tableau Workbook (TWB/TWBX) file to extract and analyze data sources, fields, and their dependencies.

This function reads a TWB file, extracts data sources and field information, processes field attributes, and computes dependencies among fields and sheets. It generates visual representations of field dependencies if specified and saves output files to the specified upload folder.

Parameters:
  • filepath (str) – The path to the Tableau workbook (TWB*) file to be processed.

  • uploadfolder (str, optional) – The directory where output files will be saved if not running as an executable. Defaults to None.

  • is_executable (bool, optional) – Flag indicating if the function is being run as an executable script. Defaults to True.

Returns:

This function does not return a value but generates output files.

Return type:

None

shared.processing.suppress_stdout()

Temporarily suppress console output.

Yields:

None – Suppresses console output for the following commands (e.g., when opening a workbook).

Notes

Source: http://thesmithfam.org/blog/2012/10/25/temporarily-suppress-console-output-in-python/