I'm using python sdk and wanted to query instances based on a condition using “data_modeling.instances.query” methos . I have a view called TimeseriesPropertyType which has a field (properties: [Property]) which is a reverse direct relation throughProperty: "propertyType".
i just need to check if there are any “properties” field values associated with each instance of the TimeseriesPropertyType view. for that I'm fetching data in property view associated with those particular TimeseriesPropertyType view and doing the check manually in code.. is there any direct filter i can use that's available? i dont see any filters available on properties field in query explorer for the same
below is the query im using
#view_id_ts_prop_type - TimeseriesPropertyType view
#view_id_property - Property view
query= Query(
with_=
{
"TimeseriesPropertyType":NodeResultSetExpression(
limit=10000,
filter= HasData(views=[view_id_ts_prop_type])),
"Property":NodeResultSetExpression(
limit=10000,
direction="inwards",
from_ = "TimeseriesPropertyType",
through = view_id_property.as_property_ref("propertyType"),
filter= HasData(views=[view_id_property]))
}
,
select={
"TimeseriesPropertyType": Select([SourceSelector(view_id_ts_prop_type, properties=['*'])]),
"Property": Select([SourceSelector(view_id_property, properties=['*'])]),
},
)