Kentaro Yoshida | Commune Inc - Hi, We are impo...
# dev-help
k
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.
Copy code
"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
      }
    },
Copy code
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
            }
        }
a
message has been deleted
k
The import payload is as described below.
Copy code
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
}
j
cc: @pallavp_ 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_16781
k
@justinmathew_tsdev 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.
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.
j
cc: @pallavp_ @sandeep.yadav can you help with above
s
Hello @Kentaro Yoshida | Commune Inc : Marking the "create_new": False in the request payload, should help to achieve this "Update" mode.
k
@sandeep.yadav 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"?
s
Yes, that will work.
k
thanks!