I'm using python sdk and wanted to query instances based on a condition using “data_modeling.instances.query” method. i have a view “TimeseriesProperty” and it has a direct relation/reference to "TimeseriesPropertyType" view. Is it possible to have a distinct filter on the result, because multiple “TimeseriesProperty” instances can have the same "TimeseriesPropertyType" instances , we don't want duplicated "TimeseriesPropertyType" instances coming in response for below query:
view_id= ViewId(space="slb-pdm-dm-governed", external_id="TimeseriesProperty",version="2_0")
v_id_2_PROP = ViewId(space="slb-pdm-dm-governed", external_id="TimeseriesPropertyType",version="2_0")
query= Query(
with_=
{
"TimeseriesProperty":NodeResultSetExpression(
limit=10,
filter= HasData(views=[view_id])),
"TimeseriesPropertyType":NodeResultSetExpression(
limit=10000,
direction="outwards",
from_ = "TimeseriesProperty",
through = view_id.as_property_ref("propertyType"),
filter= HasData(views=[v_id_2_PROP]))
}
,
select={
"TimeseriesProperty": Select([SourceSelector(view_id, properties=['propertyType'])]),
})
result = client.data_modeling.instances.query(query)