Subscribe to changes for nodes and edges in a project, matching a supplied filter. This endpoint will always return a NextCursor
. The sync specification mirrors the query interface, but sorting is not currently supported. For more information, see Query language.
Change filter specification
Matching nodes and edges
The response for a failed request.
from cognite.client.data_classes.data_modeling.instances import InstanceSort from cognite.client.data_classes.data_modeling.query import Query, Select, NodeResultSetExpression, EdgeResultSetExpression, SourceSelector from cognite.client.data_classes.filters import Range, Equals from cognite.client.data_classes.data_modeling.ids import ViewId movie_id = ViewId("mySpace", "MovieView", "v1") actor_id = ViewId("mySpace", "ActorView", "v1") query = Query( with_ = { "movies": NodeResultSetExpression(filter=Range(movie_id.as_property_ref("releaseYear"), lt=2000)), "actors_in_movie": EdgeResultSetExpression(from_="movies", filter=Equals(["edge", "type"], {"space": movie_id.space, "externalId": "Movie.actors"})), "actors": NodeResultSetExpression(from_="actors_in_movie"), }, select = { "actors": Select( [SourceSelector(actor_id, ["name"])], sort=[InstanceSort(actor_id.as_property_ref("name"))]), }, ) res = client.data_modeling.instances.sync(query) query.cursors = res.cursors res_new = client.data_modeling.instances.sync(query)
{- "items": {
- "result-expression1": [
- {
- "instanceType": "node",
- "version": 0,
- "space": "string",
- "externalId": "string",
- "type": {
- "space": "string",
- "externalId": "string"
}, - "createdTime": 1730204346000,
- "lastUpdatedTime": 1730204346000,
- "deletedTime": 1730204346000,
- "properties": {
- "space-name1": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}, - "space-name2": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}
}
}
], - "result-expression2": [
- {
- "instanceType": "node",
- "version": 0,
- "space": "string",
- "externalId": "string",
- "type": {
- "space": "string",
- "externalId": "string"
}, - "createdTime": 1730204346000,
- "lastUpdatedTime": 1730204346000,
- "deletedTime": 1730204346000,
- "properties": {
- "space-name1": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}, - "space-name2": {
- "view-or-container-identifier1": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}, - "view-or-container-identifier2": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}
}
}
]
}, - "typing": {
- "result-expression1": {
- "space-name1": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}, - "space-name2": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}
}, - "result-expression2": {
- "space-name1": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}, - "space-name2": {
- "view-or-container-external-id1": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}, - "view-or-container-external-id2": {
- "property-identifier1": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}, - "property-identifier2": {
- "immutable": false,
- "nullable": true,
- "autoIncrement": false,
- "defaultValue": "string",
- "description": "string",
- "name": "string",
- "type": {
- "type": "text",
- "list": false,
- "maxListSize": 0,
- "collation": "ucs_basic"
}
}
}
}
}
}, - "nextCursor": {
- "cursor-name1": "string",
- "cursor-name2": "string"
}
}