Tableau-Backup-Tool
An automated tool for backing up Tableau workbooks and datasources to Git, featuring parallel processing, progress tracking, and smart file handling.
GitHub Link:
Features
- Automated Backup: Automatically downloads and backs up all Tableau workbooks and datasources
- Git Integration: Seamlessly integrates with Git for version control
- Parallel Processing: Uses multi-threading for faster downloads
- Smart File Handling: Checks file hashes to avoid unnecessary downloads
- Progress Tracking: Visual progress bars for all operations
- Configurable: Flexible configuration through YAML and environment variables
- Cross-Platform: Works on Windows, Linux, and macOS
- Detailed Logging: Comprehensive logging system for monitoring and debugging
Prerequisites
- Python 3.7+
- Git
- Tableau Server access
- Git repository for backups
Installation
- Clone the repository:
git clone <https://github.com/yourusername/tableau-backup-tool>
cd tableau-backup-tool
- Install required packages:
pip install -r requirements.txt
Configuration
Environment Variables
Create a .env
file in the project root:
TABLEAU_USERNAME=your_username
TABLEAU_PASSWORD=your_password
TABLEAU_SERVER=your_server_url
GIT_REPO=your_repo_url
GIT_AUTHOR_NAME=your_name
GIT_AUTHOR_EMAIL=your_email
Configuration File
The tool uses a config.yaml
file for settings. A default one will be created if not present:
tableau_server: <https://tableau.server.com>
git_repo: <https://git.user.com/projects/test_proj>
base_dir: Tableau_Projects
git_author:
name: User
email: user@outlook.com
max_workers: 4
overwrite_existing: false
Usage
Run the backup tool:
python tableau-backup.py --config config.yaml
Command Line Arguments
-
-config
: Path to configuration file (default: config.yaml)
Project Structure
tableau-backup-tool/
├── tableau-backup.py # Main script
├── config.yaml # Configuration file
├── requirements.txt # Python dependencies
└── README.md # This file
How It Works
- Authentication: Connects to Tableau Server using provided credentials
- Project Discovery: Maps the project hierarchy and content
- Parallel Download: Downloads workbooks and datasources using multiple threads
- Git Integration: Commits and pushes changes to the specified repository
- Cleanup: Performs necessary cleanup operations
Features in Detail
Parallel Processing
- Uses ThreadPoolExecutor for concurrent downloads
- Configurable number of worker threads
- Progress tracking for parallel operations
Smart File Handling
- MD5 hash checking for change detection
- Skip unchanged files
- Optional file overwrite control
Logging System
- Detailed logging to both file and console
- Different log levels for various operations
- Timestamp and category information
Error Handling
- Comprehensive error catching and reporting
- Graceful failure handling
- Automatic cleanup on failure
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Dependencies
tableauserverclient
gitpython
pyyaml
python-dotenv
tqdm
pathlib
Error Codes
Common error codes and their meanings:
-
E001
: Authentication failure -
E002
: Download permission denied -
E003
: Git repository error -
E004
: Configuration error -
E005
: Network connection error
Troubleshooting
Common Issues
- Authentication Failures
- Verify credentials in
.env
file - Check Tableau Server URL
- Ensure proper permissions
- Verify credentials in
- Git Issues
- Verify Git repository access
- Check Git credentials
- Ensure proper repository structure
- Download Failures
- Check network connection
- Verify content permissions
- Ensure sufficient disk space
Credits
- Tableau Server Client library
- GitPython contributors
- TQDM progress bar library
License
Distributed under the GNU Affero General Public License v3.0 License. See LICENSE
for more information.