Skip to content

Instantly share code, notes, and snippets.

@quintonwall
Created January 13, 2022 23:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save quintonwall/2ee0fbd2a65e2e6c6caaed7dcf436e2c to your computer and use it in GitHub Desktop.
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