Skip to main content
Question

Data modeling sdk instance query method filter


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=['*'])]),
        },
        )

 

5 replies

  • Author
  • Seasoned
  • 19 replies
  • March 20, 2025

  • Author
  • Seasoned
  • 19 replies
  • March 21, 2025

we want to use paginated response as there are lot of instances, so we wanted to know if such a filter is available which lets us query only those instances in a view(“TimeseriesPropertyType”) which has an associated data in another view (“Property”)


Aditya Kotiyal
MVP
Forum|alt.badge.img+3

@AndersM  , ​@Uzair Wali  Any suggestions?


Arild  Eide
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • 39 replies
  • March 24, 2025

  

Hi ​@Sangavi M 

When using a reverse direct relation you will need to go with your approach of using two result sets. There is no separate filter that would allow you to do a direct filter on the value of properties. This is the cost of using the reverse direct relation - the benefit is consistency as you store the property type only “once”.

 

Arild

 

 


  • Author
  • Seasoned
  • 19 replies
  • March 25, 2025

is there any other recommended approach for our use case? ​@Arild Eide 


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings