How to delete specific data table relations via Python


there is a very helpful Comment from Sean which describes how to add or remove data table relations via a Python script. In my case both is required since I want to run two data functions asynchronously which refer to related data tables. So I first want to delete some of many relations in a rather complex analysis, then run the data functions asynchronously and lastly re-establish the relations.

My problem is that I cannot find a way how to delete only very specific data table relations but I can only delete all relations related to a given data table. I was wondering if it is somehow possible to delete only specific relations in a similar way as specific relations can be established.

Below please find a copy of Sean's instructions for ease of reading. Any input would be highly appreciated.


from Spotfire.Dxp.Data import *

##Define the 2 tables to be used


## (1) Add data table relation
## Note: 'Id' & 'Name' are the names of the columns available in the 2 tables
dm.Relations.Add(table1, table2, '[Table1].[Id]=[Table2].[Id] and [Table1].[Name]=[Table2].[Name]')

## (3) Delete Relations for the specified tables, uncomment next 3 lines if required
## Note: this deletes all relations of these two tables and not just the ones between table1 and table2.
#for exRel in existingRelations:

(1) Answer