Take the output of a ThoughtSpot tml/export API call and extract the edoc values, formatting them for use in a tml/import import_objects key array
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
# python script to take the output of a tml/export api call and | |
# extract the edoc value required for the tml/import import_objects key | |
# | |
# | |
# argv[1] tml filename | |
# argv[2] output filename | |
# | |
import json | |
import sys | |
f = open(sys.argv[1],"r") | |
data = json.loads(f.read())["object"] | |
with open(sys.argv[2], "w") as outfile: | |
e = 0 | |
for i in data: | |
outfile.write(i["edoc"]) | |
e +=1 | |
if e > 1 and e < data.length: | |
outfile.write(", ") | |
outfile.close() | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment