# tableau/server-client-python architecture

> Architecture diagram of the GitHub repository tableau/server-client-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tableau/server-client-python
- Repository: https://github.com/tableau/server-client-python

## Overview

##### 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.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Samples/Client Applications"]:::client
    subgraph "TSC Library Core"
        E["Endpoints (REST API)"]:::core
        M["Models (Domain Objects)"]:::core
        H["Helpers"]:::core
        subgraph "Utilities"
            V1["Version Utility"]:::core
            V2["Exponential Backoff"]:::core
            V3["File System Helpers"]:::core
            V4["Query Utility"]:::core
        end
    end
    TS["Tableau Server (REST API)"]:::external
    subgraph "Supporting Components"
        T["Testing Framework"]:::support
        C["CI/CD Tools"]:::support
    end

    A -->|"calls"| E
    E -->|"API_call"| TS
    TS -->|"response"| E
    E -->|"maps_response"| M
    E -->|"utilizes"| H
    H -->|"assists"| V1
    H -->|"assists"| V2
    H -->|"assists"| V3
    H -->|"assists"| V4
    T ---|"tests"| E
    C ---|"builds"| E

    classDef client fill:#a2d9ce,stroke:#333,stroke-width:2px
    classDef core fill:#f9e79f,stroke:#333,stroke-width:2px
    classDef external fill:#f5b7b1,stroke:#333,stroke-width:2px
    classDef support fill:#d7bde2,stroke:#333,stroke-width:2px

    click A "https://github.com/tableau/server-client-python/tree/master/samples"
    click E "https://github.com/tableau/server-client-python/tree/master/tableauserverclient/server/endpoint"
    click M "https://github.com/tableau/server-client-python/tree/master/tableauserverclient/models"
    click H "https://github.com/tableau/server-client-python/tree/master/tableauserverclient/helpers"
    click V1 "https://github.com/tableau/server-client-python/blob/master/tableauserverclient/bin/_version.py"
    click V2 "https://github.com/tableau/server-client-python/blob/master/tableauserverclient/exponential_backoff.py"
    click V3 "https://github.com/tableau/server-client-python/blob/master/tableauserverclient/filesys_helpers.py"
    click V4 "https://github.com/tableau/server-client-python/blob/master/tableauserverclient/query.py"
    click T "https://github.com/tableau/server-client-python/tree/master/test"
    click C "https://github.com/tableau/server-client-python/tree/master/.github/workflows"
```
