Kentaro Yoshida | Commune Inc - Hi, We are impo...

Hi, We are importing liveboard and its associated table/models at once. I am developing a batch process for transferring data across different organizations. The export/import payload is as described below. The first transfer works fine, but the second time, I get an error message: "Switch to Update existing to continue." However there doesn't seem to be an update mode; how can I enable an update mode like the one available in the UI? Explanation of TML content: * The GUID line has been removed. * By specifying the obj-id, duplicate liveboards/tables/models are no longer created during each import.
"response": {
"status": {
"error_message": "Cannot create a new table as the table in the TML file already exists. Existing Table GUID: c45f4b06-5b27-4649-8508-7c583d1b7db3. Switch to Update existing to continue. <br/>",
"status_code": "ERROR",
"error_code": 14501
}
},
"response": {
"status": {
"error_message": "Cannot create a new table as the table in the TML file already exists. Existing Table GUID: c45f4b06-5b27-4649-8508-7c583d1b7db3. Switch to Update existing to continue. <br/>",
"status_code": "ERROR",
"error_code": 14501
}
},
url = f"{self.base_url}/api/rest/2.0/metadata/tml/export"
payload = {
"metadata": [
{
"identifier": "my-liveboard-id",
"type": "LIVEBOARD"
}
],
"export_associated": True,
"export_fqn": False,
"edoc_format": "JSON",
"export_schema_version": "V2",
"export_dependent": False,
"export_connection_as_dependent": False,
"all_orgs_override": False,
"export_options": {
"include_obj_id_ref": False,
"include_guid": False,
"include_obj_id": True,
"export_with_associated_feedbacks": False,
"export_column_security_rules": False
}
}
url = f"{self.base_url}/api/rest/2.0/metadata/tml/export"
payload = {
"metadata": [
{
"identifier": "my-liveboard-id",
"type": "LIVEBOARD"
}
],
"export_associated": True,
"export_fqn": False,
"edoc_format": "JSON",
"export_schema_version": "V2",
"export_dependent": False,
"export_connection_as_dependent": False,
"all_orgs_override": False,
"export_options": {
"include_obj_id_ref": False,
"include_guid": False,
"include_obj_id": True,
"export_with_associated_feedbacks": False,
"export_column_security_rules": False
}
}
9 Replies
よしけん
よしけんOP2mo ago
The import payload is as described below.
url = f"{self.base_url}/api/rest/2.0/metadata/tml/import"
payload = {
"metadata_tmls": tml_list,
"import_policy": "ALL_OR_NONE",
"create_new": True,
"all_orgs_override": False,
"skip_diff_check": False,
"enable_large_metadata_validation": True
}
url = f"{self.base_url}/api/rest/2.0/metadata/tml/import"
payload = {
"metadata_tmls": tml_list,
"import_policy": "ALL_OR_NONE",
"create_new": True,
"all_orgs_override": False,
"skip_diff_check": False,
"enable_large_metadata_validation": True
}
Justin Mathew
Justin Mathew2mo ago
cc: @pallav can you check this also @Kentaro Yoshida | Commune Inc we are having a AMA session for thoughtspot_tml using python Wednesday, September 24th at 10:00 AM PST https://discord.com/channels/1143209406037758065/1143209464875462756/1418529792269094973 you can join that as well ,we can help resolve any queries there as well cc: @aashna_ts
よしけん
よしけんOP2mo ago
@Justin Mathew Thanks, Unfortunately I'm working in Japan JST timezone, thus that timing does not work for me My feature request is if it matches obj-id, it become update mode instead of using GUID mapping.
よしけん
よしけんOP2mo ago
This document (https://github.com/thoughtspot/thoughtspot_tml?tab=readme-ov-file#disambiguate) describes the necessary steps when importing data from Org A to Org B using the "Update" mode. 1. Retrieve a list of existing metadata from the target organization. 2. Replace the GUID in the exported TML file with the GUID from the existing metadata. 3. Perform the import. Is there another way to achieve the "Update" mode? It seems like this is possible through the browser interface.
GitHub
GitHub - thoughtspot/thoughtspot_tml: Python library for working wi...
Python library for working with ThoughtSpot Modeling Language (TML) files programmatically - thoughtspot/thoughtspot_tml
Justin Mathew
Justin Mathew2mo ago
cc: @pallav @sandeep can you help with above
Sandeep Yadav
Sandeep Yadav5w ago
Hello @よしけん : Marking the "create_new": False in the request payload, should help to achieve this "Update" mode.
よしけん
よしけんOP5w ago
@sandeep Thanks, It works. If there are 2 new table/models and 1 existing model to be update, is it still expected to use "create_new: False"?
Sandeep Yadav
Sandeep Yadav5w ago
Yes, that will work.
よしけん
よしけんOP4w ago
thanks!

Did you find this page helpful?