Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
# 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