Last active
August 29, 2015 14:06
-
-
Save soobrosa/430188859dfd4ac88df8 to your computer and use it in GitHub Desktop.
Extract database connections from Tableau workbooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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