How tableau/server-client-python works
Main Components
• Client Library Core – Represented mainly by the “tableauserverclient” package. This package contains key subcomponents:
• Models: Under tableauserverclient/models, these classes (e.g., datasource_item, workbook_item, etc.) represent the domain objects that model Tableau resources.
• Server/Endpoints: Located under tableauserverclient/server/endpoint and related modules. These files implement the various REST API calls (e.g., auth, groups, projects, etc.).
• Helpers: Under tableauserverclient/helpers, utility modules for logging, headers, string manipulation etc.
• Utilities: Such as the exponential backoff mechanism and file system helpers in tableauserverclient/ (e.g., _version.py, query.py, etc.).
• Samples – The “samples” directory provides concrete usage examples (scripts that call the library functions like create_project.py, login.py, refresh.py, etc.) to demonstrate interacting with Tableau Server.
• Testing Framework – The “test” directory contains unit and integration tests (organized by modules like models, server endpoints, request factory testing, etc.). Although not part of the production runtime, they validate the design.
• Build/Configuration and CI/CD Tools – Files such as setup.py, pyproject.toml, GitHub workflows (in .github/workflows) for testing, code coverage, and PyPI publishing. These do not affect runtime logic but are important for deployment and maintenance.
Diagramming the Relationships and Interactions
• External Component: Tableau Server (the REST API provider). Represent this as an external system.
• Data Flow:
• The samples and client applications initiate calls using the TSC library.
• These calls are received by the high-level API provided by the “tableauserverclient” package.
• The response data is processed and mapped to Models, after which any business logic (like exponential backoff or logging via Helpers) may be applied.
• Testing: Indicate that there is a parallel “test” system that verifies the functionality of each module.
Architectural Patterns and Design Principles
• Layered Architecture: The design concept separates concerns across layers (API interface, domain models, endpoint logic, and helper utilities).
• Modularity: Each REST endpoint is encapsulated in its own module. This modular design makes it easier to extend or update specific API features.
• Reusability/Extensibility: The helper modules and utilities show reusable design principles (e.g., the logging and exponential backoff modules).
Elements
• Clear Labels: Each module (Models, Endpoints, Helpers, Utilities, Samples, Test Suite) should be clearly marked.
• From “Samples/Client Application” to “TSC Library Interface”.
• Use another style for supporting components such as tests and CI/CD tools.