@@ -15,6 +15,7 @@ class Slice(DbObject):
1515 updated_at (datetime)
1616 filter (json)
1717 """
18+
1819 name = Field .String ("name" )
1920 description = Field .String ("description" )
2021 created_at = Field .DateTime ("created_at" )
@@ -57,3 +58,40 @@ def get_data_row_ids(self) -> PaginatedCollection:
5758 dereferencing = ['getDataRowIdsBySavedQuery' , 'nodes' ],
5859 obj_class = lambda _ , data_row_id : data_row_id ,
5960 cursor_path = ['getDataRowIdsBySavedQuery' , 'pageInfo' , 'endCursor' ])
61+
62+
63+ class ModelSlice (Slice ):
64+ """
65+ Represents a Slice used for filtering data rows in Model.
66+ """
67+
68+ def get_data_row_ids (self ) -> PaginatedCollection :
69+ """
70+ Fetches all data row ids that match this Slice
71+
72+ Returns:
73+ A PaginatedCollection of data row ids
74+ """
75+ query_str = """
76+ query getDataRowIdsBySavedQueryPyApi($id: ID!, $from: String, $first: Int!) {
77+ getDataRowIdsBySavedQuery(input: {
78+ savedQueryId: $id,
79+ after: $from
80+ first: $first
81+ }) {
82+ totalCount
83+ nodes
84+ pageInfo {
85+ endCursor
86+ hasNextPage
87+ }
88+ }
89+ }
90+ """
91+ return PaginatedCollection (
92+ client = self .client ,
93+ query = query_str ,
94+ params = {'id' : self .uid },
95+ dereferencing = ['getDataRowIdsBySavedQuery' , 'nodes' ],
96+ obj_class = lambda _ , data_row_id : data_row_id ,
97+ cursor_path = ['getDataRowIdsBySavedQuery' , 'pageInfo' , 'endCursor' ])
0 commit comments