Skip to content

Instantly share code, notes, and snippets.

@soobrosa
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soobrosa/430188859dfd4ac88df8 to your computer and use it in GitHub Desktop.
Save soobrosa/430188859dfd4ac88df8 to your computer and use it in GitHub Desktop.
Extract database connections from Tableau workbooks
# parses directories for .twb files
# and extracts database connections
# rough and dirty
import os
for root, dirs, files in os.walk('.'):
for file in files:
if file.endswith('.twb'):
f = open(root + '/' + file)
for line in f:
if 'relation name' in line:
print root + '/' + file + '\t' + \
line.split("table='")[1].split("'")[0].replace("[","").replace("]","")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment