Website • Demo • Documentation • Chat
A Python script pulls and parses XML data from PSQL readonly Tableau database. This data, along with data pulled from Tableau's database, is inserted into a SQL database and is able to be run daily and inserted into Atlas.
- Logs in to the Tableau server via SSH and connects to the Tableau PSQL Admin account in the workgroup database
- The query will create
.twbx
and.twb
files containing SQL queries related to the workbooks stored in Tableau - The files retrieved are placed in the
TwbxFiles
folder and any zipped folders are unzipped - All XML files are parsed and the server, database name, and SQL queries are pulled from each along with the the respective workbook
- Connection to SQL database is established and all tables are truncated so as not to duplicate data
- All PSQL queries are run and data pulled is stored in SQl tables
- Get the code
git clone [email protected]:atlas-bi/Tableau-Metadata-Exporter.git
- Create the Atlas Staging database tables. Run the
create_tables.sql
script in youratlas_staging
database - Install the project depenedencies
poetry install
, orpip install
the dependencies listed in thepyproject.toml
file - Set parameters (see below)
- Run
poetry run python main.py
, orpython main.py
The python script accepts environment variables. This is the recommended way to run the script. You can also create a .env
file to hold the parameters.
# Tableau's psql admin account. Documentation on Tabeau's website for getting the admin password.
PSQLADMIN=postgres://tblwgadmin:password@localhost:8060/workgroup
# Tableau's psql ro account
PSQLRO=postgres://readonly:password@hostname:8060/workgroup
# Atlas Staging database connection
SQLSERVER=DRIVER={ODBC Driver 17 for SQL Server};SERVER=sqlServer;DATABASE=atlas_staging;UID=joe;PWD=12345
# SSH Connection to Tableau Server. Old servers will need to install OpenSSH
SSHHOST=tableauServer
SSHUSERNAME=mr_cool
SSHPASSWORD=12345
# Url to Tableau
TABLEAUURL=https://tableau.example.com
Here's a few steps to get the Tableau PSQL admin and readonly passwords.
Navigate to the Tableau server and open command prompt.
cd C:\Program Files\Tableau\Tableau Server\packages\pgsql.<version>\bin
#to retrieve the Tableau admin password
tsm configuration get -k pgsql.adminpassword
#to retrieve the readonly password
tsm configuration get -k pgsql.readonly_password
Some of the PSQL queries that are run look at user and group data. To access these tables, try this guide. The user data is mostly found in the ts_users data source.
For a list of nearly all Tableau tables along with columns and descriptions, try this guide.