Skip to content

Omni APIs

examples.omni._api

CDFExternalReferencesAPI

Bases: NodeAPI[CDFExternalReferences, CDFExternalReferencesWrite, CDFExternalReferencesList, CDFExternalReferencesWriteList]

Source code in examples/omni/_api/cdf_external_references.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
class CDFExternalReferencesAPI(
    NodeAPI[
        CDFExternalReferences, CDFExternalReferencesWrite, CDFExternalReferencesList, CDFExternalReferencesWriteList
    ]
):
    _view_id = dm.ViewId("pygen-models", "CDFExternalReferences", "1")
    _properties_by_field = _CDFEXTERNALREFERENCES_PROPERTIES_BY_FIELD
    _class_type = CDFExternalReferences
    _class_list = CDFExternalReferencesList
    _class_write_list = CDFExternalReferencesWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.timeseries = CDFExternalReferencesTimeseriesAPI(client, self._view_id)

    def __call__(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> CDFExternalReferencesQueryAPI[CDFExternalReferencesList]:
        """Query starting at cdf external references.

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for cdf external references.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_cdf_external_reference_filter(
            self._view_id,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(CDFExternalReferencesList)
        return CDFExternalReferencesQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        cdf_external_reference: CDFExternalReferencesWrite | Sequence[CDFExternalReferencesWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) cdf external references.

        Args:
            cdf_external_reference: Cdf external reference or sequence of cdf external references to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new cdf_external_reference:

                >>> from omni import OmniClient
                >>> from omni.data_classes import CDFExternalReferencesWrite
                >>> client = OmniClient()
                >>> cdf_external_reference = CDFExternalReferencesWrite(external_id="my_cdf_external_reference", ...)
                >>> result = client.cdf_external_references.apply(cdf_external_reference)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.cdf_external_references.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(cdf_external_reference, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more cdf external reference.

        Args:
            external_id: External id of the cdf external reference to delete.
            space: The space where all the cdf external reference are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete cdf_external_reference by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.cdf_external_references.delete("my_cdf_external_reference")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.cdf_external_references.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> CDFExternalReferences | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> CDFExternalReferencesList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> CDFExternalReferences | CDFExternalReferencesList | None:
        """Retrieve one or more cdf external references by id(s).

        Args:
            external_id: External id or list of external ids of the cdf external references.
            space: The space where all the cdf external references are located.

        Returns:
            The requested cdf external references.

        Examples:

            Retrieve cdf_external_reference by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_reference = client.cdf_external_references.retrieve("my_cdf_external_reference")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: CDFExternalReferencesTextFields | SequenceNotStr[CDFExternalReferencesTextFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> CDFExternalReferencesList:
        """Search cdf external references

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results cdf external references matching the query.

        Examples:

           Search for 'my_cdf_external_reference' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references = client.cdf_external_references.search('my_cdf_external_reference')

        """
        filter_ = _create_cdf_external_reference_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields],
        property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
        property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across cdf external references

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count cdf external references in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.cdf_external_references.aggregate("count", space="my_space")

        """

        filter_ = _create_cdf_external_reference_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=None,
            search_properties=None,
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: CDFExternalReferencesFields,
        interval: float,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for cdf external references

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_cdf_external_reference_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            None,
            None,
            limit,
            filter_,
        )

    def query(self) -> CDFExternalReferencesQuery:
        """Start a query for cdf external references."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return CDFExternalReferencesQuery(self._client)

    def list(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: CDFExternalReferencesFields | Sequence[CDFExternalReferencesFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> CDFExternalReferencesList:
        """List/filter cdf external references

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested cdf external references

        Examples:

            List cdf external references and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references = client.cdf_external_references.list(limit=5)

        """
        filter_ = _create_cdf_external_reference_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at cdf external references.

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
CDFExternalReferencesQueryAPI[CDFExternalReferencesList]

A query API for cdf external references.

Source code in examples/omni/_api/cdf_external_references.py
def __call__(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> CDFExternalReferencesQueryAPI[CDFExternalReferencesList]:
    """Query starting at cdf external references.

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for cdf external references.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_cdf_external_reference_filter(
        self._view_id,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(CDFExternalReferencesList)
    return CDFExternalReferencesQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields], property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across cdf external references

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None

The property to group by when doing the aggregation.

None
property CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None

The property to perform aggregation on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count cdf external references in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.cdf_external_references.aggregate("count", space="my_space")
Source code in examples/omni/_api/cdf_external_references.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
    property: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across cdf external references

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count cdf external references in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.cdf_external_references.aggregate("count", space="my_space")

    """

    filter_ = _create_cdf_external_reference_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=None,
        search_properties=None,
        limit=limit,
        filter=filter_,
    )

apply(cdf_external_reference, replace=False, write_none=False)

Add or update (upsert) cdf external references.

Parameters:

Name Type Description Default
cdf_external_reference CDFExternalReferencesWrite | Sequence[CDFExternalReferencesWrite]

Cdf external reference or sequence of cdf external references to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new cdf_external_reference:

    >>> from omni import OmniClient
    >>> from omni.data_classes import CDFExternalReferencesWrite
    >>> client = OmniClient()
    >>> cdf_external_reference = CDFExternalReferencesWrite(external_id="my_cdf_external_reference", ...)
    >>> result = client.cdf_external_references.apply(cdf_external_reference)
Source code in examples/omni/_api/cdf_external_references.py
def apply(
    self,
    cdf_external_reference: CDFExternalReferencesWrite | Sequence[CDFExternalReferencesWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) cdf external references.

    Args:
        cdf_external_reference: Cdf external reference or sequence of cdf external references to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new cdf_external_reference:

            >>> from omni import OmniClient
            >>> from omni.data_classes import CDFExternalReferencesWrite
            >>> client = OmniClient()
            >>> cdf_external_reference = CDFExternalReferencesWrite(external_id="my_cdf_external_reference", ...)
            >>> result = client.cdf_external_references.apply(cdf_external_reference)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.cdf_external_references.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(cdf_external_reference, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more cdf external reference.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the cdf external reference to delete.

required
space str

The space where all the cdf external reference are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete cdf_external_reference by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.cdf_external_references.delete("my_cdf_external_reference")
Source code in examples/omni/_api/cdf_external_references.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more cdf external reference.

    Args:
        external_id: External id of the cdf external reference to delete.
        space: The space where all the cdf external reference are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete cdf_external_reference by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.cdf_external_references.delete("my_cdf_external_reference")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.cdf_external_references.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for cdf external references

Parameters:

Name Type Description Default
property CDFExternalReferencesFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/cdf_external_references.py
def histogram(
    self,
    property: CDFExternalReferencesFields,
    interval: float,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for cdf external references

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_cdf_external_reference_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        None,
        None,
        limit,
        filter_,
    )

list(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter cdf external references

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by CDFExternalReferencesFields | Sequence[CDFExternalReferencesFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
CDFExternalReferencesList

List of requested cdf external references

Examples:

List cdf external references and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references = client.cdf_external_references.list(limit=5)
Source code in examples/omni/_api/cdf_external_references.py
def list(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: CDFExternalReferencesFields | Sequence[CDFExternalReferencesFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> CDFExternalReferencesList:
    """List/filter cdf external references

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested cdf external references

    Examples:

        List cdf external references and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references = client.cdf_external_references.list(limit=5)

    """
    filter_ = _create_cdf_external_reference_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for cdf external references.

Source code in examples/omni/_api/cdf_external_references.py
def query(self) -> CDFExternalReferencesQuery:
    """Start a query for cdf external references."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return CDFExternalReferencesQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> CDFExternalReferences | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> CDFExternalReferencesList

Retrieve one or more cdf external references by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the cdf external references.

required
space str

The space where all the cdf external references are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
CDFExternalReferences | CDFExternalReferencesList | None

The requested cdf external references.

Examples:

Retrieve cdf_external_reference by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_reference = client.cdf_external_references.retrieve("my_cdf_external_reference")
Source code in examples/omni/_api/cdf_external_references.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> CDFExternalReferences | CDFExternalReferencesList | None:
    """Retrieve one or more cdf external references by id(s).

    Args:
        external_id: External id or list of external ids of the cdf external references.
        space: The space where all the cdf external references are located.

    Returns:
        The requested cdf external references.

    Examples:

        Retrieve cdf_external_reference by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_reference = client.cdf_external_references.retrieve("my_cdf_external_reference")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search cdf external references

Parameters:

Name Type Description Default
query str

The search query,

required
properties CDFExternalReferencesTextFields | SequenceNotStr[CDFExternalReferencesTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
CDFExternalReferencesList

Search results cdf external references matching the query.

Examples:

Search for 'my_cdf_external_reference' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references = client.cdf_external_references.search('my_cdf_external_reference')
Source code in examples/omni/_api/cdf_external_references.py
def search(
    self,
    query: str,
    properties: CDFExternalReferencesTextFields | SequenceNotStr[CDFExternalReferencesTextFields] | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: CDFExternalReferencesFields | SequenceNotStr[CDFExternalReferencesFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> CDFExternalReferencesList:
    """Search cdf external references

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results cdf external references matching the query.

    Examples:

       Search for 'my_cdf_external_reference' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references = client.cdf_external_references.search('my_cdf_external_reference')

    """
    filter_ = _create_cdf_external_reference_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

CDFExternalReferencesListedAPI

Bases: NodeAPI[CDFExternalReferencesListed, CDFExternalReferencesListedWrite, CDFExternalReferencesListedList, CDFExternalReferencesListedWriteList]

Source code in examples/omni/_api/cdf_external_references_listed.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
class CDFExternalReferencesListedAPI(
    NodeAPI[
        CDFExternalReferencesListed,
        CDFExternalReferencesListedWrite,
        CDFExternalReferencesListedList,
        CDFExternalReferencesListedWriteList,
    ]
):
    _view_id = dm.ViewId("pygen-models", "CDFExternalReferencesListed", "1")
    _properties_by_field = _CDFEXTERNALREFERENCESLISTED_PROPERTIES_BY_FIELD
    _class_type = CDFExternalReferencesListed
    _class_list = CDFExternalReferencesListedList
    _class_write_list = CDFExternalReferencesListedWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.timeseries = CDFExternalReferencesListedTimeseriesAPI(client, self._view_id)

    def __call__(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> CDFExternalReferencesListedQueryAPI[CDFExternalReferencesListedList]:
        """Query starting at cdf external references listeds.

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for cdf external references listeds.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_cdf_external_references_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(CDFExternalReferencesListedList)
        return CDFExternalReferencesListedQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        cdf_external_references_listed: CDFExternalReferencesListedWrite | Sequence[CDFExternalReferencesListedWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) cdf external references listeds.

        Args:
            cdf_external_references_listed: Cdf external references listed or sequence of cdf external references listeds to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new cdf_external_references_listed:

                >>> from omni import OmniClient
                >>> from omni.data_classes import CDFExternalReferencesListedWrite
                >>> client = OmniClient()
                >>> cdf_external_references_listed = CDFExternalReferencesListedWrite(external_id="my_cdf_external_references_listed", ...)
                >>> result = client.cdf_external_references_listed.apply(cdf_external_references_listed)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.cdf_external_references_listed.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(cdf_external_references_listed, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more cdf external references listed.

        Args:
            external_id: External id of the cdf external references listed to delete.
            space: The space where all the cdf external references listed are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete cdf_external_references_listed by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.cdf_external_references_listed.delete("my_cdf_external_references_listed")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.cdf_external_references_listed.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> CDFExternalReferencesListed | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> CDFExternalReferencesListedList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> CDFExternalReferencesListed | CDFExternalReferencesListedList | None:
        """Retrieve one or more cdf external references listeds by id(s).

        Args:
            external_id: External id or list of external ids of the cdf external references listeds.
            space: The space where all the cdf external references listeds are located.

        Returns:
            The requested cdf external references listeds.

        Examples:

            Retrieve cdf_external_references_listed by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references_listed = client.cdf_external_references_listed.retrieve("my_cdf_external_references_listed")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: (
            CDFExternalReferencesListedTextFields | SequenceNotStr[CDFExternalReferencesListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> CDFExternalReferencesListedList:
        """Search cdf external references listeds

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results cdf external references listeds matching the query.

        Examples:

           Search for 'my_cdf_external_references_listed' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references_listeds = client.cdf_external_references_listed.search('my_cdf_external_references_listed')

        """
        filter_ = _create_cdf_external_references_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields],
        property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
        property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across cdf external references listeds

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count cdf external references listeds in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.cdf_external_references_listed.aggregate("count", space="my_space")

        """

        filter_ = _create_cdf_external_references_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=None,
            search_properties=None,
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: CDFExternalReferencesListedFields,
        interval: float,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for cdf external references listeds

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_cdf_external_references_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            None,
            None,
            limit,
            filter_,
        )

    def query(self) -> CDFExternalReferencesListedQuery:
        """Start a query for cdf external references listeds."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return CDFExternalReferencesListedQuery(self._client)

    def list(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: CDFExternalReferencesListedFields | Sequence[CDFExternalReferencesListedFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> CDFExternalReferencesListedList:
        """List/filter cdf external references listeds

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested cdf external references listeds

        Examples:

            List cdf external references listeds and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references_listeds = client.cdf_external_references_listed.list(limit=5)

        """
        filter_ = _create_cdf_external_references_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at cdf external references listeds.

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
CDFExternalReferencesListedQueryAPI[CDFExternalReferencesListedList]

A query API for cdf external references listeds.

Source code in examples/omni/_api/cdf_external_references_listed.py
def __call__(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> CDFExternalReferencesListedQueryAPI[CDFExternalReferencesListedList]:
    """Query starting at cdf external references listeds.

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for cdf external references listeds.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_cdf_external_references_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(CDFExternalReferencesListedList)
    return CDFExternalReferencesListedQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields], property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across cdf external references listeds

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None

The property to group by when doing the aggregation.

None
property CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None

The property to perform aggregation on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count cdf external references listeds in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.cdf_external_references_listed.aggregate("count", space="my_space")
Source code in examples/omni/_api/cdf_external_references_listed.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
    property: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across cdf external references listeds

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count cdf external references listeds in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.cdf_external_references_listed.aggregate("count", space="my_space")

    """

    filter_ = _create_cdf_external_references_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=None,
        search_properties=None,
        limit=limit,
        filter=filter_,
    )

apply(cdf_external_references_listed, replace=False, write_none=False)

Add or update (upsert) cdf external references listeds.

Parameters:

Name Type Description Default
cdf_external_references_listed CDFExternalReferencesListedWrite | Sequence[CDFExternalReferencesListedWrite]

Cdf external references listed or sequence of cdf external references listeds to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new cdf_external_references_listed:

    >>> from omni import OmniClient
    >>> from omni.data_classes import CDFExternalReferencesListedWrite
    >>> client = OmniClient()
    >>> cdf_external_references_listed = CDFExternalReferencesListedWrite(external_id="my_cdf_external_references_listed", ...)
    >>> result = client.cdf_external_references_listed.apply(cdf_external_references_listed)
Source code in examples/omni/_api/cdf_external_references_listed.py
def apply(
    self,
    cdf_external_references_listed: CDFExternalReferencesListedWrite | Sequence[CDFExternalReferencesListedWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) cdf external references listeds.

    Args:
        cdf_external_references_listed: Cdf external references listed or sequence of cdf external references listeds to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new cdf_external_references_listed:

            >>> from omni import OmniClient
            >>> from omni.data_classes import CDFExternalReferencesListedWrite
            >>> client = OmniClient()
            >>> cdf_external_references_listed = CDFExternalReferencesListedWrite(external_id="my_cdf_external_references_listed", ...)
            >>> result = client.cdf_external_references_listed.apply(cdf_external_references_listed)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.cdf_external_references_listed.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(cdf_external_references_listed, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more cdf external references listed.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the cdf external references listed to delete.

required
space str

The space where all the cdf external references listed are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete cdf_external_references_listed by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.cdf_external_references_listed.delete("my_cdf_external_references_listed")
Source code in examples/omni/_api/cdf_external_references_listed.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more cdf external references listed.

    Args:
        external_id: External id of the cdf external references listed to delete.
        space: The space where all the cdf external references listed are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete cdf_external_references_listed by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.cdf_external_references_listed.delete("my_cdf_external_references_listed")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.cdf_external_references_listed.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for cdf external references listeds

Parameters:

Name Type Description Default
property CDFExternalReferencesListedFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/cdf_external_references_listed.py
def histogram(
    self,
    property: CDFExternalReferencesListedFields,
    interval: float,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for cdf external references listeds

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_cdf_external_references_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        None,
        None,
        limit,
        filter_,
    )

list(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter cdf external references listeds

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by CDFExternalReferencesListedFields | Sequence[CDFExternalReferencesListedFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
CDFExternalReferencesListedList

List of requested cdf external references listeds

Examples:

List cdf external references listeds and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references_listeds = client.cdf_external_references_listed.list(limit=5)
Source code in examples/omni/_api/cdf_external_references_listed.py
def list(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: CDFExternalReferencesListedFields | Sequence[CDFExternalReferencesListedFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> CDFExternalReferencesListedList:
    """List/filter cdf external references listeds

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested cdf external references listeds

    Examples:

        List cdf external references listeds and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references_listeds = client.cdf_external_references_listed.list(limit=5)

    """
    filter_ = _create_cdf_external_references_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for cdf external references listeds.

Source code in examples/omni/_api/cdf_external_references_listed.py
def query(self) -> CDFExternalReferencesListedQuery:
    """Start a query for cdf external references listeds."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return CDFExternalReferencesListedQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> CDFExternalReferencesListed | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> CDFExternalReferencesListedList

Retrieve one or more cdf external references listeds by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the cdf external references listeds.

required
space str

The space where all the cdf external references listeds are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
CDFExternalReferencesListed | CDFExternalReferencesListedList | None

The requested cdf external references listeds.

Examples:

Retrieve cdf_external_references_listed by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references_listed = client.cdf_external_references_listed.retrieve("my_cdf_external_references_listed")
Source code in examples/omni/_api/cdf_external_references_listed.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> CDFExternalReferencesListed | CDFExternalReferencesListedList | None:
    """Retrieve one or more cdf external references listeds by id(s).

    Args:
        external_id: External id or list of external ids of the cdf external references listeds.
        space: The space where all the cdf external references listeds are located.

    Returns:
        The requested cdf external references listeds.

    Examples:

        Retrieve cdf_external_references_listed by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references_listed = client.cdf_external_references_listed.retrieve("my_cdf_external_references_listed")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search cdf external references listeds

Parameters:

Name Type Description Default
query str

The search query,

required
properties CDFExternalReferencesListedTextFields | SequenceNotStr[CDFExternalReferencesListedTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
CDFExternalReferencesListedList

Search results cdf external references listeds matching the query.

Examples:

Search for 'my_cdf_external_references_listed' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references_listeds = client.cdf_external_references_listed.search('my_cdf_external_references_listed')
Source code in examples/omni/_api/cdf_external_references_listed.py
def search(
    self,
    query: str,
    properties: (
        CDFExternalReferencesListedTextFields | SequenceNotStr[CDFExternalReferencesListedTextFields] | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: CDFExternalReferencesListedFields | SequenceNotStr[CDFExternalReferencesListedFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> CDFExternalReferencesListedList:
    """Search cdf external references listeds

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results cdf external references listeds matching the query.

    Examples:

       Search for 'my_cdf_external_references_listed' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references_listeds = client.cdf_external_references_listed.search('my_cdf_external_references_listed')

    """
    filter_ = _create_cdf_external_references_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

CDFExternalReferencesListedQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/cdf_external_references_listed_query.py
class CDFExternalReferencesListedQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "CDFExternalReferencesListed", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=CDFExternalReferencesListed,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/cdf_external_references_listed_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

CDFExternalReferencesListedTimeseriesAPI

Source code in examples/omni/_api/cdf_external_references_listed_timeseries.py
class CDFExternalReferencesListedTimeseriesAPI:
    def __init__(self, client: CogniteClient, view_id: dm.ViewId):
        self._client = client
        self._view_id = view_id

    def __call__(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> CDFExternalReferencesListedTimeseriesQuery:
        """Query timeseries `cdf_external_references_listed.timeseries`

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query object that can be used to retrieve datapoins for the cdf_external_references_listed.timeseries timeseries
            selected in this method.

        Examples:

            Retrieve all data for 5 cdf_external_references_listed.timeseries timeseries:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references_listeds = client.cdf_external_references_listed.timeseries(limit=5).retrieve()

        """
        filter_ = _create_cdf_external_references_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )

        return CDFExternalReferencesListedTimeseriesQuery(
            client=self._client,
            view_id=self._view_id,
            timeseries_limit=limit,
            filter=filter_,
        )

    def list(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> TimeSeriesList:
        """List timeseries `cdf_external_references_listed.timeseries`

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            List of Timeseries cdf_external_references_listed.timeseries.

        Examples:

            List cdf_external_references_listed.timeseries and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references_listeds = client.cdf_external_references_listed.timeseries.list(limit=5)

        """
        filter_ = _create_cdf_external_references_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        external_ids = _retrieve_timeseries_external_ids_with_extra_timesery(
            self._client, self._view_id, filter_, limit
        )
        if external_ids:
            return self._client.time_series.retrieve_multiple(external_ids=list(external_ids))
        else:
            return TimeSeriesList([])

__call__(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Query timeseries cdf_external_references_listed.timeseries

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
CDFExternalReferencesListedTimeseriesQuery

A query object that can be used to retrieve datapoins for the cdf_external_references_listed.timeseries timeseries

CDFExternalReferencesListedTimeseriesQuery

selected in this method.

Examples:

Retrieve all data for 5 cdf_external_references_listed.timeseries timeseries:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references_listeds = client.cdf_external_references_listed.timeseries(limit=5).retrieve()
Source code in examples/omni/_api/cdf_external_references_listed_timeseries.py
def __call__(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> CDFExternalReferencesListedTimeseriesQuery:
    """Query timeseries `cdf_external_references_listed.timeseries`

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query object that can be used to retrieve datapoins for the cdf_external_references_listed.timeseries timeseries
        selected in this method.

    Examples:

        Retrieve all data for 5 cdf_external_references_listed.timeseries timeseries:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references_listeds = client.cdf_external_references_listed.timeseries(limit=5).retrieve()

    """
    filter_ = _create_cdf_external_references_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )

    return CDFExternalReferencesListedTimeseriesQuery(
        client=self._client,
        view_id=self._view_id,
        timeseries_limit=limit,
        filter=filter_,
    )

list(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

List timeseries cdf_external_references_listed.timeseries

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
TimeSeriesList

List of Timeseries cdf_external_references_listed.timeseries.

Examples:

List cdf_external_references_listed.timeseries and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references_listeds = client.cdf_external_references_listed.timeseries.list(limit=5)
Source code in examples/omni/_api/cdf_external_references_listed_timeseries.py
def list(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> TimeSeriesList:
    """List timeseries `cdf_external_references_listed.timeseries`

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        List of Timeseries cdf_external_references_listed.timeseries.

    Examples:

        List cdf_external_references_listed.timeseries and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references_listeds = client.cdf_external_references_listed.timeseries.list(limit=5)

    """
    filter_ = _create_cdf_external_references_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    external_ids = _retrieve_timeseries_external_ids_with_extra_timesery(
        self._client, self._view_id, filter_, limit
    )
    if external_ids:
        return self._client.time_series.retrieve_multiple(external_ids=list(external_ids))
    else:
        return TimeSeriesList([])

CDFExternalReferencesQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/cdf_external_references_query.py
class CDFExternalReferencesQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "CDFExternalReferences", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=CDFExternalReferences,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/cdf_external_references_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

CDFExternalReferencesTimeseriesAPI

Source code in examples/omni/_api/cdf_external_references_timeseries.py
class CDFExternalReferencesTimeseriesAPI:
    def __init__(self, client: CogniteClient, view_id: dm.ViewId):
        self._client = client
        self._view_id = view_id

    def __call__(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> CDFExternalReferencesTimeseriesQuery:
        """Query timeseries `cdf_external_reference.timeseries`

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query object that can be used to retrieve datapoins for the cdf_external_reference.timeseries timeseries
            selected in this method.

        Examples:

            Retrieve all data for 5 cdf_external_reference.timeseries timeseries:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references = client.cdf_external_references.timeseries(limit=5).retrieve()

        """
        filter_ = _create_cdf_external_reference_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )

        return CDFExternalReferencesTimeseriesQuery(
            client=self._client,
            view_id=self._view_id,
            timeseries_limit=limit,
            filter=filter_,
        )

    def list(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> TimeSeriesList:
        """List timeseries `cdf_external_reference.timeseries`

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            List of Timeseries cdf_external_reference.timeseries.

        Examples:

            List cdf_external_reference.timeseries and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> cdf_external_references = client.cdf_external_references.timeseries.list(limit=5)

        """
        filter_ = _create_cdf_external_reference_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        external_ids = _retrieve_timeseries_external_ids_with_extra_timesery(
            self._client, self._view_id, filter_, limit
        )
        if external_ids:
            return self._client.time_series.retrieve_multiple(external_ids=list(external_ids))
        else:
            return TimeSeriesList([])

__call__(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Query timeseries cdf_external_reference.timeseries

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
CDFExternalReferencesTimeseriesQuery

A query object that can be used to retrieve datapoins for the cdf_external_reference.timeseries timeseries

CDFExternalReferencesTimeseriesQuery

selected in this method.

Examples:

Retrieve all data for 5 cdf_external_reference.timeseries timeseries:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references = client.cdf_external_references.timeseries(limit=5).retrieve()
Source code in examples/omni/_api/cdf_external_references_timeseries.py
def __call__(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> CDFExternalReferencesTimeseriesQuery:
    """Query timeseries `cdf_external_reference.timeseries`

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query object that can be used to retrieve datapoins for the cdf_external_reference.timeseries timeseries
        selected in this method.

    Examples:

        Retrieve all data for 5 cdf_external_reference.timeseries timeseries:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references = client.cdf_external_references.timeseries(limit=5).retrieve()

    """
    filter_ = _create_cdf_external_reference_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )

    return CDFExternalReferencesTimeseriesQuery(
        client=self._client,
        view_id=self._view_id,
        timeseries_limit=limit,
        filter=filter_,
    )

list(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

List timeseries cdf_external_reference.timeseries

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
TimeSeriesList

List of Timeseries cdf_external_reference.timeseries.

Examples:

List cdf_external_reference.timeseries and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> cdf_external_references = client.cdf_external_references.timeseries.list(limit=5)
Source code in examples/omni/_api/cdf_external_references_timeseries.py
def list(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> TimeSeriesList:
    """List timeseries `cdf_external_reference.timeseries`

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of cdf external references to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        List of Timeseries cdf_external_reference.timeseries.

    Examples:

        List cdf_external_reference.timeseries and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> cdf_external_references = client.cdf_external_references.timeseries.list(limit=5)

    """
    filter_ = _create_cdf_external_reference_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    external_ids = _retrieve_timeseries_external_ids_with_extra_timesery(
        self._client, self._view_id, filter_, limit
    )
    if external_ids:
        return self._client.time_series.retrieve_multiple(external_ids=list(external_ids))
    else:
        return TimeSeriesList([])

ConnectionItemAAPI

Bases: NodeAPI[ConnectionItemA, ConnectionItemAWrite, ConnectionItemAList, ConnectionItemAWriteList]

Source code in examples/omni/_api/connection_item_a.py
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
class ConnectionItemAAPI(NodeAPI[ConnectionItemA, ConnectionItemAWrite, ConnectionItemAList, ConnectionItemAWriteList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemA", "1")
    _properties_by_field = _CONNECTIONITEMA_PROPERTIES_BY_FIELD
    _class_type = ConnectionItemA
    _class_list = ConnectionItemAList
    _class_write_list = ConnectionItemAWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.outwards_edge = ConnectionItemAOutwardsAPI(client)

    def __call__(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> ConnectionItemAQueryAPI[ConnectionItemAList]:
        """Query starting at connection item as.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            other_direct: The other direct to filter on.
            self_direct: The self direct to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for connection item as.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_connection_item_a_filter(
            self._view_id,
            name,
            name_prefix,
            other_direct,
            self_direct,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(ConnectionItemAList)
        return ConnectionItemAQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        connection_item_a: ConnectionItemAWrite | Sequence[ConnectionItemAWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) connection item as.

        Note: This method iterates through all nodes and timeseries linked to connection_item_a and creates them including the edges
        between the nodes. For example, if any of `other_direct`, `outwards` or `self_direct` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            connection_item_a: Connection item a or sequence of connection item as to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new connection_item_a:

                >>> from omni import OmniClient
                >>> from omni.data_classes import ConnectionItemAWrite
                >>> client = OmniClient()
                >>> connection_item_a = ConnectionItemAWrite(external_id="my_connection_item_a", ...)
                >>> result = client.connection_item_a.apply(connection_item_a)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.connection_item_a.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(connection_item_a, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more connection item a.

        Args:
            external_id: External id of the connection item a to delete.
            space: The space where all the connection item a are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete connection_item_a by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.connection_item_a.delete("my_connection_item_a")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.connection_item_a.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemA | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemAList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemA | ConnectionItemAList | None:
        """Retrieve one or more connection item as by id(s).

        Args:
            external_id: External id or list of external ids of the connection item as.
            space: The space where all the connection item as are located.

        Returns:
            The requested connection item as.

        Examples:

            Retrieve connection_item_a by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_a = client.connection_item_a.retrieve("my_connection_item_a")

        """
        return self._retrieve(
            external_id,
            space,
            retrieve_edges=True,
            edge_api_name_type_direction_view_id_penta=[
                (
                    self.outwards_edge,
                    "outwards",
                    dm.DirectRelationReference("pygen-models", "bidirectional"),
                    "outwards",
                    dm.ViewId("pygen-models", "ConnectionItemB", "1"),
                ),
            ],
        )

    def search(
        self,
        query: str,
        properties: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> ConnectionItemAList:
        """Search connection item as

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            other_direct: The other direct to filter on.
            self_direct: The self direct to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results connection item as matching the query.

        Examples:

           Search for 'my_connection_item_a' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_as = client.connection_item_a.search('my_connection_item_a')

        """
        filter_ = _create_connection_item_a_filter(
            self._view_id,
            name,
            name_prefix,
            other_direct,
            self_direct,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields],
        property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
        property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across connection item as

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            other_direct: The other direct to filter on.
            self_direct: The self direct to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count connection item as in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.connection_item_a.aggregate("count", space="my_space")

        """

        filter_ = _create_connection_item_a_filter(
            self._view_id,
            name,
            name_prefix,
            other_direct,
            self_direct,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: ConnectionItemAFields,
        interval: float,
        query: str | None = None,
        search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for connection item as

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            other_direct: The other direct to filter on.
            self_direct: The self direct to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_connection_item_a_filter(
            self._view_id,
            name,
            name_prefix,
            other_direct,
            self_direct,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> ConnectionItemAQuery:
        """Start a query for connection item as."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return ConnectionItemAQuery(self._client)

    def list(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemAFields | Sequence[ConnectionItemAFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> ConnectionItemAList:
        """List/filter connection item as

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            other_direct: The other direct to filter on.
            self_direct: The self direct to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.
            retrieve_connections: Whether to retrieve `other_direct`, `outwards` and `self_direct` for the connection item as. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested connection item as

        Examples:

            List connection item as and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_as = client.connection_item_a.list(limit=5)

        """
        filter_ = _create_connection_item_a_filter(
            self._view_id,
            name,
            name_prefix,
            other_direct,
            self_direct,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
                sort_by=sort_by,  # type: ignore[arg-type]
                direction=direction,
                sort=sort,
            )

        builder = QueryBuilder(ConnectionItemAList)
        has_data = dm.filters.HasData(views=[self._view_id])
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                    sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
                ),
                ConnectionItemA,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_outwards = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_outwards,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_outwards),
                    dm.query.NodeResultSetExpression(
                        from_=edge_outwards,
                        filter=dm.filters.HasData(views=[ConnectionItemB._view_id]),
                    ),
                    ConnectionItemB,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(from_root),
                    dm.query.NodeResultSetExpression(
                        from_=from_root,
                        direction="outwards",
                        through=self._view_id.as_property_ref("otherDirect"),
                    ),
                    ConnectionItemCNode,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(from_root),
                    dm.query.NodeResultSetExpression(
                        from_=from_root,
                        filter=dm.filters.HasData(views=[ConnectionItemA._view_id]),
                        direction="outwards",
                        through=self._view_id.as_property_ref("selfDirect"),
                    ),
                    ConnectionItemA,
                )
            )

        return builder.execute(self._client)

__call__(name=None, name_prefix=None, other_direct=None, self_direct=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at connection item as.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
other_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The other direct to filter on.

None
self_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The self direct to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
ConnectionItemAQueryAPI[ConnectionItemAList]

A query API for connection item as.

Source code in examples/omni/_api/connection_item_a.py
def __call__(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    other_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    self_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> ConnectionItemAQueryAPI[ConnectionItemAList]:
    """Query starting at connection item as.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        other_direct: The other direct to filter on.
        self_direct: The self direct to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for connection item as.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_connection_item_a_filter(
        self._view_id,
        name,
        name_prefix,
        other_direct,
        self_direct,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(ConnectionItemAList)
    return ConnectionItemAQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, name=None, name_prefix=None, other_direct=None, self_direct=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None, query: str | None = None, search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, other_direct: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, self_direct: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None, query: str | None = None, search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, other_direct: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, self_direct: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields], property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None, query: str | None = None, search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, other_direct: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, self_direct: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across connection item as

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None

The property to group by when doing the aggregation.

None
property ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None

The text field to search in.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
other_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The other direct to filter on.

None
self_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The self direct to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count connection item as in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.connection_item_a.aggregate("count", space="my_space")
Source code in examples/omni/_api/connection_item_a.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
    property: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
    query: str | None = None,
    search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    other_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    self_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across connection item as

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        other_direct: The other direct to filter on.
        self_direct: The self direct to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count connection item as in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.connection_item_a.aggregate("count", space="my_space")

    """

    filter_ = _create_connection_item_a_filter(
        self._view_id,
        name,
        name_prefix,
        other_direct,
        self_direct,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(connection_item_a, replace=False, write_none=False)

Add or update (upsert) connection item as.

Note: This method iterates through all nodes and timeseries linked to connection_item_a and creates them including the edges between the nodes. For example, if any of other_direct, outwards or self_direct are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
connection_item_a ConnectionItemAWrite | Sequence[ConnectionItemAWrite]

Connection item a or sequence of connection item as to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new connection_item_a:

    >>> from omni import OmniClient
    >>> from omni.data_classes import ConnectionItemAWrite
    >>> client = OmniClient()
    >>> connection_item_a = ConnectionItemAWrite(external_id="my_connection_item_a", ...)
    >>> result = client.connection_item_a.apply(connection_item_a)
Source code in examples/omni/_api/connection_item_a.py
def apply(
    self,
    connection_item_a: ConnectionItemAWrite | Sequence[ConnectionItemAWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) connection item as.

    Note: This method iterates through all nodes and timeseries linked to connection_item_a and creates them including the edges
    between the nodes. For example, if any of `other_direct`, `outwards` or `self_direct` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        connection_item_a: Connection item a or sequence of connection item as to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new connection_item_a:

            >>> from omni import OmniClient
            >>> from omni.data_classes import ConnectionItemAWrite
            >>> client = OmniClient()
            >>> connection_item_a = ConnectionItemAWrite(external_id="my_connection_item_a", ...)
            >>> result = client.connection_item_a.apply(connection_item_a)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.connection_item_a.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(connection_item_a, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more connection item a.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the connection item a to delete.

required
space str

The space where all the connection item a are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete connection_item_a by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.connection_item_a.delete("my_connection_item_a")
Source code in examples/omni/_api/connection_item_a.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more connection item a.

    Args:
        external_id: External id of the connection item a to delete.
        space: The space where all the connection item a are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete connection_item_a by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.connection_item_a.delete("my_connection_item_a")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.connection_item_a.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, name=None, name_prefix=None, other_direct=None, self_direct=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for connection item as

Parameters:

Name Type Description Default
property ConnectionItemAFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None

The text field to search in.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
other_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The other direct to filter on.

None
self_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The self direct to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/connection_item_a.py
def histogram(
    self,
    property: ConnectionItemAFields,
    interval: float,
    query: str | None = None,
    search_property: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    other_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    self_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for connection item as

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        other_direct: The other direct to filter on.
        self_direct: The self direct to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_connection_item_a_filter(
        self._view_id,
        name,
        name_prefix,
        other_direct,
        self_direct,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(name=None, name_prefix=None, other_direct=None, self_direct=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None, retrieve_connections='skip')

List/filter connection item as

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
other_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The other direct to filter on.

None
self_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The self direct to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemAFields | Sequence[ConnectionItemAFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve other_direct, outwards and self_direct for the connection item as. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
ConnectionItemAList

List of requested connection item as

Examples:

List connection item as and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_as = client.connection_item_a.list(limit=5)
Source code in examples/omni/_api/connection_item_a.py
def list(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    other_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    self_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemAFields | Sequence[ConnectionItemAFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> ConnectionItemAList:
    """List/filter connection item as

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        other_direct: The other direct to filter on.
        self_direct: The self direct to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.
        retrieve_connections: Whether to retrieve `other_direct`, `outwards` and `self_direct` for the connection item as. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested connection item as

    Examples:

        List connection item as and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_as = client.connection_item_a.list(limit=5)

    """
    filter_ = _create_connection_item_a_filter(
        self._view_id,
        name,
        name_prefix,
        other_direct,
        self_direct,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    builder = QueryBuilder(ConnectionItemAList)
    has_data = dm.filters.HasData(views=[self._view_id])
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
            ),
            ConnectionItemA,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_outwards = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_outwards,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_outwards),
                dm.query.NodeResultSetExpression(
                    from_=edge_outwards,
                    filter=dm.filters.HasData(views=[ConnectionItemB._view_id]),
                ),
                ConnectionItemB,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(from_root),
                dm.query.NodeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    through=self._view_id.as_property_ref("otherDirect"),
                ),
                ConnectionItemCNode,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(from_root),
                dm.query.NodeResultSetExpression(
                    from_=from_root,
                    filter=dm.filters.HasData(views=[ConnectionItemA._view_id]),
                    direction="outwards",
                    through=self._view_id.as_property_ref("selfDirect"),
                ),
                ConnectionItemA,
            )
        )

    return builder.execute(self._client)

query()

Start a query for connection item as.

Source code in examples/omni/_api/connection_item_a.py
def query(self) -> ConnectionItemAQuery:
    """Start a query for connection item as."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return ConnectionItemAQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemA | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemAList

Retrieve one or more connection item as by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the connection item as.

required
space str

The space where all the connection item as are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
ConnectionItemA | ConnectionItemAList | None

The requested connection item as.

Examples:

Retrieve connection_item_a by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_a = client.connection_item_a.retrieve("my_connection_item_a")
Source code in examples/omni/_api/connection_item_a.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> ConnectionItemA | ConnectionItemAList | None:
    """Retrieve one or more connection item as by id(s).

    Args:
        external_id: External id or list of external ids of the connection item as.
        space: The space where all the connection item as are located.

    Returns:
        The requested connection item as.

    Examples:

        Retrieve connection_item_a by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_a = client.connection_item_a.retrieve("my_connection_item_a")

    """
    return self._retrieve(
        external_id,
        space,
        retrieve_edges=True,
        edge_api_name_type_direction_view_id_penta=[
            (
                self.outwards_edge,
                "outwards",
                dm.DirectRelationReference("pygen-models", "bidirectional"),
                "outwards",
                dm.ViewId("pygen-models", "ConnectionItemB", "1"),
            ),
        ],
    )

search(query, properties=None, name=None, name_prefix=None, other_direct=None, self_direct=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search connection item as

Parameters:

Name Type Description Default
query str

The search query,

required
properties ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
other_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The other direct to filter on.

None
self_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The self direct to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
ConnectionItemAList

Search results connection item as matching the query.

Examples:

Search for 'my_connection_item_a' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_as = client.connection_item_a.search('my_connection_item_a')
Source code in examples/omni/_api/connection_item_a.py
def search(
    self,
    query: str,
    properties: ConnectionItemATextFields | SequenceNotStr[ConnectionItemATextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    other_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    self_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemAFields | SequenceNotStr[ConnectionItemAFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> ConnectionItemAList:
    """Search connection item as

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        other_direct: The other direct to filter on.
        self_direct: The self direct to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item as to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results connection item as matching the query.

    Examples:

       Search for 'my_connection_item_a' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_as = client.connection_item_a.search('my_connection_item_a')

    """
    filter_ = _create_connection_item_a_filter(
        self._view_id,
        name,
        name_prefix,
        other_direct,
        self_direct,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

ConnectionItemAOutwardsAPI

Bases: EdgeAPI

Source code in examples/omni/_api/connection_item_a_outwards.py
class ConnectionItemAOutwardsAPI(EdgeAPI):
    def list(
        self,
        from_connection_item_a: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_a_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List outward edges of a connection item a.

        Args:
            from_connection_item_a: ID of the source connection item a.
            from_connection_item_a_space: Location of the connection item as.
            to_connection_item_b: ID of the target connection item b.
            to_connection_item_b_space: Location of the connection item bs.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of outward edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested outward edges.

        Examples:

            List 5 outward edges connected to "my_connection_item_a":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_a = client.connection_item_a.outwards_edge.list("my_connection_item_a", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectional"),
            from_connection_item_a,
            from_connection_item_a_space,
            to_connection_item_b,
            to_connection_item_b_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_a=None, from_connection_item_a_space=DEFAULT_INSTANCE_SPACE, to_connection_item_b=None, to_connection_item_b_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List outward edges of a connection item a.

Parameters:

Name Type Description Default
from_connection_item_a str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item a.

None
from_connection_item_a_space str

Location of the connection item as.

DEFAULT_INSTANCE_SPACE
to_connection_item_b str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item b.

None
to_connection_item_b_space str

Location of the connection item bs.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of outward edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested outward edges.

Examples:

List 5 outward edges connected to "my_connection_item_a":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_a = client.connection_item_a.outwards_edge.list("my_connection_item_a", limit=5)
Source code in examples/omni/_api/connection_item_a_outwards.py
def list(
    self,
    from_connection_item_a: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_a_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List outward edges of a connection item a.

    Args:
        from_connection_item_a: ID of the source connection item a.
        from_connection_item_a_space: Location of the connection item as.
        to_connection_item_b: ID of the target connection item b.
        to_connection_item_b_space: Location of the connection item bs.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of outward edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested outward edges.

    Examples:

        List 5 outward edges connected to "my_connection_item_a":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_a = client.connection_item_a.outwards_edge.list("my_connection_item_a", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectional"),
        from_connection_item_a,
        from_connection_item_a_space,
        to_connection_item_b,
        to_connection_item_b_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemAQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/connection_item_a_query.py
class ConnectionItemAQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemA", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=ConnectionItemA,
                max_retrieve_limit=limit,
            )
        )

    def outwards(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        retrieve_other_direct: bool = False,
        retrieve_self_direct: bool = False,
    ) -> ConnectionItemBQueryAPI[T_DomainModelList]:
        """Query along the outward edges of the connection item a.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of outward edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.
            retrieve_other_direct: Whether to retrieve the other direct for each connection item a or not.
            retrieve_self_direct: Whether to retrieve the self direct for each connection item a or not.

        Returns:
            ConnectionItemBQueryAPI: The query API for the connection item b.
        """
        from .connection_item_b_query import ConnectionItemBQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectional"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemBQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_b_filter(
            view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        if retrieve_other_direct:
            self._query_append_other_direct(from_)
        if retrieve_self_direct:
            self._query_append_self_direct(from_)
        return ConnectionItemBQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
        retrieve_other_direct: bool = False,
        retrieve_self_direct: bool = False,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Args:
            retrieve_other_direct: Whether to retrieve the other direct for each connection item a or not.
            retrieve_self_direct: Whether to retrieve the self direct for each connection item a or not.

        Returns:
            The list of the source nodes of the query.

        """
        from_ = self._builder[-1].name
        if retrieve_other_direct:
            self._query_append_other_direct(from_)
        if retrieve_self_direct:
            self._query_append_self_direct(from_)
        return self._query()

    def _query_append_other_direct(self, from_: str) -> None:
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    through=self._view_id.as_property_ref("otherDirect"),
                    direction="outwards",
                ),
                result_cls=ConnectionItemCNode,
            ),
        )

    def _query_append_self_direct(self, from_: str) -> None:
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    through=self._view_id.as_property_ref("selfDirect"),
                    direction="outwards",
                    filter=dm.filters.HasData(views=[ConnectionItemA._view_id]),
                ),
                result_cls=ConnectionItemA,
            ),
        )

outwards(name=None, name_prefix=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT, retrieve_other_direct=False, retrieve_self_direct=False)

Query along the outward edges of the connection item a.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of outward edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
retrieve_other_direct bool

Whether to retrieve the other direct for each connection item a or not.

False
retrieve_self_direct bool

Whether to retrieve the self direct for each connection item a or not.

False

Returns:

Name Type Description
ConnectionItemBQueryAPI ConnectionItemBQueryAPI[T_DomainModelList]

The query API for the connection item b.

Source code in examples/omni/_api/connection_item_a_query.py
def outwards(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    retrieve_other_direct: bool = False,
    retrieve_self_direct: bool = False,
) -> ConnectionItemBQueryAPI[T_DomainModelList]:
    """Query along the outward edges of the connection item a.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of outward edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.
        retrieve_other_direct: Whether to retrieve the other direct for each connection item a or not.
        retrieve_self_direct: Whether to retrieve the self direct for each connection item a or not.

    Returns:
        ConnectionItemBQueryAPI: The query API for the connection item b.
    """
    from .connection_item_b_query import ConnectionItemBQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectional"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemBQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_b_filter(
        view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    if retrieve_other_direct:
        self._query_append_other_direct(from_)
    if retrieve_self_direct:
        self._query_append_self_direct(from_)
    return ConnectionItemBQueryAPI(self._client, self._builder, node_filer, limit)

query(retrieve_other_direct=False, retrieve_self_direct=False)

Execute query and return the result.

Parameters:

Name Type Description Default
retrieve_other_direct bool

Whether to retrieve the other direct for each connection item a or not.

False
retrieve_self_direct bool

Whether to retrieve the self direct for each connection item a or not.

False

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/connection_item_a_query.py
def query(
    self,
    retrieve_other_direct: bool = False,
    retrieve_self_direct: bool = False,
) -> T_DomainModelList:
    """Execute query and return the result.

    Args:
        retrieve_other_direct: Whether to retrieve the other direct for each connection item a or not.
        retrieve_self_direct: Whether to retrieve the self direct for each connection item a or not.

    Returns:
        The list of the source nodes of the query.

    """
    from_ = self._builder[-1].name
    if retrieve_other_direct:
        self._query_append_other_direct(from_)
    if retrieve_self_direct:
        self._query_append_self_direct(from_)
    return self._query()

ConnectionItemBAPI

Bases: NodeAPI[ConnectionItemB, ConnectionItemBWrite, ConnectionItemBList, ConnectionItemBWriteList]

Source code in examples/omni/_api/connection_item_b.py
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
class ConnectionItemBAPI(NodeAPI[ConnectionItemB, ConnectionItemBWrite, ConnectionItemBList, ConnectionItemBWriteList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemB", "1")
    _properties_by_field = _CONNECTIONITEMB_PROPERTIES_BY_FIELD
    _class_type = ConnectionItemB
    _class_list = ConnectionItemBList
    _class_write_list = ConnectionItemBWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.inwards_edge = ConnectionItemBInwardsAPI(client)
        self.self_edge_edge = ConnectionItemBSelfEdgeAPI(client)

    def __call__(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> ConnectionItemBQueryAPI[ConnectionItemBList]:
        """Query starting at connection item bs.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for connection item bs.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_connection_item_b_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(ConnectionItemBList)
        return ConnectionItemBQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        connection_item_b: ConnectionItemBWrite | Sequence[ConnectionItemBWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) connection item bs.

        Note: This method iterates through all nodes and timeseries linked to connection_item_b and creates them including the edges
        between the nodes. For example, if any of `inwards` or `self_edge` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            connection_item_b: Connection item b or sequence of connection item bs to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new connection_item_b:

                >>> from omni import OmniClient
                >>> from omni.data_classes import ConnectionItemBWrite
                >>> client = OmniClient()
                >>> connection_item_b = ConnectionItemBWrite(external_id="my_connection_item_b", ...)
                >>> result = client.connection_item_b.apply(connection_item_b)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.connection_item_b.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(connection_item_b, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more connection item b.

        Args:
            external_id: External id of the connection item b to delete.
            space: The space where all the connection item b are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete connection_item_b by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.connection_item_b.delete("my_connection_item_b")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.connection_item_b.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemB | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemBList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemB | ConnectionItemBList | None:
        """Retrieve one or more connection item bs by id(s).

        Args:
            external_id: External id or list of external ids of the connection item bs.
            space: The space where all the connection item bs are located.

        Returns:
            The requested connection item bs.

        Examples:

            Retrieve connection_item_b by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_b = client.connection_item_b.retrieve("my_connection_item_b")

        """
        return self._retrieve(
            external_id,
            space,
            retrieve_edges=True,
            edge_api_name_type_direction_view_id_penta=[
                (
                    self.inwards_edge,
                    "inwards",
                    dm.DirectRelationReference("pygen-models", "bidirectional"),
                    "inwards",
                    dm.ViewId("pygen-models", "ConnectionItemA", "1"),
                ),
                (
                    self.self_edge_edge,
                    "self_edge",
                    dm.DirectRelationReference("pygen-models", "reflexive"),
                    "outwards",
                    dm.ViewId("pygen-models", "ConnectionItemB", "1"),
                ),
            ],
        )

    def search(
        self,
        query: str,
        properties: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> ConnectionItemBList:
        """Search connection item bs

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results connection item bs matching the query.

        Examples:

           Search for 'my_connection_item_b' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_bs = client.connection_item_b.search('my_connection_item_b')

        """
        filter_ = _create_connection_item_b_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields],
        property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
        property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across connection item bs

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count connection item bs in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.connection_item_b.aggregate("count", space="my_space")

        """

        filter_ = _create_connection_item_b_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: ConnectionItemBFields,
        interval: float,
        query: str | None = None,
        search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for connection item bs

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_connection_item_b_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> ConnectionItemBQuery:
        """Start a query for connection item bs."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return ConnectionItemBQuery(self._client)

    def list(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemBFields | Sequence[ConnectionItemBFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> ConnectionItemBList:
        """List/filter connection item bs

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.
            retrieve_connections: Whether to retrieve `inwards` and `self_edge` for the connection item bs. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested connection item bs

        Examples:

            List connection item bs and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_bs = client.connection_item_b.list(limit=5)

        """
        filter_ = _create_connection_item_b_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
                sort_by=sort_by,  # type: ignore[arg-type]
                direction=direction,
                sort=sort,
            )

        builder = QueryBuilder(ConnectionItemBList)
        has_data = dm.filters.HasData(views=[self._view_id])
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                    sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
                ),
                ConnectionItemB,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_inwards = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_inwards,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="inwards",
                    chain_to="destination",
                ),
            )
        )
        edge_self_edge = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_self_edge,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_inwards),
                    dm.query.NodeResultSetExpression(
                        from_=edge_inwards,
                        filter=dm.filters.HasData(views=[ConnectionItemA._view_id]),
                    ),
                    ConnectionItemA,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_self_edge),
                    dm.query.NodeResultSetExpression(
                        from_=edge_self_edge,
                        filter=dm.filters.HasData(views=[ConnectionItemB._view_id]),
                    ),
                    ConnectionItemB,
                )
            )

        return builder.execute(self._client)

__call__(name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at connection item bs.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
ConnectionItemBQueryAPI[ConnectionItemBList]

A query API for connection item bs.

Source code in examples/omni/_api/connection_item_b.py
def __call__(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> ConnectionItemBQueryAPI[ConnectionItemBList]:
    """Query starting at connection item bs.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for connection item bs.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_connection_item_b_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(ConnectionItemBList)
    return ConnectionItemBQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None, query: str | None = None, search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None, query: str | None = None, search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields], property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None, query: str | None = None, search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across connection item bs

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None

The property to group by when doing the aggregation.

None
property ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None

The text field to search in.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count connection item bs in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.connection_item_b.aggregate("count", space="my_space")
Source code in examples/omni/_api/connection_item_b.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
    property: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
    query: str | None = None,
    search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across connection item bs

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count connection item bs in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.connection_item_b.aggregate("count", space="my_space")

    """

    filter_ = _create_connection_item_b_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(connection_item_b, replace=False, write_none=False)

Add or update (upsert) connection item bs.

Note: This method iterates through all nodes and timeseries linked to connection_item_b and creates them including the edges between the nodes. For example, if any of inwards or self_edge are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
connection_item_b ConnectionItemBWrite | Sequence[ConnectionItemBWrite]

Connection item b or sequence of connection item bs to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new connection_item_b:

    >>> from omni import OmniClient
    >>> from omni.data_classes import ConnectionItemBWrite
    >>> client = OmniClient()
    >>> connection_item_b = ConnectionItemBWrite(external_id="my_connection_item_b", ...)
    >>> result = client.connection_item_b.apply(connection_item_b)
Source code in examples/omni/_api/connection_item_b.py
def apply(
    self,
    connection_item_b: ConnectionItemBWrite | Sequence[ConnectionItemBWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) connection item bs.

    Note: This method iterates through all nodes and timeseries linked to connection_item_b and creates them including the edges
    between the nodes. For example, if any of `inwards` or `self_edge` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        connection_item_b: Connection item b or sequence of connection item bs to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new connection_item_b:

            >>> from omni import OmniClient
            >>> from omni.data_classes import ConnectionItemBWrite
            >>> client = OmniClient()
            >>> connection_item_b = ConnectionItemBWrite(external_id="my_connection_item_b", ...)
            >>> result = client.connection_item_b.apply(connection_item_b)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.connection_item_b.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(connection_item_b, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more connection item b.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the connection item b to delete.

required
space str

The space where all the connection item b are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete connection_item_b by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.connection_item_b.delete("my_connection_item_b")
Source code in examples/omni/_api/connection_item_b.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more connection item b.

    Args:
        external_id: External id of the connection item b to delete.
        space: The space where all the connection item b are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete connection_item_b by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.connection_item_b.delete("my_connection_item_b")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.connection_item_b.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for connection item bs

Parameters:

Name Type Description Default
property ConnectionItemBFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None

The text field to search in.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/connection_item_b.py
def histogram(
    self,
    property: ConnectionItemBFields,
    interval: float,
    query: str | None = None,
    search_property: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for connection item bs

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_connection_item_b_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None, retrieve_connections='skip')

List/filter connection item bs

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemBFields | Sequence[ConnectionItemBFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve inwards and self_edge for the connection item bs. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
ConnectionItemBList

List of requested connection item bs

Examples:

List connection item bs and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_bs = client.connection_item_b.list(limit=5)
Source code in examples/omni/_api/connection_item_b.py
def list(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemBFields | Sequence[ConnectionItemBFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> ConnectionItemBList:
    """List/filter connection item bs

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.
        retrieve_connections: Whether to retrieve `inwards` and `self_edge` for the connection item bs. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested connection item bs

    Examples:

        List connection item bs and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_bs = client.connection_item_b.list(limit=5)

    """
    filter_ = _create_connection_item_b_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    builder = QueryBuilder(ConnectionItemBList)
    has_data = dm.filters.HasData(views=[self._view_id])
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
            ),
            ConnectionItemB,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_inwards = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_inwards,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="inwards",
                chain_to="destination",
            ),
        )
    )
    edge_self_edge = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_self_edge,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_inwards),
                dm.query.NodeResultSetExpression(
                    from_=edge_inwards,
                    filter=dm.filters.HasData(views=[ConnectionItemA._view_id]),
                ),
                ConnectionItemA,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_self_edge),
                dm.query.NodeResultSetExpression(
                    from_=edge_self_edge,
                    filter=dm.filters.HasData(views=[ConnectionItemB._view_id]),
                ),
                ConnectionItemB,
            )
        )

    return builder.execute(self._client)

query()

Start a query for connection item bs.

Source code in examples/omni/_api/connection_item_b.py
def query(self) -> ConnectionItemBQuery:
    """Start a query for connection item bs."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return ConnectionItemBQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemB | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemBList

Retrieve one or more connection item bs by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the connection item bs.

required
space str

The space where all the connection item bs are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
ConnectionItemB | ConnectionItemBList | None

The requested connection item bs.

Examples:

Retrieve connection_item_b by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_b = client.connection_item_b.retrieve("my_connection_item_b")
Source code in examples/omni/_api/connection_item_b.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> ConnectionItemB | ConnectionItemBList | None:
    """Retrieve one or more connection item bs by id(s).

    Args:
        external_id: External id or list of external ids of the connection item bs.
        space: The space where all the connection item bs are located.

    Returns:
        The requested connection item bs.

    Examples:

        Retrieve connection_item_b by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_b = client.connection_item_b.retrieve("my_connection_item_b")

    """
    return self._retrieve(
        external_id,
        space,
        retrieve_edges=True,
        edge_api_name_type_direction_view_id_penta=[
            (
                self.inwards_edge,
                "inwards",
                dm.DirectRelationReference("pygen-models", "bidirectional"),
                "inwards",
                dm.ViewId("pygen-models", "ConnectionItemA", "1"),
            ),
            (
                self.self_edge_edge,
                "self_edge",
                dm.DirectRelationReference("pygen-models", "reflexive"),
                "outwards",
                dm.ViewId("pygen-models", "ConnectionItemB", "1"),
            ),
        ],
    )

search(query, properties=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search connection item bs

Parameters:

Name Type Description Default
query str

The search query,

required
properties ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
ConnectionItemBList

Search results connection item bs matching the query.

Examples:

Search for 'my_connection_item_b' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_bs = client.connection_item_b.search('my_connection_item_b')
Source code in examples/omni/_api/connection_item_b.py
def search(
    self,
    query: str,
    properties: ConnectionItemBTextFields | SequenceNotStr[ConnectionItemBTextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemBFields | SequenceNotStr[ConnectionItemBFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> ConnectionItemBList:
    """Search connection item bs

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item bs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results connection item bs matching the query.

    Examples:

       Search for 'my_connection_item_b' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_bs = client.connection_item_b.search('my_connection_item_b')

    """
    filter_ = _create_connection_item_b_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

ConnectionItemBInwardsAPI

Bases: EdgeAPI

Source code in examples/omni/_api/connection_item_b_inwards.py
class ConnectionItemBInwardsAPI(EdgeAPI):
    def list(
        self,
        from_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_a: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_a_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List inward edges of a connection item b.

        Args:
            from_connection_item_b: ID of the source connection item b.
            from_connection_item_b_space: Location of the connection item bs.
            to_connection_item_a: ID of the target connection item a.
            to_connection_item_a_space: Location of the connection item as.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of inward edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested inward edges.

        Examples:

            List 5 inward edges connected to "my_connection_item_b":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_b = client.connection_item_b.inwards_edge.list("my_connection_item_b", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectional"),
            to_connection_item_a,
            to_connection_item_a_space,
            from_connection_item_b,
            from_connection_item_b_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_b=None, from_connection_item_b_space=DEFAULT_INSTANCE_SPACE, to_connection_item_a=None, to_connection_item_a_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List inward edges of a connection item b.

Parameters:

Name Type Description Default
from_connection_item_b str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item b.

None
from_connection_item_b_space str

Location of the connection item bs.

DEFAULT_INSTANCE_SPACE
to_connection_item_a str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item a.

None
to_connection_item_a_space str

Location of the connection item as.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of inward edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested inward edges.

Examples:

List 5 inward edges connected to "my_connection_item_b":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_b = client.connection_item_b.inwards_edge.list("my_connection_item_b", limit=5)
Source code in examples/omni/_api/connection_item_b_inwards.py
def list(
    self,
    from_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_a: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_a_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List inward edges of a connection item b.

    Args:
        from_connection_item_b: ID of the source connection item b.
        from_connection_item_b_space: Location of the connection item bs.
        to_connection_item_a: ID of the target connection item a.
        to_connection_item_a_space: Location of the connection item as.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of inward edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested inward edges.

    Examples:

        List 5 inward edges connected to "my_connection_item_b":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_b = client.connection_item_b.inwards_edge.list("my_connection_item_b", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectional"),
        to_connection_item_a,
        to_connection_item_a_space,
        from_connection_item_b,
        from_connection_item_b_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemBQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/connection_item_b_query.py
class ConnectionItemBQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemB", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=ConnectionItemB,
                max_retrieve_limit=limit,
            )
        )

    def inwards(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemAQueryAPI[T_DomainModelList]:
        """Query along the inward edges of the connection item b.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            other_direct: The other direct to filter on.
            self_direct: The self direct to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of inward edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemAQueryAPI: The query API for the connection item a.
        """
        from .connection_item_a_query import ConnectionItemAQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectional"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="inwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemAQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_a_filter(
            view_id,
            name,
            name_prefix,
            other_direct,
            self_direct,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemAQueryAPI(self._client, self._builder, node_filer, limit)

    def self_edge(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemBQueryAPI[T_DomainModelList]:
        """Query along the self edge edges of the connection item b.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of self edge edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemBQueryAPI: The query API for the connection item b.
        """
        from .connection_item_b_query import ConnectionItemBQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "reflexive"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemBQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_b_filter(
            view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemBQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

inwards(name=None, name_prefix=None, other_direct=None, self_direct=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the inward edges of the connection item b.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
other_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The other direct to filter on.

None
self_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The self direct to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of inward edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemAQueryAPI ConnectionItemAQueryAPI[T_DomainModelList]

The query API for the connection item a.

Source code in examples/omni/_api/connection_item_b_query.py
def inwards(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    other_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    self_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemAQueryAPI[T_DomainModelList]:
    """Query along the inward edges of the connection item b.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        other_direct: The other direct to filter on.
        self_direct: The self direct to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of inward edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemAQueryAPI: The query API for the connection item a.
    """
    from .connection_item_a_query import ConnectionItemAQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectional"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="inwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemAQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_a_filter(
        view_id,
        name,
        name_prefix,
        other_direct,
        self_direct,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemAQueryAPI(self._client, self._builder, node_filer, limit)

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/connection_item_b_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

self_edge(name=None, name_prefix=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the self edge edges of the connection item b.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of self edge edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemBQueryAPI ConnectionItemBQueryAPI[T_DomainModelList]

The query API for the connection item b.

Source code in examples/omni/_api/connection_item_b_query.py
def self_edge(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemBQueryAPI[T_DomainModelList]:
    """Query along the self edge edges of the connection item b.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of self edge edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemBQueryAPI: The query API for the connection item b.
    """
    from .connection_item_b_query import ConnectionItemBQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "reflexive"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemBQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_b_filter(
        view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemBQueryAPI(self._client, self._builder, node_filer, limit)

ConnectionItemBSelfEdgeAPI

Bases: EdgeAPI

Source code in examples/omni/_api/connection_item_b_self_edge.py
class ConnectionItemBSelfEdgeAPI(EdgeAPI):
    def list(
        self,
        from_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List self edge edges of a connection item b.

        Args:
            from_connection_item_b: ID of the source connection item b.
            from_connection_item_b_space: Location of the connection item bs.
            to_connection_item_b: ID of the target connection item b.
            to_connection_item_b_space: Location of the connection item bs.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of self edge edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested self edge edges.

        Examples:

            List 5 self edge edges connected to "my_connection_item_b":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_b = client.connection_item_b.self_edge_edge.list("my_connection_item_b", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "reflexive"),
            from_connection_item_b,
            from_connection_item_b_space,
            to_connection_item_b,
            to_connection_item_b_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_b=None, from_connection_item_b_space=DEFAULT_INSTANCE_SPACE, to_connection_item_b=None, to_connection_item_b_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List self edge edges of a connection item b.

Parameters:

Name Type Description Default
from_connection_item_b str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item b.

None
from_connection_item_b_space str

Location of the connection item bs.

DEFAULT_INSTANCE_SPACE
to_connection_item_b str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item b.

None
to_connection_item_b_space str

Location of the connection item bs.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of self edge edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested self edge edges.

Examples:

List 5 self edge edges connected to "my_connection_item_b":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_b = client.connection_item_b.self_edge_edge.list("my_connection_item_b", limit=5)
Source code in examples/omni/_api/connection_item_b_self_edge.py
def list(
    self,
    from_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List self edge edges of a connection item b.

    Args:
        from_connection_item_b: ID of the source connection item b.
        from_connection_item_b_space: Location of the connection item bs.
        to_connection_item_b: ID of the target connection item b.
        to_connection_item_b_space: Location of the connection item bs.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of self edge edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested self edge edges.

    Examples:

        List 5 self edge edges connected to "my_connection_item_b":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_b = client.connection_item_b.self_edge_edge.list("my_connection_item_b", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "reflexive"),
        from_connection_item_b,
        from_connection_item_b_space,
        to_connection_item_b,
        to_connection_item_b_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemCNodeAPI

Bases: NodeAPI[ConnectionItemCNode, ConnectionItemCNodeWrite, ConnectionItemCNodeList, ConnectionItemCNodeWriteList]

Source code in examples/omni/_api/connection_item_c_node.py
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
class ConnectionItemCNodeAPI(
    NodeAPI[ConnectionItemCNode, ConnectionItemCNodeWrite, ConnectionItemCNodeList, ConnectionItemCNodeWriteList]
):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemC", "1")
    _properties_by_field = {}
    _class_type = ConnectionItemCNode
    _class_list = ConnectionItemCNodeList
    _class_write_list = ConnectionItemCNodeWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.connection_item_a_edge = ConnectionItemCNodeConnectionItemAAPI(client)
        self.connection_item_b_edge = ConnectionItemCNodeConnectionItemBAPI(client)

    def __call__(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> ConnectionItemCNodeQueryAPI[ConnectionItemCNodeList]:
        """Query starting at connection item c nodes.

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for connection item c nodes.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_connection_item_c_node_filter(
            self._view_id,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(ConnectionItemCNodeList)
        return ConnectionItemCNodeQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        connection_item_c_node: ConnectionItemCNodeWrite | Sequence[ConnectionItemCNodeWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) connection item c nodes.

        Note: This method iterates through all nodes and timeseries linked to connection_item_c_node and creates them including the edges
        between the nodes. For example, if any of `connection_item_a` or `connection_item_b` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            connection_item_c_node: Connection item c node or sequence of connection item c nodes to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new connection_item_c_node:

                >>> from omni import OmniClient
                >>> from omni.data_classes import ConnectionItemCNodeWrite
                >>> client = OmniClient()
                >>> connection_item_c_node = ConnectionItemCNodeWrite(external_id="my_connection_item_c_node", ...)
                >>> result = client.connection_item_c_node.apply(connection_item_c_node)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.connection_item_c_node.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(connection_item_c_node, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more connection item c node.

        Args:
            external_id: External id of the connection item c node to delete.
            space: The space where all the connection item c node are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete connection_item_c_node by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.connection_item_c_node.delete("my_connection_item_c_node")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.connection_item_c_node.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemCNode | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemCNodeList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemCNode | ConnectionItemCNodeList | None:
        """Retrieve one or more connection item c nodes by id(s).

        Args:
            external_id: External id or list of external ids of the connection item c nodes.
            space: The space where all the connection item c nodes are located.

        Returns:
            The requested connection item c nodes.

        Examples:

            Retrieve connection_item_c_node by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_c_node = client.connection_item_c_node.retrieve("my_connection_item_c_node")

        """
        return self._retrieve(
            external_id,
            space,
            retrieve_edges=True,
            edge_api_name_type_direction_view_id_penta=[
                (
                    self.connection_item_a_edge,
                    "connection_item_a",
                    dm.DirectRelationReference("pygen-models", "unidirectional"),
                    "outwards",
                    dm.ViewId("pygen-models", "ConnectionItemA", "1"),
                ),
                (
                    self.connection_item_b_edge,
                    "connection_item_b",
                    dm.DirectRelationReference("pygen-models", "unidirectional"),
                    "outwards",
                    dm.ViewId("pygen-models", "ConnectionItemB", "1"),
                ),
            ],
        )

    def search(
        self,
        query: str,
        properties: ConnectionItemCNodeTextFields | SequenceNotStr[ConnectionItemCNodeTextFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> ConnectionItemCNodeList:
        """Search connection item c nodes

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results connection item c nodes matching the query.

        Examples:

           Search for 'my_connection_item_c_node' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_c_nodes = client.connection_item_c_node.search('my_connection_item_c_node')

        """
        filter_ = _create_connection_item_c_node_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields],
        property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
        property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across connection item c nodes

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count connection item c nodes in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.connection_item_c_node.aggregate("count", space="my_space")

        """

        filter_ = _create_connection_item_c_node_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=None,
            search_properties=None,
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: ConnectionItemCNodeFields,
        interval: float,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for connection item c nodes

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_connection_item_c_node_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            None,
            None,
            limit,
            filter_,
        )

    def query(self) -> ConnectionItemCNodeQuery:
        """Start a query for connection item c nodes."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return ConnectionItemCNodeQuery(self._client)

    def list(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> ConnectionItemCNodeList:
        """List/filter connection item c nodes

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            retrieve_connections: Whether to retrieve `connection_item_a` and `connection_item_b` for the connection item c nodes. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested connection item c nodes

        Examples:

            List connection item c nodes and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_c_nodes = client.connection_item_c_node.list(limit=5)

        """
        filter_ = _create_connection_item_c_node_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
            )

        builder = QueryBuilder(ConnectionItemCNodeList)
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=filter_,
                ),
                ConnectionItemCNode,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_connection_item_a = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_connection_item_a,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
            )
        )
        edge_connection_item_b = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_connection_item_b,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_connection_item_a),
                    dm.query.NodeResultSetExpression(
                        from_=edge_connection_item_a,
                        filter=dm.filters.HasData(views=[ConnectionItemA._view_id]),
                    ),
                    ConnectionItemA,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_connection_item_b),
                    dm.query.NodeResultSetExpression(
                        from_=edge_connection_item_b,
                        filter=dm.filters.HasData(views=[ConnectionItemB._view_id]),
                    ),
                    ConnectionItemB,
                )
            )

        return builder.execute(self._client)

__call__(external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at connection item c nodes.

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
ConnectionItemCNodeQueryAPI[ConnectionItemCNodeList]

A query API for connection item c nodes.

Source code in examples/omni/_api/connection_item_c_node.py
def __call__(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> ConnectionItemCNodeQueryAPI[ConnectionItemCNodeList]:
    """Query starting at connection item c nodes.

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for connection item c nodes.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_connection_item_c_node_filter(
        self._view_id,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(ConnectionItemCNodeList)
    return ConnectionItemCNodeQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields], property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across connection item c nodes

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None

The property to group by when doing the aggregation.

None
property ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None

The property to perform aggregation on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count connection item c nodes in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.connection_item_c_node.aggregate("count", space="my_space")
Source code in examples/omni/_api/connection_item_c_node.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
    property: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across connection item c nodes

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count connection item c nodes in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.connection_item_c_node.aggregate("count", space="my_space")

    """

    filter_ = _create_connection_item_c_node_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=None,
        search_properties=None,
        limit=limit,
        filter=filter_,
    )

apply(connection_item_c_node, replace=False, write_none=False)

Add or update (upsert) connection item c nodes.

Note: This method iterates through all nodes and timeseries linked to connection_item_c_node and creates them including the edges between the nodes. For example, if any of connection_item_a or connection_item_b are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
connection_item_c_node ConnectionItemCNodeWrite | Sequence[ConnectionItemCNodeWrite]

Connection item c node or sequence of connection item c nodes to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new connection_item_c_node:

    >>> from omni import OmniClient
    >>> from omni.data_classes import ConnectionItemCNodeWrite
    >>> client = OmniClient()
    >>> connection_item_c_node = ConnectionItemCNodeWrite(external_id="my_connection_item_c_node", ...)
    >>> result = client.connection_item_c_node.apply(connection_item_c_node)
Source code in examples/omni/_api/connection_item_c_node.py
def apply(
    self,
    connection_item_c_node: ConnectionItemCNodeWrite | Sequence[ConnectionItemCNodeWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) connection item c nodes.

    Note: This method iterates through all nodes and timeseries linked to connection_item_c_node and creates them including the edges
    between the nodes. For example, if any of `connection_item_a` or `connection_item_b` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        connection_item_c_node: Connection item c node or sequence of connection item c nodes to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new connection_item_c_node:

            >>> from omni import OmniClient
            >>> from omni.data_classes import ConnectionItemCNodeWrite
            >>> client = OmniClient()
            >>> connection_item_c_node = ConnectionItemCNodeWrite(external_id="my_connection_item_c_node", ...)
            >>> result = client.connection_item_c_node.apply(connection_item_c_node)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.connection_item_c_node.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(connection_item_c_node, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more connection item c node.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the connection item c node to delete.

required
space str

The space where all the connection item c node are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete connection_item_c_node by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.connection_item_c_node.delete("my_connection_item_c_node")
Source code in examples/omni/_api/connection_item_c_node.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more connection item c node.

    Args:
        external_id: External id of the connection item c node to delete.
        space: The space where all the connection item c node are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete connection_item_c_node by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.connection_item_c_node.delete("my_connection_item_c_node")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.connection_item_c_node.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for connection item c nodes

Parameters:

Name Type Description Default
property ConnectionItemCNodeFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/connection_item_c_node.py
def histogram(
    self,
    property: ConnectionItemCNodeFields,
    interval: float,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for connection item c nodes

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_connection_item_c_node_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        None,
        None,
        limit,
        filter_,
    )

list(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, retrieve_connections='skip')

List/filter connection item c nodes

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve connection_item_a and connection_item_b for the connection item c nodes. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
ConnectionItemCNodeList

List of requested connection item c nodes

Examples:

List connection item c nodes and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_c_nodes = client.connection_item_c_node.list(limit=5)
Source code in examples/omni/_api/connection_item_c_node.py
def list(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> ConnectionItemCNodeList:
    """List/filter connection item c nodes

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        retrieve_connections: Whether to retrieve `connection_item_a` and `connection_item_b` for the connection item c nodes. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested connection item c nodes

    Examples:

        List connection item c nodes and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_c_nodes = client.connection_item_c_node.list(limit=5)

    """
    filter_ = _create_connection_item_c_node_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
        )

    builder = QueryBuilder(ConnectionItemCNodeList)
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=filter_,
            ),
            ConnectionItemCNode,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_connection_item_a = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_connection_item_a,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
        )
    )
    edge_connection_item_b = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_connection_item_b,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_connection_item_a),
                dm.query.NodeResultSetExpression(
                    from_=edge_connection_item_a,
                    filter=dm.filters.HasData(views=[ConnectionItemA._view_id]),
                ),
                ConnectionItemA,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_connection_item_b),
                dm.query.NodeResultSetExpression(
                    from_=edge_connection_item_b,
                    filter=dm.filters.HasData(views=[ConnectionItemB._view_id]),
                ),
                ConnectionItemB,
            )
        )

    return builder.execute(self._client)

query()

Start a query for connection item c nodes.

Source code in examples/omni/_api/connection_item_c_node.py
def query(self) -> ConnectionItemCNodeQuery:
    """Start a query for connection item c nodes."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return ConnectionItemCNodeQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemCNode | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemCNodeList

Retrieve one or more connection item c nodes by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the connection item c nodes.

required
space str

The space where all the connection item c nodes are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
ConnectionItemCNode | ConnectionItemCNodeList | None

The requested connection item c nodes.

Examples:

Retrieve connection_item_c_node by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_c_node = client.connection_item_c_node.retrieve("my_connection_item_c_node")
Source code in examples/omni/_api/connection_item_c_node.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> ConnectionItemCNode | ConnectionItemCNodeList | None:
    """Retrieve one or more connection item c nodes by id(s).

    Args:
        external_id: External id or list of external ids of the connection item c nodes.
        space: The space where all the connection item c nodes are located.

    Returns:
        The requested connection item c nodes.

    Examples:

        Retrieve connection_item_c_node by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_c_node = client.connection_item_c_node.retrieve("my_connection_item_c_node")

    """
    return self._retrieve(
        external_id,
        space,
        retrieve_edges=True,
        edge_api_name_type_direction_view_id_penta=[
            (
                self.connection_item_a_edge,
                "connection_item_a",
                dm.DirectRelationReference("pygen-models", "unidirectional"),
                "outwards",
                dm.ViewId("pygen-models", "ConnectionItemA", "1"),
            ),
            (
                self.connection_item_b_edge,
                "connection_item_b",
                dm.DirectRelationReference("pygen-models", "unidirectional"),
                "outwards",
                dm.ViewId("pygen-models", "ConnectionItemB", "1"),
            ),
        ],
    )

search(query, properties=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search connection item c nodes

Parameters:

Name Type Description Default
query str

The search query,

required
properties ConnectionItemCNodeTextFields | SequenceNotStr[ConnectionItemCNodeTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
ConnectionItemCNodeList

Search results connection item c nodes matching the query.

Examples:

Search for 'my_connection_item_c_node' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_c_nodes = client.connection_item_c_node.search('my_connection_item_c_node')
Source code in examples/omni/_api/connection_item_c_node.py
def search(
    self,
    query: str,
    properties: ConnectionItemCNodeTextFields | SequenceNotStr[ConnectionItemCNodeTextFields] | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemCNodeFields | SequenceNotStr[ConnectionItemCNodeFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> ConnectionItemCNodeList:
    """Search connection item c nodes

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item c nodes to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results connection item c nodes matching the query.

    Examples:

       Search for 'my_connection_item_c_node' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_c_nodes = client.connection_item_c_node.search('my_connection_item_c_node')

    """
    filter_ = _create_connection_item_c_node_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

ConnectionItemCNodeConnectionItemAAPI

Bases: EdgeAPI

Source code in examples/omni/_api/connection_item_c_node_connection_item_a.py
class ConnectionItemCNodeConnectionItemAAPI(EdgeAPI):
    def list(
        self,
        from_connection_item_c_node: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_c_node_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_a: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_a_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List connection item a edges of a connection item c node.

        Args:
            from_connection_item_c_node: ID of the source connection item c node.
            from_connection_item_c_node_space: Location of the connection item c nodes.
            to_connection_item_a: ID of the target connection item a.
            to_connection_item_a_space: Location of the connection item as.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item a edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested connection item a edges.

        Examples:

            List 5 connection item a edges connected to "my_connection_item_c_node":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_c_node = client.connection_item_c_node.connection_item_a_edge.list("my_connection_item_c_node", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "unidirectional"),
            from_connection_item_c_node,
            from_connection_item_c_node_space,
            to_connection_item_a,
            to_connection_item_a_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_c_node=None, from_connection_item_c_node_space=DEFAULT_INSTANCE_SPACE, to_connection_item_a=None, to_connection_item_a_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List connection item a edges of a connection item c node.

Parameters:

Name Type Description Default
from_connection_item_c_node str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item c node.

None
from_connection_item_c_node_space str

Location of the connection item c nodes.

DEFAULT_INSTANCE_SPACE
to_connection_item_a str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item a.

None
to_connection_item_a_space str

Location of the connection item as.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of connection item a edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested connection item a edges.

Examples:

List 5 connection item a edges connected to "my_connection_item_c_node":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_c_node = client.connection_item_c_node.connection_item_a_edge.list("my_connection_item_c_node", limit=5)
Source code in examples/omni/_api/connection_item_c_node_connection_item_a.py
def list(
    self,
    from_connection_item_c_node: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_c_node_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_a: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_a_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List connection item a edges of a connection item c node.

    Args:
        from_connection_item_c_node: ID of the source connection item c node.
        from_connection_item_c_node_space: Location of the connection item c nodes.
        to_connection_item_a: ID of the target connection item a.
        to_connection_item_a_space: Location of the connection item as.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item a edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested connection item a edges.

    Examples:

        List 5 connection item a edges connected to "my_connection_item_c_node":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_c_node = client.connection_item_c_node.connection_item_a_edge.list("my_connection_item_c_node", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "unidirectional"),
        from_connection_item_c_node,
        from_connection_item_c_node_space,
        to_connection_item_a,
        to_connection_item_a_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemCNodeConnectionItemBAPI

Bases: EdgeAPI

Source code in examples/omni/_api/connection_item_c_node_connection_item_b.py
class ConnectionItemCNodeConnectionItemBAPI(EdgeAPI):
    def list(
        self,
        from_connection_item_c_node: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_c_node_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List connection item b edges of a connection item c node.

        Args:
            from_connection_item_c_node: ID of the source connection item c node.
            from_connection_item_c_node_space: Location of the connection item c nodes.
            to_connection_item_b: ID of the target connection item b.
            to_connection_item_b_space: Location of the connection item bs.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item b edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested connection item b edges.

        Examples:

            List 5 connection item b edges connected to "my_connection_item_c_node":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_c_node = client.connection_item_c_node.connection_item_b_edge.list("my_connection_item_c_node", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "unidirectional"),
            from_connection_item_c_node,
            from_connection_item_c_node_space,
            to_connection_item_b,
            to_connection_item_b_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_c_node=None, from_connection_item_c_node_space=DEFAULT_INSTANCE_SPACE, to_connection_item_b=None, to_connection_item_b_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List connection item b edges of a connection item c node.

Parameters:

Name Type Description Default
from_connection_item_c_node str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item c node.

None
from_connection_item_c_node_space str

Location of the connection item c nodes.

DEFAULT_INSTANCE_SPACE
to_connection_item_b str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item b.

None
to_connection_item_b_space str

Location of the connection item bs.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of connection item b edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested connection item b edges.

Examples:

List 5 connection item b edges connected to "my_connection_item_c_node":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_c_node = client.connection_item_c_node.connection_item_b_edge.list("my_connection_item_c_node", limit=5)
Source code in examples/omni/_api/connection_item_c_node_connection_item_b.py
def list(
    self,
    from_connection_item_c_node: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_c_node_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_b: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_b_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List connection item b edges of a connection item c node.

    Args:
        from_connection_item_c_node: ID of the source connection item c node.
        from_connection_item_c_node_space: Location of the connection item c nodes.
        to_connection_item_b: ID of the target connection item b.
        to_connection_item_b_space: Location of the connection item bs.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item b edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested connection item b edges.

    Examples:

        List 5 connection item b edges connected to "my_connection_item_c_node":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_c_node = client.connection_item_c_node.connection_item_b_edge.list("my_connection_item_c_node", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "unidirectional"),
        from_connection_item_c_node,
        from_connection_item_c_node_space,
        to_connection_item_b,
        to_connection_item_b_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemCNodeQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/connection_item_c_node_query.py
class ConnectionItemCNodeQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemC", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=ConnectionItemCNode,
                max_retrieve_limit=limit,
            )
        )

    def connection_item_a(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        other_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        self_direct: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemAQueryAPI[T_DomainModelList]:
        """Query along the connection item a edges of the connection item c node.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            other_direct: The other direct to filter on.
            self_direct: The self direct to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of connection item a edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemAQueryAPI: The query API for the connection item a.
        """
        from .connection_item_a_query import ConnectionItemAQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "unidirectional"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemAQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_a_filter(
            view_id,
            name,
            name_prefix,
            other_direct,
            self_direct,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemAQueryAPI(self._client, self._builder, node_filer, limit)

    def connection_item_b(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemBQueryAPI[T_DomainModelList]:
        """Query along the connection item b edges of the connection item c node.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of connection item b edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemBQueryAPI: The query API for the connection item b.
        """
        from .connection_item_b_query import ConnectionItemBQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "unidirectional"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemBQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_b_filter(
            view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemBQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

connection_item_a(name=None, name_prefix=None, other_direct=None, self_direct=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the connection item a edges of the connection item c node.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
other_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The other direct to filter on.

None
self_direct str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The self direct to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of connection item a edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemAQueryAPI ConnectionItemAQueryAPI[T_DomainModelList]

The query API for the connection item a.

Source code in examples/omni/_api/connection_item_c_node_query.py
def connection_item_a(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    other_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    self_direct: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemAQueryAPI[T_DomainModelList]:
    """Query along the connection item a edges of the connection item c node.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        other_direct: The other direct to filter on.
        self_direct: The self direct to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of connection item a edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemAQueryAPI: The query API for the connection item a.
    """
    from .connection_item_a_query import ConnectionItemAQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "unidirectional"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemAQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_a_filter(
        view_id,
        name,
        name_prefix,
        other_direct,
        self_direct,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemAQueryAPI(self._client, self._builder, node_filer, limit)

connection_item_b(name=None, name_prefix=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the connection item b edges of the connection item c node.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of connection item b edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemBQueryAPI ConnectionItemBQueryAPI[T_DomainModelList]

The query API for the connection item b.

Source code in examples/omni/_api/connection_item_c_node_query.py
def connection_item_b(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemBQueryAPI[T_DomainModelList]:
    """Query along the connection item b edges of the connection item c node.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of connection item b edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemBQueryAPI: The query API for the connection item b.
    """
    from .connection_item_b_query import ConnectionItemBQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "unidirectional"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemBQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_b_filter(
        view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemBQueryAPI(self._client, self._builder, node_filer, limit)

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/connection_item_c_node_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

ConnectionItemDAPI

Bases: NodeAPI[ConnectionItemD, ConnectionItemDWrite, ConnectionItemDList, ConnectionItemDWriteList]

Source code in examples/omni/_api/connection_item_d.py
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
class ConnectionItemDAPI(NodeAPI[ConnectionItemD, ConnectionItemDWrite, ConnectionItemDList, ConnectionItemDWriteList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemD", "1")
    _properties_by_field = _CONNECTIONITEMD_PROPERTIES_BY_FIELD
    _class_type = ConnectionItemD
    _class_list = ConnectionItemDList
    _class_write_list = ConnectionItemDWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.outwards_single_edge = ConnectionItemDOutwardsSingleAPI(client)

    def __call__(
        self,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> ConnectionItemDQueryAPI[ConnectionItemDList]:
        """Query starting at connection item ds.

        Args:
            direct_multi: The direct multi to filter on.
            direct_single: The direct single to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for connection item ds.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_connection_item_d_filter(
            self._view_id,
            direct_multi,
            direct_single,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(ConnectionItemDList)
        return ConnectionItemDQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        connection_item_d: ConnectionItemDWrite | Sequence[ConnectionItemDWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) connection item ds.

        Note: This method iterates through all nodes and timeseries linked to connection_item_d and creates them including the edges
        between the nodes. For example, if any of `direct_multi`, `direct_single` or `outwards_single` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            connection_item_d: Connection item d or sequence of connection item ds to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new connection_item_d:

                >>> from omni import OmniClient
                >>> from omni.data_classes import ConnectionItemDWrite
                >>> client = OmniClient()
                >>> connection_item_d = ConnectionItemDWrite(external_id="my_connection_item_d", ...)
                >>> result = client.connection_item_d.apply(connection_item_d)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.connection_item_d.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(connection_item_d, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more connection item d.

        Args:
            external_id: External id of the connection item d to delete.
            space: The space where all the connection item d are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete connection_item_d by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.connection_item_d.delete("my_connection_item_d")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.connection_item_d.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemD | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemDList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemD | ConnectionItemDList | None:
        """Retrieve one or more connection item ds by id(s).

        Args:
            external_id: External id or list of external ids of the connection item ds.
            space: The space where all the connection item ds are located.

        Returns:
            The requested connection item ds.

        Examples:

            Retrieve connection_item_d by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_d = client.connection_item_d.retrieve("my_connection_item_d")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> ConnectionItemDList:
        """Search connection item ds

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            direct_multi: The direct multi to filter on.
            direct_single: The direct single to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results connection item ds matching the query.

        Examples:

           Search for 'my_connection_item_d' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_ds = client.connection_item_d.search('my_connection_item_d')

        """
        filter_ = _create_connection_item_d_filter(
            self._view_id,
            direct_multi,
            direct_single,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields],
        property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
        property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across connection item ds

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            direct_multi: The direct multi to filter on.
            direct_single: The direct single to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count connection item ds in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.connection_item_d.aggregate("count", space="my_space")

        """

        filter_ = _create_connection_item_d_filter(
            self._view_id,
            direct_multi,
            direct_single,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: ConnectionItemDFields,
        interval: float,
        query: str | None = None,
        search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for connection item ds

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            direct_multi: The direct multi to filter on.
            direct_single: The direct single to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_connection_item_d_filter(
            self._view_id,
            direct_multi,
            direct_single,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> ConnectionItemDQuery:
        """Start a query for connection item ds."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return ConnectionItemDQuery(self._client)

    def list(
        self,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemDFields | Sequence[ConnectionItemDFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> ConnectionItemDList:
        """List/filter connection item ds

        Args:
            direct_multi: The direct multi to filter on.
            direct_single: The direct single to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.
            retrieve_connections: Whether to retrieve `direct_multi`, `direct_single` and `outwards_single` for the connection item ds. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested connection item ds

        Examples:

            List connection item ds and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_ds = client.connection_item_d.list(limit=5)

        """
        filter_ = _create_connection_item_d_filter(
            self._view_id,
            direct_multi,
            direct_single,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
                sort_by=sort_by,  # type: ignore[arg-type]
                direction=direction,
                sort=sort,
            )

        builder = QueryBuilder(ConnectionItemDList)
        has_data = dm.filters.HasData(views=[self._view_id])
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                    sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
                ),
                ConnectionItemD,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_outwards_single = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_outwards_single,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_outwards_single),
                    dm.query.NodeResultSetExpression(
                        from_=edge_outwards_single,
                        filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                    ),
                    ConnectionItemE,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(from_root),
                    dm.query.NodeResultSetExpression(
                        from_=from_root,
                        filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                        direction="outwards",
                        through=self._view_id.as_property_ref("directMulti"),
                    ),
                    ConnectionItemE,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(from_root),
                    dm.query.NodeResultSetExpression(
                        from_=from_root,
                        filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                        direction="outwards",
                        through=self._view_id.as_property_ref("directSingle"),
                    ),
                    ConnectionItemE,
                )
            )

        return builder.execute(self._client)

__call__(direct_multi=None, direct_single=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at connection item ds.

Parameters:

Name Type Description Default
direct_multi str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct multi to filter on.

None
direct_single str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct single to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
ConnectionItemDQueryAPI[ConnectionItemDList]

A query API for connection item ds.

Source code in examples/omni/_api/connection_item_d.py
def __call__(
    self,
    direct_multi: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    direct_single: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> ConnectionItemDQueryAPI[ConnectionItemDList]:
    """Query starting at connection item ds.

    Args:
        direct_multi: The direct multi to filter on.
        direct_single: The direct single to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for connection item ds.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_connection_item_d_filter(
        self._view_id,
        direct_multi,
        direct_single,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(ConnectionItemDList)
    return ConnectionItemDQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, direct_multi=None, direct_single=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None, query: str | None = None, search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None, direct_multi: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, direct_single: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None, query: str | None = None, search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None, direct_multi: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, direct_single: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields], property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None, query: str | None = None, search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None, direct_multi: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, direct_single: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across connection item ds

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None

The property to group by when doing the aggregation.

None
property ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None

The text field to search in.

None
direct_multi str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct multi to filter on.

None
direct_single str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct single to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count connection item ds in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.connection_item_d.aggregate("count", space="my_space")
Source code in examples/omni/_api/connection_item_d.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
    property: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
    query: str | None = None,
    search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
    direct_multi: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    direct_single: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across connection item ds

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        direct_multi: The direct multi to filter on.
        direct_single: The direct single to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count connection item ds in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.connection_item_d.aggregate("count", space="my_space")

    """

    filter_ = _create_connection_item_d_filter(
        self._view_id,
        direct_multi,
        direct_single,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(connection_item_d, replace=False, write_none=False)

Add or update (upsert) connection item ds.

Note: This method iterates through all nodes and timeseries linked to connection_item_d and creates them including the edges between the nodes. For example, if any of direct_multi, direct_single or outwards_single are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
connection_item_d ConnectionItemDWrite | Sequence[ConnectionItemDWrite]

Connection item d or sequence of connection item ds to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new connection_item_d:

    >>> from omni import OmniClient
    >>> from omni.data_classes import ConnectionItemDWrite
    >>> client = OmniClient()
    >>> connection_item_d = ConnectionItemDWrite(external_id="my_connection_item_d", ...)
    >>> result = client.connection_item_d.apply(connection_item_d)
Source code in examples/omni/_api/connection_item_d.py
def apply(
    self,
    connection_item_d: ConnectionItemDWrite | Sequence[ConnectionItemDWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) connection item ds.

    Note: This method iterates through all nodes and timeseries linked to connection_item_d and creates them including the edges
    between the nodes. For example, if any of `direct_multi`, `direct_single` or `outwards_single` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        connection_item_d: Connection item d or sequence of connection item ds to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new connection_item_d:

            >>> from omni import OmniClient
            >>> from omni.data_classes import ConnectionItemDWrite
            >>> client = OmniClient()
            >>> connection_item_d = ConnectionItemDWrite(external_id="my_connection_item_d", ...)
            >>> result = client.connection_item_d.apply(connection_item_d)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.connection_item_d.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(connection_item_d, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more connection item d.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the connection item d to delete.

required
space str

The space where all the connection item d are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete connection_item_d by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.connection_item_d.delete("my_connection_item_d")
Source code in examples/omni/_api/connection_item_d.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more connection item d.

    Args:
        external_id: External id of the connection item d to delete.
        space: The space where all the connection item d are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete connection_item_d by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.connection_item_d.delete("my_connection_item_d")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.connection_item_d.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, direct_multi=None, direct_single=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for connection item ds

Parameters:

Name Type Description Default
property ConnectionItemDFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None

The text field to search in.

None
direct_multi str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct multi to filter on.

None
direct_single str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct single to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/connection_item_d.py
def histogram(
    self,
    property: ConnectionItemDFields,
    interval: float,
    query: str | None = None,
    search_property: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
    direct_multi: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    direct_single: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for connection item ds

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        direct_multi: The direct multi to filter on.
        direct_single: The direct single to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_connection_item_d_filter(
        self._view_id,
        direct_multi,
        direct_single,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(direct_multi=None, direct_single=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None, retrieve_connections='skip')

List/filter connection item ds

Parameters:

Name Type Description Default
direct_multi str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct multi to filter on.

None
direct_single str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct single to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemDFields | Sequence[ConnectionItemDFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve direct_multi, direct_single and outwards_single for the connection item ds. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
ConnectionItemDList

List of requested connection item ds

Examples:

List connection item ds and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_ds = client.connection_item_d.list(limit=5)
Source code in examples/omni/_api/connection_item_d.py
def list(
    self,
    direct_multi: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    direct_single: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemDFields | Sequence[ConnectionItemDFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> ConnectionItemDList:
    """List/filter connection item ds

    Args:
        direct_multi: The direct multi to filter on.
        direct_single: The direct single to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.
        retrieve_connections: Whether to retrieve `direct_multi`, `direct_single` and `outwards_single` for the connection item ds. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested connection item ds

    Examples:

        List connection item ds and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_ds = client.connection_item_d.list(limit=5)

    """
    filter_ = _create_connection_item_d_filter(
        self._view_id,
        direct_multi,
        direct_single,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    builder = QueryBuilder(ConnectionItemDList)
    has_data = dm.filters.HasData(views=[self._view_id])
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
            ),
            ConnectionItemD,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_outwards_single = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_outwards_single,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_outwards_single),
                dm.query.NodeResultSetExpression(
                    from_=edge_outwards_single,
                    filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                ),
                ConnectionItemE,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(from_root),
                dm.query.NodeResultSetExpression(
                    from_=from_root,
                    filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                    direction="outwards",
                    through=self._view_id.as_property_ref("directMulti"),
                ),
                ConnectionItemE,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(from_root),
                dm.query.NodeResultSetExpression(
                    from_=from_root,
                    filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                    direction="outwards",
                    through=self._view_id.as_property_ref("directSingle"),
                ),
                ConnectionItemE,
            )
        )

    return builder.execute(self._client)

query()

Start a query for connection item ds.

Source code in examples/omni/_api/connection_item_d.py
def query(self) -> ConnectionItemDQuery:
    """Start a query for connection item ds."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return ConnectionItemDQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemD | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemDList

Retrieve one or more connection item ds by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the connection item ds.

required
space str

The space where all the connection item ds are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
ConnectionItemD | ConnectionItemDList | None

The requested connection item ds.

Examples:

Retrieve connection_item_d by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_d = client.connection_item_d.retrieve("my_connection_item_d")
Source code in examples/omni/_api/connection_item_d.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> ConnectionItemD | ConnectionItemDList | None:
    """Retrieve one or more connection item ds by id(s).

    Args:
        external_id: External id or list of external ids of the connection item ds.
        space: The space where all the connection item ds are located.

    Returns:
        The requested connection item ds.

    Examples:

        Retrieve connection_item_d by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_d = client.connection_item_d.retrieve("my_connection_item_d")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, direct_multi=None, direct_single=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search connection item ds

Parameters:

Name Type Description Default
query str

The search query,

required
properties ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
direct_multi str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct multi to filter on.

None
direct_single str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct single to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
ConnectionItemDList

Search results connection item ds matching the query.

Examples:

Search for 'my_connection_item_d' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_ds = client.connection_item_d.search('my_connection_item_d')
Source code in examples/omni/_api/connection_item_d.py
def search(
    self,
    query: str,
    properties: ConnectionItemDTextFields | SequenceNotStr[ConnectionItemDTextFields] | None = None,
    direct_multi: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    direct_single: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemDFields | SequenceNotStr[ConnectionItemDFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> ConnectionItemDList:
    """Search connection item ds

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        direct_multi: The direct multi to filter on.
        direct_single: The direct single to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item ds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results connection item ds matching the query.

    Examples:

       Search for 'my_connection_item_d' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_ds = client.connection_item_d.search('my_connection_item_d')

    """
    filter_ = _create_connection_item_d_filter(
        self._view_id,
        direct_multi,
        direct_single,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

ConnectionItemDOutwardsSingleAPI

Bases: EdgeAPI

Source code in examples/omni/_api/connection_item_d_outwards_single.py
class ConnectionItemDOutwardsSingleAPI(EdgeAPI):
    def list(
        self,
        from_connection_item_d: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_d_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List outwards single edges of a connection item d.

        Args:
            from_connection_item_d: ID of the source connection item d.
            from_connection_item_d_space: Location of the connection item ds.
            to_connection_item_e: ID of the target connection item e.
            to_connection_item_e_space: Location of the connection item es.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of outwards single edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested outwards single edges.

        Examples:

            List 5 outwards single edges connected to "my_connection_item_d":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_d = client.connection_item_d.outwards_single_edge.list("my_connection_item_d", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
            from_connection_item_d,
            from_connection_item_d_space,
            to_connection_item_e,
            to_connection_item_e_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_d=None, from_connection_item_d_space=DEFAULT_INSTANCE_SPACE, to_connection_item_e=None, to_connection_item_e_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List outwards single edges of a connection item d.

Parameters:

Name Type Description Default
from_connection_item_d str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item d.

None
from_connection_item_d_space str

Location of the connection item ds.

DEFAULT_INSTANCE_SPACE
to_connection_item_e str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item e.

None
to_connection_item_e_space str

Location of the connection item es.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of outwards single edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested outwards single edges.

Examples:

List 5 outwards single edges connected to "my_connection_item_d":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_d = client.connection_item_d.outwards_single_edge.list("my_connection_item_d", limit=5)
Source code in examples/omni/_api/connection_item_d_outwards_single.py
def list(
    self,
    from_connection_item_d: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_d_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List outwards single edges of a connection item d.

    Args:
        from_connection_item_d: ID of the source connection item d.
        from_connection_item_d_space: Location of the connection item ds.
        to_connection_item_e: ID of the target connection item e.
        to_connection_item_e_space: Location of the connection item es.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of outwards single edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested outwards single edges.

    Examples:

        List 5 outwards single edges connected to "my_connection_item_d":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_d = client.connection_item_d.outwards_single_edge.list("my_connection_item_d", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
        from_connection_item_d,
        from_connection_item_d_space,
        to_connection_item_e,
        to_connection_item_e_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemDQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/connection_item_d_query.py
class ConnectionItemDQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemD", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=ConnectionItemD,
                max_retrieve_limit=limit,
            )
        )

    def outwards_single(
        self,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        retrieve_direct_multi: bool = False,
        retrieve_direct_single: bool = False,
    ) -> ConnectionItemEQueryAPI[T_DomainModelList]:
        """Query along the outwards single edges of the connection item d.

        Args:
            direct_no_source: The direct no source to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of outwards single edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.
            retrieve_direct_multi: Whether to retrieve the direct multi for each connection item d or not.
            retrieve_direct_single: Whether to retrieve the direct single for each connection item d or not.

        Returns:
            ConnectionItemEQueryAPI: The query API for the connection item e.
        """
        from .connection_item_e_query import ConnectionItemEQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemEQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_e_filter(
            view_id,
            direct_no_source,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        if retrieve_direct_multi:
            self._query_append_direct_multi(from_)
        if retrieve_direct_single:
            self._query_append_direct_single(from_)
        return ConnectionItemEQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
        retrieve_direct_multi: bool = False,
        retrieve_direct_single: bool = False,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Args:
            retrieve_direct_multi: Whether to retrieve the direct multi for each connection item d or not.
            retrieve_direct_single: Whether to retrieve the direct single for each connection item d or not.

        Returns:
            The list of the source nodes of the query.

        """
        from_ = self._builder[-1].name
        if retrieve_direct_multi:
            self._query_append_direct_multi(from_)
        if retrieve_direct_single:
            self._query_append_direct_single(from_)
        return self._query()

    def _query_append_direct_multi(self, from_: str) -> None:
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    through=self._view_id.as_property_ref("directMulti"),
                    direction="outwards",
                    filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                ),
                result_cls=ConnectionItemE,
            ),
        )

    def _query_append_direct_single(self, from_: str) -> None:
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    through=self._view_id.as_property_ref("directSingle"),
                    direction="outwards",
                    filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                ),
                result_cls=ConnectionItemE,
            ),
        )

outwards_single(direct_no_source=None, name=None, name_prefix=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT, retrieve_direct_multi=False, retrieve_direct_single=False)

Query along the outwards single edges of the connection item d.

Parameters:

Name Type Description Default
direct_no_source str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct no source to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of outwards single edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
retrieve_direct_multi bool

Whether to retrieve the direct multi for each connection item d or not.

False
retrieve_direct_single bool

Whether to retrieve the direct single for each connection item d or not.

False

Returns:

Name Type Description
ConnectionItemEQueryAPI ConnectionItemEQueryAPI[T_DomainModelList]

The query API for the connection item e.

Source code in examples/omni/_api/connection_item_d_query.py
def outwards_single(
    self,
    direct_no_source: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    retrieve_direct_multi: bool = False,
    retrieve_direct_single: bool = False,
) -> ConnectionItemEQueryAPI[T_DomainModelList]:
    """Query along the outwards single edges of the connection item d.

    Args:
        direct_no_source: The direct no source to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of outwards single edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.
        retrieve_direct_multi: Whether to retrieve the direct multi for each connection item d or not.
        retrieve_direct_single: Whether to retrieve the direct single for each connection item d or not.

    Returns:
        ConnectionItemEQueryAPI: The query API for the connection item e.
    """
    from .connection_item_e_query import ConnectionItemEQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemEQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_e_filter(
        view_id,
        direct_no_source,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    if retrieve_direct_multi:
        self._query_append_direct_multi(from_)
    if retrieve_direct_single:
        self._query_append_direct_single(from_)
    return ConnectionItemEQueryAPI(self._client, self._builder, node_filer, limit)

query(retrieve_direct_multi=False, retrieve_direct_single=False)

Execute query and return the result.

Parameters:

Name Type Description Default
retrieve_direct_multi bool

Whether to retrieve the direct multi for each connection item d or not.

False
retrieve_direct_single bool

Whether to retrieve the direct single for each connection item d or not.

False

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/connection_item_d_query.py
def query(
    self,
    retrieve_direct_multi: bool = False,
    retrieve_direct_single: bool = False,
) -> T_DomainModelList:
    """Execute query and return the result.

    Args:
        retrieve_direct_multi: Whether to retrieve the direct multi for each connection item d or not.
        retrieve_direct_single: Whether to retrieve the direct single for each connection item d or not.

    Returns:
        The list of the source nodes of the query.

    """
    from_ = self._builder[-1].name
    if retrieve_direct_multi:
        self._query_append_direct_multi(from_)
    if retrieve_direct_single:
        self._query_append_direct_single(from_)
    return self._query()

ConnectionItemEAPI

Bases: NodeAPI[ConnectionItemE, ConnectionItemEWrite, ConnectionItemEList, ConnectionItemEWriteList]

Source code in examples/omni/_api/connection_item_e.py
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
class ConnectionItemEAPI(NodeAPI[ConnectionItemE, ConnectionItemEWrite, ConnectionItemEList, ConnectionItemEWriteList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemE", "1")
    _properties_by_field = _CONNECTIONITEME_PROPERTIES_BY_FIELD
    _class_type = ConnectionItemE
    _class_list = ConnectionItemEList
    _class_write_list = ConnectionItemEWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.inwards_single_edge = ConnectionItemEInwardsSingleAPI(client)
        self.inwards_single_property_edge = ConnectionItemEInwardsSinglePropertyAPI(client)

    def __call__(
        self,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> ConnectionItemEQueryAPI[ConnectionItemEList]:
        """Query starting at connection item es.

        Args:
            direct_no_source: The direct no source to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for connection item es.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_connection_item_e_filter(
            self._view_id,
            direct_no_source,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(ConnectionItemEList)
        return ConnectionItemEQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        connection_item_e: ConnectionItemEWrite | Sequence[ConnectionItemEWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) connection item es.

        Note: This method iterates through all nodes and timeseries linked to connection_item_e and creates them including the edges
        between the nodes. For example, if any of `inwards_single` or `inwards_single_property` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            connection_item_e: Connection item e or sequence of connection item es to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new connection_item_e:

                >>> from omni import OmniClient
                >>> from omni.data_classes import ConnectionItemEWrite
                >>> client = OmniClient()
                >>> connection_item_e = ConnectionItemEWrite(external_id="my_connection_item_e", ...)
                >>> result = client.connection_item_e.apply(connection_item_e)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.connection_item_e.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(connection_item_e, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more connection item e.

        Args:
            external_id: External id of the connection item e to delete.
            space: The space where all the connection item e are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete connection_item_e by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.connection_item_e.delete("my_connection_item_e")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.connection_item_e.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemE | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemEList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemE | ConnectionItemEList | None:
        """Retrieve one or more connection item es by id(s).

        Args:
            external_id: External id or list of external ids of the connection item es.
            space: The space where all the connection item es are located.

        Returns:
            The requested connection item es.

        Examples:

            Retrieve connection_item_e by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_e = client.connection_item_e.retrieve("my_connection_item_e")

        """
        return self._retrieve(
            external_id,
            space,
            retrieve_edges=True,
            edge_api_name_type_direction_view_id_penta=[
                (
                    self.inwards_single_edge,
                    "inwards_single",
                    dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
                    "inwards",
                    dm.ViewId("pygen-models", "ConnectionItemD", "1"),
                ),
                (
                    self.inwards_single_property_edge,
                    "inwards_single_property",
                    dm.DirectRelationReference("pygen-models", "multiProperty"),
                    "inwards",
                    dm.ViewId("pygen-models", "ConnectionItemF", "1"),
                ),
            ],
        )

    def search(
        self,
        query: str,
        properties: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> ConnectionItemEList:
        """Search connection item es

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            direct_no_source: The direct no source to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results connection item es matching the query.

        Examples:

           Search for 'my_connection_item_e' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_es = client.connection_item_e.search('my_connection_item_e')

        """
        filter_ = _create_connection_item_e_filter(
            self._view_id,
            direct_no_source,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields],
        property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
        property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across connection item es

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            direct_no_source: The direct no source to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count connection item es in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.connection_item_e.aggregate("count", space="my_space")

        """

        filter_ = _create_connection_item_e_filter(
            self._view_id,
            direct_no_source,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: ConnectionItemEFields,
        interval: float,
        query: str | None = None,
        search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for connection item es

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            direct_no_source: The direct no source to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_connection_item_e_filter(
            self._view_id,
            direct_no_source,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> ConnectionItemEQuery:
        """Start a query for connection item es."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return ConnectionItemEQuery(self._client)

    def list(
        self,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemEFields | Sequence[ConnectionItemEFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> ConnectionItemEList:
        """List/filter connection item es

        Args:
            direct_no_source: The direct no source to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.
            retrieve_connections: Whether to retrieve `direct_reverse_multi`, `direct_reverse_single`, `inwards_single` and `inwards_single_property` for the connection item es. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested connection item es

        Examples:

            List connection item es and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_es = client.connection_item_e.list(limit=5)

        """
        filter_ = _create_connection_item_e_filter(
            self._view_id,
            direct_no_source,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
                sort_by=sort_by,  # type: ignore[arg-type]
                direction=direction,
                sort=sort,
            )

        builder = QueryBuilder(ConnectionItemEList)
        has_data = dm.filters.HasData(views=[self._view_id])
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                    sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
                ),
                ConnectionItemE,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_inwards_single = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_inwards_single,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="inwards",
                    chain_to="destination",
                ),
            )
        )
        edge_inwards_single_property = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_inwards_single_property,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="inwards",
                    chain_to="destination",
                ),
                ConnectionEdgeA,
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_inwards_single),
                    dm.query.NodeResultSetExpression(
                        from_=edge_inwards_single,
                        filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                    ),
                    ConnectionItemD,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_inwards_single_property),
                    dm.query.NodeResultSetExpression(
                        from_=edge_inwards_single_property,
                        filter=dm.filters.HasData(views=[ConnectionItemF._view_id]),
                    ),
                    ConnectionItemF,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(from_root),
                    dm.query.NodeResultSetExpression(
                        from_=from_root,
                        filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                        direction="inwards",
                        through=ConnectionItemD._view_id.as_property_ref("directMulti"),
                    ),
                    ConnectionItemD,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(from_root),
                    dm.query.NodeResultSetExpression(
                        from_=from_root,
                        filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                        direction="inwards",
                        through=ConnectionItemD._view_id.as_property_ref("directSingle"),
                    ),
                    ConnectionItemD,
                )
            )

        return builder.execute(self._client)

__call__(direct_no_source=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at connection item es.

Parameters:

Name Type Description Default
direct_no_source str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct no source to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
ConnectionItemEQueryAPI[ConnectionItemEList]

A query API for connection item es.

Source code in examples/omni/_api/connection_item_e.py
def __call__(
    self,
    direct_no_source: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> ConnectionItemEQueryAPI[ConnectionItemEList]:
    """Query starting at connection item es.

    Args:
        direct_no_source: The direct no source to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for connection item es.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_connection_item_e_filter(
        self._view_id,
        direct_no_source,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(ConnectionItemEList)
    return ConnectionItemEQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, direct_no_source=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None, query: str | None = None, search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None, direct_no_source: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None, query: str | None = None, search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None, direct_no_source: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields], property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None, query: str | None = None, search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None, direct_no_source: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across connection item es

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None

The property to group by when doing the aggregation.

None
property ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None

The text field to search in.

None
direct_no_source str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct no source to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count connection item es in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.connection_item_e.aggregate("count", space="my_space")
Source code in examples/omni/_api/connection_item_e.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
    property: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
    query: str | None = None,
    search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
    direct_no_source: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across connection item es

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        direct_no_source: The direct no source to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count connection item es in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.connection_item_e.aggregate("count", space="my_space")

    """

    filter_ = _create_connection_item_e_filter(
        self._view_id,
        direct_no_source,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(connection_item_e, replace=False, write_none=False)

Add or update (upsert) connection item es.

Note: This method iterates through all nodes and timeseries linked to connection_item_e and creates them including the edges between the nodes. For example, if any of inwards_single or inwards_single_property are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
connection_item_e ConnectionItemEWrite | Sequence[ConnectionItemEWrite]

Connection item e or sequence of connection item es to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new connection_item_e:

    >>> from omni import OmniClient
    >>> from omni.data_classes import ConnectionItemEWrite
    >>> client = OmniClient()
    >>> connection_item_e = ConnectionItemEWrite(external_id="my_connection_item_e", ...)
    >>> result = client.connection_item_e.apply(connection_item_e)
Source code in examples/omni/_api/connection_item_e.py
def apply(
    self,
    connection_item_e: ConnectionItemEWrite | Sequence[ConnectionItemEWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) connection item es.

    Note: This method iterates through all nodes and timeseries linked to connection_item_e and creates them including the edges
    between the nodes. For example, if any of `inwards_single` or `inwards_single_property` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        connection_item_e: Connection item e or sequence of connection item es to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new connection_item_e:

            >>> from omni import OmniClient
            >>> from omni.data_classes import ConnectionItemEWrite
            >>> client = OmniClient()
            >>> connection_item_e = ConnectionItemEWrite(external_id="my_connection_item_e", ...)
            >>> result = client.connection_item_e.apply(connection_item_e)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.connection_item_e.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(connection_item_e, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more connection item e.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the connection item e to delete.

required
space str

The space where all the connection item e are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete connection_item_e by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.connection_item_e.delete("my_connection_item_e")
Source code in examples/omni/_api/connection_item_e.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more connection item e.

    Args:
        external_id: External id of the connection item e to delete.
        space: The space where all the connection item e are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete connection_item_e by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.connection_item_e.delete("my_connection_item_e")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.connection_item_e.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, direct_no_source=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for connection item es

Parameters:

Name Type Description Default
property ConnectionItemEFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None

The text field to search in.

None
direct_no_source str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct no source to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/connection_item_e.py
def histogram(
    self,
    property: ConnectionItemEFields,
    interval: float,
    query: str | None = None,
    search_property: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
    direct_no_source: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for connection item es

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        direct_no_source: The direct no source to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_connection_item_e_filter(
        self._view_id,
        direct_no_source,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(direct_no_source=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None, retrieve_connections='skip')

List/filter connection item es

Parameters:

Name Type Description Default
direct_no_source str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct no source to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemEFields | Sequence[ConnectionItemEFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve direct_reverse_multi, direct_reverse_single, inwards_single and inwards_single_property for the connection item es. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
ConnectionItemEList

List of requested connection item es

Examples:

List connection item es and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_es = client.connection_item_e.list(limit=5)
Source code in examples/omni/_api/connection_item_e.py
def list(
    self,
    direct_no_source: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemEFields | Sequence[ConnectionItemEFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> ConnectionItemEList:
    """List/filter connection item es

    Args:
        direct_no_source: The direct no source to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.
        retrieve_connections: Whether to retrieve `direct_reverse_multi`, `direct_reverse_single`, `inwards_single` and `inwards_single_property` for the connection item es. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested connection item es

    Examples:

        List connection item es and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_es = client.connection_item_e.list(limit=5)

    """
    filter_ = _create_connection_item_e_filter(
        self._view_id,
        direct_no_source,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    builder = QueryBuilder(ConnectionItemEList)
    has_data = dm.filters.HasData(views=[self._view_id])
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
            ),
            ConnectionItemE,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_inwards_single = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_inwards_single,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="inwards",
                chain_to="destination",
            ),
        )
    )
    edge_inwards_single_property = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_inwards_single_property,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="inwards",
                chain_to="destination",
            ),
            ConnectionEdgeA,
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_inwards_single),
                dm.query.NodeResultSetExpression(
                    from_=edge_inwards_single,
                    filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                ),
                ConnectionItemD,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_inwards_single_property),
                dm.query.NodeResultSetExpression(
                    from_=edge_inwards_single_property,
                    filter=dm.filters.HasData(views=[ConnectionItemF._view_id]),
                ),
                ConnectionItemF,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(from_root),
                dm.query.NodeResultSetExpression(
                    from_=from_root,
                    filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                    direction="inwards",
                    through=ConnectionItemD._view_id.as_property_ref("directMulti"),
                ),
                ConnectionItemD,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(from_root),
                dm.query.NodeResultSetExpression(
                    from_=from_root,
                    filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                    direction="inwards",
                    through=ConnectionItemD._view_id.as_property_ref("directSingle"),
                ),
                ConnectionItemD,
            )
        )

    return builder.execute(self._client)

query()

Start a query for connection item es.

Source code in examples/omni/_api/connection_item_e.py
def query(self) -> ConnectionItemEQuery:
    """Start a query for connection item es."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return ConnectionItemEQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemE | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemEList

Retrieve one or more connection item es by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the connection item es.

required
space str

The space where all the connection item es are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
ConnectionItemE | ConnectionItemEList | None

The requested connection item es.

Examples:

Retrieve connection_item_e by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_e = client.connection_item_e.retrieve("my_connection_item_e")
Source code in examples/omni/_api/connection_item_e.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> ConnectionItemE | ConnectionItemEList | None:
    """Retrieve one or more connection item es by id(s).

    Args:
        external_id: External id or list of external ids of the connection item es.
        space: The space where all the connection item es are located.

    Returns:
        The requested connection item es.

    Examples:

        Retrieve connection_item_e by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_e = client.connection_item_e.retrieve("my_connection_item_e")

    """
    return self._retrieve(
        external_id,
        space,
        retrieve_edges=True,
        edge_api_name_type_direction_view_id_penta=[
            (
                self.inwards_single_edge,
                "inwards_single",
                dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
                "inwards",
                dm.ViewId("pygen-models", "ConnectionItemD", "1"),
            ),
            (
                self.inwards_single_property_edge,
                "inwards_single_property",
                dm.DirectRelationReference("pygen-models", "multiProperty"),
                "inwards",
                dm.ViewId("pygen-models", "ConnectionItemF", "1"),
            ),
        ],
    )

search(query, properties=None, direct_no_source=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search connection item es

Parameters:

Name Type Description Default
query str

The search query,

required
properties ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
direct_no_source str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct no source to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
ConnectionItemEList

Search results connection item es matching the query.

Examples:

Search for 'my_connection_item_e' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_es = client.connection_item_e.search('my_connection_item_e')
Source code in examples/omni/_api/connection_item_e.py
def search(
    self,
    query: str,
    properties: ConnectionItemETextFields | SequenceNotStr[ConnectionItemETextFields] | None = None,
    direct_no_source: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemEFields | SequenceNotStr[ConnectionItemEFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> ConnectionItemEList:
    """Search connection item es

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        direct_no_source: The direct no source to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item es to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results connection item es matching the query.

    Examples:

       Search for 'my_connection_item_e' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_es = client.connection_item_e.search('my_connection_item_e')

    """
    filter_ = _create_connection_item_e_filter(
        self._view_id,
        direct_no_source,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

ConnectionItemEInwardsSingleAPI

Bases: EdgeAPI

Source code in examples/omni/_api/connection_item_e_inwards_single.py
class ConnectionItemEInwardsSingleAPI(EdgeAPI):
    def list(
        self,
        from_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_d: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_d_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List inwards single edges of a connection item e.

        Args:
            from_connection_item_e: ID of the source connection item e.
            from_connection_item_e_space: Location of the connection item es.
            to_connection_item_d: ID of the target connection item d.
            to_connection_item_d_space: Location of the connection item ds.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of inwards single edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested inwards single edges.

        Examples:

            List 5 inwards single edges connected to "my_connection_item_e":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_e = client.connection_item_e.inwards_single_edge.list("my_connection_item_e", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
            to_connection_item_d,
            to_connection_item_d_space,
            from_connection_item_e,
            from_connection_item_e_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_e=None, from_connection_item_e_space=DEFAULT_INSTANCE_SPACE, to_connection_item_d=None, to_connection_item_d_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List inwards single edges of a connection item e.

Parameters:

Name Type Description Default
from_connection_item_e str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item e.

None
from_connection_item_e_space str

Location of the connection item es.

DEFAULT_INSTANCE_SPACE
to_connection_item_d str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item d.

None
to_connection_item_d_space str

Location of the connection item ds.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of inwards single edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested inwards single edges.

Examples:

List 5 inwards single edges connected to "my_connection_item_e":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_e = client.connection_item_e.inwards_single_edge.list("my_connection_item_e", limit=5)
Source code in examples/omni/_api/connection_item_e_inwards_single.py
def list(
    self,
    from_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_d: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_d_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List inwards single edges of a connection item e.

    Args:
        from_connection_item_e: ID of the source connection item e.
        from_connection_item_e_space: Location of the connection item es.
        to_connection_item_d: ID of the target connection item d.
        to_connection_item_d_space: Location of the connection item ds.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of inwards single edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested inwards single edges.

    Examples:

        List 5 inwards single edges connected to "my_connection_item_e":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_e = client.connection_item_e.inwards_single_edge.list("my_connection_item_e", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
        to_connection_item_d,
        to_connection_item_d_space,
        from_connection_item_e,
        from_connection_item_e_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemEInwardsSinglePropertyAPI

Bases: EdgePropertyAPI

Source code in examples/omni/_api/connection_item_e_inwards_single_property.py
class ConnectionItemEInwardsSinglePropertyAPI(EdgePropertyAPI):
    _view_id = dm.ViewId("pygen-models", "ConnectionEdgeA", "1")
    _class_type = ConnectionEdgeA
    _class_write_type = ConnectionEdgeAWrite
    _class_list = ConnectionEdgeAList

    def list(
        self,
        from_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
        min_end_time: datetime.datetime | None = None,
        max_end_time: datetime.datetime | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        min_start_time: datetime.datetime | None = None,
        max_start_time: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> ConnectionEdgeAList:
        """List inwards single property edges of a connection item e.

        Args:
            from_connection_item_e: ID of the source connection item e.
            from_connection_item_e_space: Location of the connection item es.
            to_connection_item_f: ID of the target connection item f.
            to_connection_item_f_space: Location of the connection item fs.
            min_end_time: The minimum value of the end time to filter on.
            max_end_time: The maximum value of the end time to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            min_start_time: The minimum value of the start time to filter on.
            max_start_time: The maximum value of the start time to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of inwards single property edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested inwards single property edges.

        Examples:

            List 5 inwards single property edges connected to "my_connection_item_e":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_e = client.connection_item_e.inwards_single_property_edge.list("my_connection_item_e", limit=5)

        """
        filter_ = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "multiProperty"),
            self._view_id,
            to_connection_item_f,
            to_connection_item_f_space,
            from_connection_item_e,
            from_connection_item_e_space,
            min_end_time,
            max_end_time,
            name,
            name_prefix,
            min_start_time,
            max_start_time,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_e=None, from_connection_item_e_space=DEFAULT_INSTANCE_SPACE, to_connection_item_f=None, to_connection_item_f_space=DEFAULT_INSTANCE_SPACE, min_end_time=None, max_end_time=None, name=None, name_prefix=None, min_start_time=None, max_start_time=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List inwards single property edges of a connection item e.

Parameters:

Name Type Description Default
from_connection_item_e str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item e.

None
from_connection_item_e_space str

Location of the connection item es.

DEFAULT_INSTANCE_SPACE
to_connection_item_f str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item f.

None
to_connection_item_f_space str

Location of the connection item fs.

DEFAULT_INSTANCE_SPACE
min_end_time datetime | None

The minimum value of the end time to filter on.

None
max_end_time datetime | None

The maximum value of the end time to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
min_start_time datetime | None

The minimum value of the start time to filter on.

None
max_start_time datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of inwards single property edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
ConnectionEdgeAList

The requested inwards single property edges.

Examples:

List 5 inwards single property edges connected to "my_connection_item_e":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_e = client.connection_item_e.inwards_single_property_edge.list("my_connection_item_e", limit=5)
Source code in examples/omni/_api/connection_item_e_inwards_single_property.py
def list(
    self,
    from_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
    min_end_time: datetime.datetime | None = None,
    max_end_time: datetime.datetime | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    min_start_time: datetime.datetime | None = None,
    max_start_time: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> ConnectionEdgeAList:
    """List inwards single property edges of a connection item e.

    Args:
        from_connection_item_e: ID of the source connection item e.
        from_connection_item_e_space: Location of the connection item es.
        to_connection_item_f: ID of the target connection item f.
        to_connection_item_f_space: Location of the connection item fs.
        min_end_time: The minimum value of the end time to filter on.
        max_end_time: The maximum value of the end time to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        min_start_time: The minimum value of the start time to filter on.
        max_start_time: The maximum value of the start time to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of inwards single property edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested inwards single property edges.

    Examples:

        List 5 inwards single property edges connected to "my_connection_item_e":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_e = client.connection_item_e.inwards_single_property_edge.list("my_connection_item_e", limit=5)

    """
    filter_ = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "multiProperty"),
        self._view_id,
        to_connection_item_f,
        to_connection_item_f_space,
        from_connection_item_e,
        from_connection_item_e_space,
        min_end_time,
        max_end_time,
        name,
        name_prefix,
        min_start_time,
        max_start_time,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemEQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/connection_item_e_query.py
class ConnectionItemEQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemE", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=ConnectionItemE,
                max_retrieve_limit=limit,
            )
        )

    def inwards_single(
        self,
        direct_multi: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        direct_single: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemDQueryAPI[T_DomainModelList]:
        """Query along the inwards single edges of the connection item e.

        Args:
            direct_multi: The direct multi to filter on.
            direct_single: The direct single to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of inwards single edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemDQueryAPI: The query API for the connection item d.
        """
        from .connection_item_d_query import ConnectionItemDQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="inwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemDQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_d_filter(
            view_id,
            direct_multi,
            direct_single,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemDQueryAPI(self._client, self._builder, node_filer, limit)

    def inwards_single_property(
        self,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        min_end_time_edge: datetime.datetime | None = None,
        max_end_time_edge: datetime.datetime | None = None,
        name_edge: str | list[str] | None = None,
        name_prefix_edge: str | None = None,
        min_start_time_edge: datetime.datetime | None = None,
        max_start_time_edge: datetime.datetime | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemFQueryAPI[T_DomainModelList]:
        """Query along the inwards single property edges of the connection item e.

        Args:
            direct_list: The direct list to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            min_end_time_edge: The minimum value of the end time to filter on.
            max_end_time_edge: The maximum value of the end time to filter on.
            name_edge: The name to filter on.
            name_prefix_edge: The prefix of the name to filter on.
            min_start_time_edge: The minimum value of the start time to filter on.
            max_start_time_edge: The maximum value of the start time to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of inwards single property edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemFQueryAPI: The query API for the connection item f.
        """
        from .connection_item_f_query import ConnectionItemFQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_view = ConnectionEdgeA._view_id
        edge_filter = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "multiProperty"),
            edge_view,
            min_end_time=min_end_time_edge,
            max_end_time=max_end_time_edge,
            name=name_edge,
            name_prefix=name_prefix_edge,
            min_start_time=min_start_time_edge,
            max_start_time=max_start_time_edge,
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="inwards",
                ),
                result_cls=ConnectionEdgeA,
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemFQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_f_filter(
            view_id,
            direct_list,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemFQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

inwards_single(direct_multi=None, direct_single=None, name=None, name_prefix=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the inwards single edges of the connection item e.

Parameters:

Name Type Description Default
direct_multi str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct multi to filter on.

None
direct_single str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct single to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of inwards single edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemDQueryAPI ConnectionItemDQueryAPI[T_DomainModelList]

The query API for the connection item d.

Source code in examples/omni/_api/connection_item_e_query.py
def inwards_single(
    self,
    direct_multi: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    direct_single: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemDQueryAPI[T_DomainModelList]:
    """Query along the inwards single edges of the connection item e.

    Args:
        direct_multi: The direct multi to filter on.
        direct_single: The direct single to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of inwards single edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemDQueryAPI: The query API for the connection item d.
    """
    from .connection_item_d_query import ConnectionItemDQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "bidirectionalSingle"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="inwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemDQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_d_filter(
        view_id,
        direct_multi,
        direct_single,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemDQueryAPI(self._client, self._builder, node_filer, limit)

inwards_single_property(direct_list=None, name=None, name_prefix=None, external_id_prefix=None, space=None, min_end_time_edge=None, max_end_time_edge=None, name_edge=None, name_prefix_edge=None, min_start_time_edge=None, max_start_time_edge=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the inwards single property edges of the connection item e.

Parameters:

Name Type Description Default
direct_list str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct list to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
min_end_time_edge datetime | None

The minimum value of the end time to filter on.

None
max_end_time_edge datetime | None

The maximum value of the end time to filter on.

None
name_edge str | list[str] | None

The name to filter on.

None
name_prefix_edge str | None

The prefix of the name to filter on.

None
min_start_time_edge datetime | None

The minimum value of the start time to filter on.

None
max_start_time_edge datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of inwards single property edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemFQueryAPI ConnectionItemFQueryAPI[T_DomainModelList]

The query API for the connection item f.

Source code in examples/omni/_api/connection_item_e_query.py
def inwards_single_property(
    self,
    direct_list: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    min_end_time_edge: datetime.datetime | None = None,
    max_end_time_edge: datetime.datetime | None = None,
    name_edge: str | list[str] | None = None,
    name_prefix_edge: str | None = None,
    min_start_time_edge: datetime.datetime | None = None,
    max_start_time_edge: datetime.datetime | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemFQueryAPI[T_DomainModelList]:
    """Query along the inwards single property edges of the connection item e.

    Args:
        direct_list: The direct list to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        min_end_time_edge: The minimum value of the end time to filter on.
        max_end_time_edge: The maximum value of the end time to filter on.
        name_edge: The name to filter on.
        name_prefix_edge: The prefix of the name to filter on.
        min_start_time_edge: The minimum value of the start time to filter on.
        max_start_time_edge: The maximum value of the start time to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of inwards single property edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemFQueryAPI: The query API for the connection item f.
    """
    from .connection_item_f_query import ConnectionItemFQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_view = ConnectionEdgeA._view_id
    edge_filter = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "multiProperty"),
        edge_view,
        min_end_time=min_end_time_edge,
        max_end_time=max_end_time_edge,
        name=name_edge,
        name_prefix=name_prefix_edge,
        min_start_time=min_start_time_edge,
        max_start_time=max_start_time_edge,
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="inwards",
            ),
            result_cls=ConnectionEdgeA,
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemFQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_f_filter(
        view_id,
        direct_list,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemFQueryAPI(self._client, self._builder, node_filer, limit)

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/connection_item_e_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

ConnectionItemFAPI

Bases: NodeAPI[ConnectionItemF, ConnectionItemFWrite, ConnectionItemFList, ConnectionItemFWriteList]

Source code in examples/omni/_api/connection_item_f.py
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
class ConnectionItemFAPI(NodeAPI[ConnectionItemF, ConnectionItemFWrite, ConnectionItemFList, ConnectionItemFWriteList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemF", "1")
    _properties_by_field = _CONNECTIONITEMF_PROPERTIES_BY_FIELD
    _class_type = ConnectionItemF
    _class_list = ConnectionItemFList
    _class_write_list = ConnectionItemFWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.outwards_multi_edge = ConnectionItemFOutwardsMultiAPI(client)
        self.outwards_single_edge = ConnectionItemFOutwardsSingleAPI(client)

    def __call__(
        self,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> ConnectionItemFQueryAPI[ConnectionItemFList]:
        """Query starting at connection item fs.

        Args:
            direct_list: The direct list to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for connection item fs.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_connection_item_f_filter(
            self._view_id,
            direct_list,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(ConnectionItemFList)
        return ConnectionItemFQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        connection_item_f: ConnectionItemFWrite | Sequence[ConnectionItemFWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) connection item fs.

        Note: This method iterates through all nodes and timeseries linked to connection_item_f and creates them including the edges
        between the nodes. For example, if any of `direct_list`, `outwards_multi` or `outwards_single` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            connection_item_f: Connection item f or sequence of connection item fs to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new connection_item_f:

                >>> from omni import OmniClient
                >>> from omni.data_classes import ConnectionItemFWrite
                >>> client = OmniClient()
                >>> connection_item_f = ConnectionItemFWrite(external_id="my_connection_item_f", ...)
                >>> result = client.connection_item_f.apply(connection_item_f)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.connection_item_f.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(connection_item_f, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more connection item f.

        Args:
            external_id: External id of the connection item f to delete.
            space: The space where all the connection item f are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete connection_item_f by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.connection_item_f.delete("my_connection_item_f")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.connection_item_f.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemF | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemFList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemF | ConnectionItemFList | None:
        """Retrieve one or more connection item fs by id(s).

        Args:
            external_id: External id or list of external ids of the connection item fs.
            space: The space where all the connection item fs are located.

        Returns:
            The requested connection item fs.

        Examples:

            Retrieve connection_item_f by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_f = client.connection_item_f.retrieve("my_connection_item_f")

        """
        return self._retrieve(
            external_id,
            space,
            retrieve_edges=True,
            edge_api_name_type_direction_view_id_penta=[
                (
                    self.outwards_multi_edge,
                    "outwards_multi",
                    dm.DirectRelationReference("pygen-models", "multiProperty"),
                    "outwards",
                    dm.ViewId("pygen-models", "ConnectionItemG", "1"),
                ),
                (
                    self.outwards_single_edge,
                    "outwards_single",
                    dm.DirectRelationReference("pygen-models", "singleProperty"),
                    "outwards",
                    dm.ViewId("pygen-models", "ConnectionItemE", "1"),
                ),
            ],
        )

    def search(
        self,
        query: str,
        properties: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> ConnectionItemFList:
        """Search connection item fs

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            direct_list: The direct list to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results connection item fs matching the query.

        Examples:

           Search for 'my_connection_item_f' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_fs = client.connection_item_f.search('my_connection_item_f')

        """
        filter_ = _create_connection_item_f_filter(
            self._view_id,
            direct_list,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields],
        property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
        property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across connection item fs

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            direct_list: The direct list to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count connection item fs in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.connection_item_f.aggregate("count", space="my_space")

        """

        filter_ = _create_connection_item_f_filter(
            self._view_id,
            direct_list,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: ConnectionItemFFields,
        interval: float,
        query: str | None = None,
        search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for connection item fs

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            direct_list: The direct list to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_connection_item_f_filter(
            self._view_id,
            direct_list,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> ConnectionItemFQuery:
        """Start a query for connection item fs."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return ConnectionItemFQuery(self._client)

    def list(
        self,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemFFields | Sequence[ConnectionItemFFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> ConnectionItemFList:
        """List/filter connection item fs

        Args:
            direct_list: The direct list to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.
            retrieve_connections: Whether to retrieve `direct_list`, `outwards_multi` and `outwards_single` for the connection item fs. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested connection item fs

        Examples:

            List connection item fs and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_fs = client.connection_item_f.list(limit=5)

        """
        filter_ = _create_connection_item_f_filter(
            self._view_id,
            direct_list,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
                sort_by=sort_by,  # type: ignore[arg-type]
                direction=direction,
                sort=sort,
            )

        builder = QueryBuilder(ConnectionItemFList)
        has_data = dm.filters.HasData(views=[self._view_id])
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                    sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
                ),
                ConnectionItemF,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_outwards_multi = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_outwards_multi,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
                ConnectionEdgeA,
            )
        )
        edge_outwards_single = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_outwards_single,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
                ConnectionEdgeA,
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_outwards_multi),
                    dm.query.NodeResultSetExpression(
                        from_=edge_outwards_multi,
                        filter=dm.filters.HasData(views=[ConnectionItemG._view_id]),
                    ),
                    ConnectionItemG,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_outwards_single),
                    dm.query.NodeResultSetExpression(
                        from_=edge_outwards_single,
                        filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                    ),
                    ConnectionItemE,
                )
            )
            builder.append(
                NodeQueryStep(
                    builder.create_name(from_root),
                    dm.query.NodeResultSetExpression(
                        from_=from_root,
                        filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                        direction="outwards",
                        through=self._view_id.as_property_ref("directList"),
                    ),
                    ConnectionItemD,
                )
            )

        return builder.execute(self._client)

__call__(direct_list=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at connection item fs.

Parameters:

Name Type Description Default
direct_list str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct list to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
ConnectionItemFQueryAPI[ConnectionItemFList]

A query API for connection item fs.

Source code in examples/omni/_api/connection_item_f.py
def __call__(
    self,
    direct_list: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> ConnectionItemFQueryAPI[ConnectionItemFList]:
    """Query starting at connection item fs.

    Args:
        direct_list: The direct list to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for connection item fs.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_connection_item_f_filter(
        self._view_id,
        direct_list,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(ConnectionItemFList)
    return ConnectionItemFQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, direct_list=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None, query: str | None = None, search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None, direct_list: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None, query: str | None = None, search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None, direct_list: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields], property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None, query: str | None = None, search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None, direct_list: str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across connection item fs

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None

The property to group by when doing the aggregation.

None
property ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None

The text field to search in.

None
direct_list str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct list to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count connection item fs in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.connection_item_f.aggregate("count", space="my_space")
Source code in examples/omni/_api/connection_item_f.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
    property: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
    query: str | None = None,
    search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
    direct_list: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across connection item fs

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        direct_list: The direct list to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count connection item fs in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.connection_item_f.aggregate("count", space="my_space")

    """

    filter_ = _create_connection_item_f_filter(
        self._view_id,
        direct_list,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(connection_item_f, replace=False, write_none=False)

Add or update (upsert) connection item fs.

Note: This method iterates through all nodes and timeseries linked to connection_item_f and creates them including the edges between the nodes. For example, if any of direct_list, outwards_multi or outwards_single are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
connection_item_f ConnectionItemFWrite | Sequence[ConnectionItemFWrite]

Connection item f or sequence of connection item fs to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new connection_item_f:

    >>> from omni import OmniClient
    >>> from omni.data_classes import ConnectionItemFWrite
    >>> client = OmniClient()
    >>> connection_item_f = ConnectionItemFWrite(external_id="my_connection_item_f", ...)
    >>> result = client.connection_item_f.apply(connection_item_f)
Source code in examples/omni/_api/connection_item_f.py
def apply(
    self,
    connection_item_f: ConnectionItemFWrite | Sequence[ConnectionItemFWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) connection item fs.

    Note: This method iterates through all nodes and timeseries linked to connection_item_f and creates them including the edges
    between the nodes. For example, if any of `direct_list`, `outwards_multi` or `outwards_single` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        connection_item_f: Connection item f or sequence of connection item fs to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new connection_item_f:

            >>> from omni import OmniClient
            >>> from omni.data_classes import ConnectionItemFWrite
            >>> client = OmniClient()
            >>> connection_item_f = ConnectionItemFWrite(external_id="my_connection_item_f", ...)
            >>> result = client.connection_item_f.apply(connection_item_f)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.connection_item_f.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(connection_item_f, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more connection item f.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the connection item f to delete.

required
space str

The space where all the connection item f are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete connection_item_f by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.connection_item_f.delete("my_connection_item_f")
Source code in examples/omni/_api/connection_item_f.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more connection item f.

    Args:
        external_id: External id of the connection item f to delete.
        space: The space where all the connection item f are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete connection_item_f by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.connection_item_f.delete("my_connection_item_f")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.connection_item_f.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, direct_list=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for connection item fs

Parameters:

Name Type Description Default
property ConnectionItemFFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None

The text field to search in.

None
direct_list str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct list to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/connection_item_f.py
def histogram(
    self,
    property: ConnectionItemFFields,
    interval: float,
    query: str | None = None,
    search_property: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
    direct_list: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for connection item fs

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        direct_list: The direct list to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_connection_item_f_filter(
        self._view_id,
        direct_list,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(direct_list=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None, retrieve_connections='skip')

List/filter connection item fs

Parameters:

Name Type Description Default
direct_list str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct list to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemFFields | Sequence[ConnectionItemFFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve direct_list, outwards_multi and outwards_single for the connection item fs. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
ConnectionItemFList

List of requested connection item fs

Examples:

List connection item fs and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_fs = client.connection_item_f.list(limit=5)
Source code in examples/omni/_api/connection_item_f.py
def list(
    self,
    direct_list: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemFFields | Sequence[ConnectionItemFFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> ConnectionItemFList:
    """List/filter connection item fs

    Args:
        direct_list: The direct list to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.
        retrieve_connections: Whether to retrieve `direct_list`, `outwards_multi` and `outwards_single` for the connection item fs. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested connection item fs

    Examples:

        List connection item fs and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_fs = client.connection_item_f.list(limit=5)

    """
    filter_ = _create_connection_item_f_filter(
        self._view_id,
        direct_list,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    builder = QueryBuilder(ConnectionItemFList)
    has_data = dm.filters.HasData(views=[self._view_id])
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
            ),
            ConnectionItemF,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_outwards_multi = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_outwards_multi,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
            ConnectionEdgeA,
        )
    )
    edge_outwards_single = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_outwards_single,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
            ConnectionEdgeA,
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_outwards_multi),
                dm.query.NodeResultSetExpression(
                    from_=edge_outwards_multi,
                    filter=dm.filters.HasData(views=[ConnectionItemG._view_id]),
                ),
                ConnectionItemG,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_outwards_single),
                dm.query.NodeResultSetExpression(
                    from_=edge_outwards_single,
                    filter=dm.filters.HasData(views=[ConnectionItemE._view_id]),
                ),
                ConnectionItemE,
            )
        )
        builder.append(
            NodeQueryStep(
                builder.create_name(from_root),
                dm.query.NodeResultSetExpression(
                    from_=from_root,
                    filter=dm.filters.HasData(views=[ConnectionItemD._view_id]),
                    direction="outwards",
                    through=self._view_id.as_property_ref("directList"),
                ),
                ConnectionItemD,
            )
        )

    return builder.execute(self._client)

query()

Start a query for connection item fs.

Source code in examples/omni/_api/connection_item_f.py
def query(self) -> ConnectionItemFQuery:
    """Start a query for connection item fs."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return ConnectionItemFQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemF | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemFList

Retrieve one or more connection item fs by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the connection item fs.

required
space str

The space where all the connection item fs are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
ConnectionItemF | ConnectionItemFList | None

The requested connection item fs.

Examples:

Retrieve connection_item_f by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_f = client.connection_item_f.retrieve("my_connection_item_f")
Source code in examples/omni/_api/connection_item_f.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> ConnectionItemF | ConnectionItemFList | None:
    """Retrieve one or more connection item fs by id(s).

    Args:
        external_id: External id or list of external ids of the connection item fs.
        space: The space where all the connection item fs are located.

    Returns:
        The requested connection item fs.

    Examples:

        Retrieve connection_item_f by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_f = client.connection_item_f.retrieve("my_connection_item_f")

    """
    return self._retrieve(
        external_id,
        space,
        retrieve_edges=True,
        edge_api_name_type_direction_view_id_penta=[
            (
                self.outwards_multi_edge,
                "outwards_multi",
                dm.DirectRelationReference("pygen-models", "multiProperty"),
                "outwards",
                dm.ViewId("pygen-models", "ConnectionItemG", "1"),
            ),
            (
                self.outwards_single_edge,
                "outwards_single",
                dm.DirectRelationReference("pygen-models", "singleProperty"),
                "outwards",
                dm.ViewId("pygen-models", "ConnectionItemE", "1"),
            ),
        ],
    )

search(query, properties=None, direct_list=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search connection item fs

Parameters:

Name Type Description Default
query str

The search query,

required
properties ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
direct_list str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct list to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
ConnectionItemFList

Search results connection item fs matching the query.

Examples:

Search for 'my_connection_item_f' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_fs = client.connection_item_f.search('my_connection_item_f')
Source code in examples/omni/_api/connection_item_f.py
def search(
    self,
    query: str,
    properties: ConnectionItemFTextFields | SequenceNotStr[ConnectionItemFTextFields] | None = None,
    direct_list: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemFFields | SequenceNotStr[ConnectionItemFFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> ConnectionItemFList:
    """Search connection item fs

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        direct_list: The direct list to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item fs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results connection item fs matching the query.

    Examples:

       Search for 'my_connection_item_f' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_fs = client.connection_item_f.search('my_connection_item_f')

    """
    filter_ = _create_connection_item_f_filter(
        self._view_id,
        direct_list,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

ConnectionItemFOutwardsMultiAPI

Bases: EdgePropertyAPI

Source code in examples/omni/_api/connection_item_f_outwards_multi.py
class ConnectionItemFOutwardsMultiAPI(EdgePropertyAPI):
    _view_id = dm.ViewId("pygen-models", "ConnectionEdgeA", "1")
    _class_type = ConnectionEdgeA
    _class_write_type = ConnectionEdgeAWrite
    _class_list = ConnectionEdgeAList

    def list(
        self,
        from_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_g: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_g_space: str = DEFAULT_INSTANCE_SPACE,
        min_end_time: datetime.datetime | None = None,
        max_end_time: datetime.datetime | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        min_start_time: datetime.datetime | None = None,
        max_start_time: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> ConnectionEdgeAList:
        """List outwards multi edges of a connection item f.

        Args:
            from_connection_item_f: ID of the source connection item f.
            from_connection_item_f_space: Location of the connection item fs.
            to_connection_item_g: ID of the target connection item g.
            to_connection_item_g_space: Location of the connection item gs.
            min_end_time: The minimum value of the end time to filter on.
            max_end_time: The maximum value of the end time to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            min_start_time: The minimum value of the start time to filter on.
            max_start_time: The maximum value of the start time to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of outwards multi edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested outwards multi edges.

        Examples:

            List 5 outwards multi edges connected to "my_connection_item_f":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_f = client.connection_item_f.outwards_multi_edge.list("my_connection_item_f", limit=5)

        """
        filter_ = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "multiProperty"),
            self._view_id,
            from_connection_item_f,
            from_connection_item_f_space,
            to_connection_item_g,
            to_connection_item_g_space,
            min_end_time,
            max_end_time,
            name,
            name_prefix,
            min_start_time,
            max_start_time,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_f=None, from_connection_item_f_space=DEFAULT_INSTANCE_SPACE, to_connection_item_g=None, to_connection_item_g_space=DEFAULT_INSTANCE_SPACE, min_end_time=None, max_end_time=None, name=None, name_prefix=None, min_start_time=None, max_start_time=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List outwards multi edges of a connection item f.

Parameters:

Name Type Description Default
from_connection_item_f str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item f.

None
from_connection_item_f_space str

Location of the connection item fs.

DEFAULT_INSTANCE_SPACE
to_connection_item_g str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item g.

None
to_connection_item_g_space str

Location of the connection item gs.

DEFAULT_INSTANCE_SPACE
min_end_time datetime | None

The minimum value of the end time to filter on.

None
max_end_time datetime | None

The maximum value of the end time to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
min_start_time datetime | None

The minimum value of the start time to filter on.

None
max_start_time datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of outwards multi edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
ConnectionEdgeAList

The requested outwards multi edges.

Examples:

List 5 outwards multi edges connected to "my_connection_item_f":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_f = client.connection_item_f.outwards_multi_edge.list("my_connection_item_f", limit=5)
Source code in examples/omni/_api/connection_item_f_outwards_multi.py
def list(
    self,
    from_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_g: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_g_space: str = DEFAULT_INSTANCE_SPACE,
    min_end_time: datetime.datetime | None = None,
    max_end_time: datetime.datetime | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    min_start_time: datetime.datetime | None = None,
    max_start_time: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> ConnectionEdgeAList:
    """List outwards multi edges of a connection item f.

    Args:
        from_connection_item_f: ID of the source connection item f.
        from_connection_item_f_space: Location of the connection item fs.
        to_connection_item_g: ID of the target connection item g.
        to_connection_item_g_space: Location of the connection item gs.
        min_end_time: The minimum value of the end time to filter on.
        max_end_time: The maximum value of the end time to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        min_start_time: The minimum value of the start time to filter on.
        max_start_time: The maximum value of the start time to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of outwards multi edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested outwards multi edges.

    Examples:

        List 5 outwards multi edges connected to "my_connection_item_f":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_f = client.connection_item_f.outwards_multi_edge.list("my_connection_item_f", limit=5)

    """
    filter_ = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "multiProperty"),
        self._view_id,
        from_connection_item_f,
        from_connection_item_f_space,
        to_connection_item_g,
        to_connection_item_g_space,
        min_end_time,
        max_end_time,
        name,
        name_prefix,
        min_start_time,
        max_start_time,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemFOutwardsSingleAPI

Bases: EdgePropertyAPI

Source code in examples/omni/_api/connection_item_f_outwards_single.py
class ConnectionItemFOutwardsSingleAPI(EdgePropertyAPI):
    _view_id = dm.ViewId("pygen-models", "ConnectionEdgeA", "1")
    _class_type = ConnectionEdgeA
    _class_write_type = ConnectionEdgeAWrite
    _class_list = ConnectionEdgeAList

    def list(
        self,
        from_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
        min_end_time: datetime.datetime | None = None,
        max_end_time: datetime.datetime | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        min_start_time: datetime.datetime | None = None,
        max_start_time: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> ConnectionEdgeAList:
        """List outwards single edges of a connection item f.

        Args:
            from_connection_item_f: ID of the source connection item f.
            from_connection_item_f_space: Location of the connection item fs.
            to_connection_item_e: ID of the target connection item e.
            to_connection_item_e_space: Location of the connection item es.
            min_end_time: The minimum value of the end time to filter on.
            max_end_time: The maximum value of the end time to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            min_start_time: The minimum value of the start time to filter on.
            max_start_time: The maximum value of the start time to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of outwards single edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested outwards single edges.

        Examples:

            List 5 outwards single edges connected to "my_connection_item_f":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_f = client.connection_item_f.outwards_single_edge.list("my_connection_item_f", limit=5)

        """
        filter_ = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "singleProperty"),
            self._view_id,
            from_connection_item_f,
            from_connection_item_f_space,
            to_connection_item_e,
            to_connection_item_e_space,
            min_end_time,
            max_end_time,
            name,
            name_prefix,
            min_start_time,
            max_start_time,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_f=None, from_connection_item_f_space=DEFAULT_INSTANCE_SPACE, to_connection_item_e=None, to_connection_item_e_space=DEFAULT_INSTANCE_SPACE, min_end_time=None, max_end_time=None, name=None, name_prefix=None, min_start_time=None, max_start_time=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List outwards single edges of a connection item f.

Parameters:

Name Type Description Default
from_connection_item_f str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item f.

None
from_connection_item_f_space str

Location of the connection item fs.

DEFAULT_INSTANCE_SPACE
to_connection_item_e str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item e.

None
to_connection_item_e_space str

Location of the connection item es.

DEFAULT_INSTANCE_SPACE
min_end_time datetime | None

The minimum value of the end time to filter on.

None
max_end_time datetime | None

The maximum value of the end time to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
min_start_time datetime | None

The minimum value of the start time to filter on.

None
max_start_time datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of outwards single edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
ConnectionEdgeAList

The requested outwards single edges.

Examples:

List 5 outwards single edges connected to "my_connection_item_f":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_f = client.connection_item_f.outwards_single_edge.list("my_connection_item_f", limit=5)
Source code in examples/omni/_api/connection_item_f_outwards_single.py
def list(
    self,
    from_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_e: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_e_space: str = DEFAULT_INSTANCE_SPACE,
    min_end_time: datetime.datetime | None = None,
    max_end_time: datetime.datetime | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    min_start_time: datetime.datetime | None = None,
    max_start_time: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> ConnectionEdgeAList:
    """List outwards single edges of a connection item f.

    Args:
        from_connection_item_f: ID of the source connection item f.
        from_connection_item_f_space: Location of the connection item fs.
        to_connection_item_e: ID of the target connection item e.
        to_connection_item_e_space: Location of the connection item es.
        min_end_time: The minimum value of the end time to filter on.
        max_end_time: The maximum value of the end time to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        min_start_time: The minimum value of the start time to filter on.
        max_start_time: The maximum value of the start time to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of outwards single edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested outwards single edges.

    Examples:

        List 5 outwards single edges connected to "my_connection_item_f":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_f = client.connection_item_f.outwards_single_edge.list("my_connection_item_f", limit=5)

    """
    filter_ = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "singleProperty"),
        self._view_id,
        from_connection_item_f,
        from_connection_item_f_space,
        to_connection_item_e,
        to_connection_item_e_space,
        min_end_time,
        max_end_time,
        name,
        name_prefix,
        min_start_time,
        max_start_time,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemFQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/connection_item_f_query.py
class ConnectionItemFQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemF", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=ConnectionItemF,
                max_retrieve_limit=limit,
            )
        )

    def outwards_multi(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        min_end_time_edge: datetime.datetime | None = None,
        max_end_time_edge: datetime.datetime | None = None,
        name_edge: str | list[str] | None = None,
        name_prefix_edge: str | None = None,
        min_start_time_edge: datetime.datetime | None = None,
        max_start_time_edge: datetime.datetime | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemGQueryAPI[T_DomainModelList]:
        """Query along the outwards multi edges of the connection item f.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            min_end_time_edge: The minimum value of the end time to filter on.
            max_end_time_edge: The maximum value of the end time to filter on.
            name_edge: The name to filter on.
            name_prefix_edge: The prefix of the name to filter on.
            min_start_time_edge: The minimum value of the start time to filter on.
            max_start_time_edge: The maximum value of the start time to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of outwards multi edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemGQueryAPI: The query API for the connection item g.
        """
        from .connection_item_g_query import ConnectionItemGQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_view = ConnectionEdgeA._view_id
        edge_filter = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "multiProperty"),
            edge_view,
            min_end_time=min_end_time_edge,
            max_end_time=max_end_time_edge,
            name=name_edge,
            name_prefix=name_prefix_edge,
            min_start_time=min_start_time_edge,
            max_start_time=max_start_time_edge,
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                result_cls=ConnectionEdgeA,
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemGQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_g_filter(
            view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemGQueryAPI(self._client, self._builder, node_filer, limit)

    def outwards_single(
        self,
        direct_no_source: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        min_end_time_edge: datetime.datetime | None = None,
        max_end_time_edge: datetime.datetime | None = None,
        name_edge: str | list[str] | None = None,
        name_prefix_edge: str | None = None,
        min_start_time_edge: datetime.datetime | None = None,
        max_start_time_edge: datetime.datetime | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemEQueryAPI[T_DomainModelList]:
        """Query along the outwards single edges of the connection item f.

        Args:
            direct_no_source: The direct no source to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            min_end_time_edge: The minimum value of the end time to filter on.
            max_end_time_edge: The maximum value of the end time to filter on.
            name_edge: The name to filter on.
            name_prefix_edge: The prefix of the name to filter on.
            min_start_time_edge: The minimum value of the start time to filter on.
            max_start_time_edge: The maximum value of the start time to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of outwards single edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemEQueryAPI: The query API for the connection item e.
        """
        from .connection_item_e_query import ConnectionItemEQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_view = ConnectionEdgeA._view_id
        edge_filter = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "singleProperty"),
            edge_view,
            min_end_time=min_end_time_edge,
            max_end_time=max_end_time_edge,
            name=name_edge,
            name_prefix=name_prefix_edge,
            min_start_time=min_start_time_edge,
            max_start_time=max_start_time_edge,
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                result_cls=ConnectionEdgeA,
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemEQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_e_filter(
            view_id,
            direct_no_source,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemEQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

outwards_multi(name=None, name_prefix=None, external_id_prefix=None, space=None, min_end_time_edge=None, max_end_time_edge=None, name_edge=None, name_prefix_edge=None, min_start_time_edge=None, max_start_time_edge=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the outwards multi edges of the connection item f.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
min_end_time_edge datetime | None

The minimum value of the end time to filter on.

None
max_end_time_edge datetime | None

The maximum value of the end time to filter on.

None
name_edge str | list[str] | None

The name to filter on.

None
name_prefix_edge str | None

The prefix of the name to filter on.

None
min_start_time_edge datetime | None

The minimum value of the start time to filter on.

None
max_start_time_edge datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of outwards multi edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemGQueryAPI ConnectionItemGQueryAPI[T_DomainModelList]

The query API for the connection item g.

Source code in examples/omni/_api/connection_item_f_query.py
def outwards_multi(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    min_end_time_edge: datetime.datetime | None = None,
    max_end_time_edge: datetime.datetime | None = None,
    name_edge: str | list[str] | None = None,
    name_prefix_edge: str | None = None,
    min_start_time_edge: datetime.datetime | None = None,
    max_start_time_edge: datetime.datetime | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemGQueryAPI[T_DomainModelList]:
    """Query along the outwards multi edges of the connection item f.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        min_end_time_edge: The minimum value of the end time to filter on.
        max_end_time_edge: The maximum value of the end time to filter on.
        name_edge: The name to filter on.
        name_prefix_edge: The prefix of the name to filter on.
        min_start_time_edge: The minimum value of the start time to filter on.
        max_start_time_edge: The maximum value of the start time to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of outwards multi edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemGQueryAPI: The query API for the connection item g.
    """
    from .connection_item_g_query import ConnectionItemGQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_view = ConnectionEdgeA._view_id
    edge_filter = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "multiProperty"),
        edge_view,
        min_end_time=min_end_time_edge,
        max_end_time=max_end_time_edge,
        name=name_edge,
        name_prefix=name_prefix_edge,
        min_start_time=min_start_time_edge,
        max_start_time=max_start_time_edge,
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            result_cls=ConnectionEdgeA,
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemGQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_g_filter(
        view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemGQueryAPI(self._client, self._builder, node_filer, limit)

outwards_single(direct_no_source=None, name=None, name_prefix=None, external_id_prefix=None, space=None, min_end_time_edge=None, max_end_time_edge=None, name_edge=None, name_prefix_edge=None, min_start_time_edge=None, max_start_time_edge=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the outwards single edges of the connection item f.

Parameters:

Name Type Description Default
direct_no_source str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct no source to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
min_end_time_edge datetime | None

The minimum value of the end time to filter on.

None
max_end_time_edge datetime | None

The maximum value of the end time to filter on.

None
name_edge str | list[str] | None

The name to filter on.

None
name_prefix_edge str | None

The prefix of the name to filter on.

None
min_start_time_edge datetime | None

The minimum value of the start time to filter on.

None
max_start_time_edge datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of outwards single edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemEQueryAPI ConnectionItemEQueryAPI[T_DomainModelList]

The query API for the connection item e.

Source code in examples/omni/_api/connection_item_f_query.py
def outwards_single(
    self,
    direct_no_source: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    min_end_time_edge: datetime.datetime | None = None,
    max_end_time_edge: datetime.datetime | None = None,
    name_edge: str | list[str] | None = None,
    name_prefix_edge: str | None = None,
    min_start_time_edge: datetime.datetime | None = None,
    max_start_time_edge: datetime.datetime | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemEQueryAPI[T_DomainModelList]:
    """Query along the outwards single edges of the connection item f.

    Args:
        direct_no_source: The direct no source to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        min_end_time_edge: The minimum value of the end time to filter on.
        max_end_time_edge: The maximum value of the end time to filter on.
        name_edge: The name to filter on.
        name_prefix_edge: The prefix of the name to filter on.
        min_start_time_edge: The minimum value of the start time to filter on.
        max_start_time_edge: The maximum value of the start time to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of outwards single edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemEQueryAPI: The query API for the connection item e.
    """
    from .connection_item_e_query import ConnectionItemEQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_view = ConnectionEdgeA._view_id
    edge_filter = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "singleProperty"),
        edge_view,
        min_end_time=min_end_time_edge,
        max_end_time=max_end_time_edge,
        name=name_edge,
        name_prefix=name_prefix_edge,
        min_start_time=min_start_time_edge,
        max_start_time=max_start_time_edge,
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            result_cls=ConnectionEdgeA,
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemEQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_e_filter(
        view_id,
        direct_no_source,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemEQueryAPI(self._client, self._builder, node_filer, limit)

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/connection_item_f_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

ConnectionItemGAPI

Bases: NodeAPI[ConnectionItemG, ConnectionItemGWrite, ConnectionItemGList, ConnectionItemGWriteList]

Source code in examples/omni/_api/connection_item_g.py
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
class ConnectionItemGAPI(NodeAPI[ConnectionItemG, ConnectionItemGWrite, ConnectionItemGList, ConnectionItemGWriteList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemG", "1")
    _properties_by_field = _CONNECTIONITEMG_PROPERTIES_BY_FIELD
    _class_type = ConnectionItemG
    _class_list = ConnectionItemGList
    _class_write_list = ConnectionItemGWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.inwards_multi_property_edge = ConnectionItemGInwardsMultiPropertyAPI(client)

    def __call__(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> ConnectionItemGQueryAPI[ConnectionItemGList]:
        """Query starting at connection item gs.

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for connection item gs.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_connection_item_g_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(ConnectionItemGList)
        return ConnectionItemGQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        connection_item_g: ConnectionItemGWrite | Sequence[ConnectionItemGWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) connection item gs.

        Note: This method iterates through all nodes and timeseries linked to connection_item_g and creates them including the edges
        between the nodes. For example, if any of `inwards_multi_property` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            connection_item_g: Connection item g or sequence of connection item gs to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new connection_item_g:

                >>> from omni import OmniClient
                >>> from omni.data_classes import ConnectionItemGWrite
                >>> client = OmniClient()
                >>> connection_item_g = ConnectionItemGWrite(external_id="my_connection_item_g", ...)
                >>> result = client.connection_item_g.apply(connection_item_g)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.connection_item_g.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(connection_item_g, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more connection item g.

        Args:
            external_id: External id of the connection item g to delete.
            space: The space where all the connection item g are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete connection_item_g by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.connection_item_g.delete("my_connection_item_g")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.connection_item_g.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemG | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemGList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> ConnectionItemG | ConnectionItemGList | None:
        """Retrieve one or more connection item gs by id(s).

        Args:
            external_id: External id or list of external ids of the connection item gs.
            space: The space where all the connection item gs are located.

        Returns:
            The requested connection item gs.

        Examples:

            Retrieve connection_item_g by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_g = client.connection_item_g.retrieve("my_connection_item_g")

        """
        return self._retrieve(
            external_id,
            space,
            retrieve_edges=True,
            edge_api_name_type_direction_view_id_penta=[
                (
                    self.inwards_multi_property_edge,
                    "inwards_multi_property",
                    dm.DirectRelationReference("pygen-models", "multiProperty"),
                    "inwards",
                    dm.ViewId("pygen-models", "ConnectionItemF", "1"),
                ),
            ],
        )

    def search(
        self,
        query: str,
        properties: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> ConnectionItemGList:
        """Search connection item gs

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results connection item gs matching the query.

        Examples:

           Search for 'my_connection_item_g' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_gs = client.connection_item_g.search('my_connection_item_g')

        """
        filter_ = _create_connection_item_g_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields],
        property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
        property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
        query: str | None = None,
        search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across connection item gs

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count connection item gs in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.connection_item_g.aggregate("count", space="my_space")

        """

        filter_ = _create_connection_item_g_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: ConnectionItemGFields,
        interval: float,
        query: str | None = None,
        search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for connection item gs

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_connection_item_g_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> ConnectionItemGQuery:
        """Start a query for connection item gs."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return ConnectionItemGQuery(self._client)

    def list(
        self,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: ConnectionItemGFields | Sequence[ConnectionItemGFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> ConnectionItemGList:
        """List/filter connection item gs

        Args:
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.
            retrieve_connections: Whether to retrieve `inwards_multi_property` for the connection item gs. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested connection item gs

        Examples:

            List connection item gs and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_gs = client.connection_item_g.list(limit=5)

        """
        filter_ = _create_connection_item_g_filter(
            self._view_id,
            name,
            name_prefix,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
                sort_by=sort_by,  # type: ignore[arg-type]
                direction=direction,
                sort=sort,
            )

        builder = QueryBuilder(ConnectionItemGList)
        has_data = dm.filters.HasData(views=[self._view_id])
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                    sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
                ),
                ConnectionItemG,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_inwards_multi_property = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_inwards_multi_property,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="inwards",
                    chain_to="destination",
                ),
                ConnectionEdgeA,
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_inwards_multi_property),
                    dm.query.NodeResultSetExpression(
                        from_=edge_inwards_multi_property,
                        filter=dm.filters.HasData(views=[ConnectionItemF._view_id]),
                    ),
                    ConnectionItemF,
                )
            )

        return builder.execute(self._client)

__call__(name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at connection item gs.

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
ConnectionItemGQueryAPI[ConnectionItemGList]

A query API for connection item gs.

Source code in examples/omni/_api/connection_item_g.py
def __call__(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> ConnectionItemGQueryAPI[ConnectionItemGList]:
    """Query starting at connection item gs.

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for connection item gs.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_connection_item_g_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(ConnectionItemGList)
    return ConnectionItemGQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None, query: str | None = None, search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None, query: str | None = None, search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields], property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None, query: str | None = None, search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None, name: str | list[str] | None = None, name_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across connection item gs

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None

The property to group by when doing the aggregation.

None
property ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None

The text field to search in.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count connection item gs in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.connection_item_g.aggregate("count", space="my_space")
Source code in examples/omni/_api/connection_item_g.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
    property: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
    query: str | None = None,
    search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across connection item gs

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count connection item gs in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.connection_item_g.aggregate("count", space="my_space")

    """

    filter_ = _create_connection_item_g_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(connection_item_g, replace=False, write_none=False)

Add or update (upsert) connection item gs.

Note: This method iterates through all nodes and timeseries linked to connection_item_g and creates them including the edges between the nodes. For example, if any of inwards_multi_property are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
connection_item_g ConnectionItemGWrite | Sequence[ConnectionItemGWrite]

Connection item g or sequence of connection item gs to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new connection_item_g:

    >>> from omni import OmniClient
    >>> from omni.data_classes import ConnectionItemGWrite
    >>> client = OmniClient()
    >>> connection_item_g = ConnectionItemGWrite(external_id="my_connection_item_g", ...)
    >>> result = client.connection_item_g.apply(connection_item_g)
Source code in examples/omni/_api/connection_item_g.py
def apply(
    self,
    connection_item_g: ConnectionItemGWrite | Sequence[ConnectionItemGWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) connection item gs.

    Note: This method iterates through all nodes and timeseries linked to connection_item_g and creates them including the edges
    between the nodes. For example, if any of `inwards_multi_property` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        connection_item_g: Connection item g or sequence of connection item gs to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new connection_item_g:

            >>> from omni import OmniClient
            >>> from omni.data_classes import ConnectionItemGWrite
            >>> client = OmniClient()
            >>> connection_item_g = ConnectionItemGWrite(external_id="my_connection_item_g", ...)
            >>> result = client.connection_item_g.apply(connection_item_g)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.connection_item_g.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(connection_item_g, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more connection item g.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the connection item g to delete.

required
space str

The space where all the connection item g are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete connection_item_g by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.connection_item_g.delete("my_connection_item_g")
Source code in examples/omni/_api/connection_item_g.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more connection item g.

    Args:
        external_id: External id of the connection item g to delete.
        space: The space where all the connection item g are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete connection_item_g by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.connection_item_g.delete("my_connection_item_g")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.connection_item_g.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for connection item gs

Parameters:

Name Type Description Default
property ConnectionItemGFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None

The text field to search in.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/connection_item_g.py
def histogram(
    self,
    property: ConnectionItemGFields,
    interval: float,
    query: str | None = None,
    search_property: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for connection item gs

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_connection_item_g_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None, retrieve_connections='skip')

List/filter connection item gs

Parameters:

Name Type Description Default
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemGFields | Sequence[ConnectionItemGFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve inwards_multi_property for the connection item gs. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
ConnectionItemGList

List of requested connection item gs

Examples:

List connection item gs and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_gs = client.connection_item_g.list(limit=5)
Source code in examples/omni/_api/connection_item_g.py
def list(
    self,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemGFields | Sequence[ConnectionItemGFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> ConnectionItemGList:
    """List/filter connection item gs

    Args:
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.
        retrieve_connections: Whether to retrieve `inwards_multi_property` for the connection item gs. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested connection item gs

    Examples:

        List connection item gs and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_gs = client.connection_item_g.list(limit=5)

    """
    filter_ = _create_connection_item_g_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    builder = QueryBuilder(ConnectionItemGList)
    has_data = dm.filters.HasData(views=[self._view_id])
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
            ),
            ConnectionItemG,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_inwards_multi_property = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_inwards_multi_property,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="inwards",
                chain_to="destination",
            ),
            ConnectionEdgeA,
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_inwards_multi_property),
                dm.query.NodeResultSetExpression(
                    from_=edge_inwards_multi_property,
                    filter=dm.filters.HasData(views=[ConnectionItemF._view_id]),
                ),
                ConnectionItemF,
            )
        )

    return builder.execute(self._client)

query()

Start a query for connection item gs.

Source code in examples/omni/_api/connection_item_g.py
def query(self) -> ConnectionItemGQuery:
    """Start a query for connection item gs."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return ConnectionItemGQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemG | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> ConnectionItemGList

Retrieve one or more connection item gs by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the connection item gs.

required
space str

The space where all the connection item gs are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
ConnectionItemG | ConnectionItemGList | None

The requested connection item gs.

Examples:

Retrieve connection_item_g by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_g = client.connection_item_g.retrieve("my_connection_item_g")
Source code in examples/omni/_api/connection_item_g.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> ConnectionItemG | ConnectionItemGList | None:
    """Retrieve one or more connection item gs by id(s).

    Args:
        external_id: External id or list of external ids of the connection item gs.
        space: The space where all the connection item gs are located.

    Returns:
        The requested connection item gs.

    Examples:

        Retrieve connection_item_g by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_g = client.connection_item_g.retrieve("my_connection_item_g")

    """
    return self._retrieve(
        external_id,
        space,
        retrieve_edges=True,
        edge_api_name_type_direction_view_id_penta=[
            (
                self.inwards_multi_property_edge,
                "inwards_multi_property",
                dm.DirectRelationReference("pygen-models", "multiProperty"),
                "inwards",
                dm.ViewId("pygen-models", "ConnectionItemF", "1"),
            ),
        ],
    )

search(query, properties=None, name=None, name_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search connection item gs

Parameters:

Name Type Description Default
query str

The search query,

required
properties ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
ConnectionItemGList

Search results connection item gs matching the query.

Examples:

Search for 'my_connection_item_g' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_gs = client.connection_item_g.search('my_connection_item_g')
Source code in examples/omni/_api/connection_item_g.py
def search(
    self,
    query: str,
    properties: ConnectionItemGTextFields | SequenceNotStr[ConnectionItemGTextFields] | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: ConnectionItemGFields | SequenceNotStr[ConnectionItemGFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> ConnectionItemGList:
    """Search connection item gs

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of connection item gs to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results connection item gs matching the query.

    Examples:

       Search for 'my_connection_item_g' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_gs = client.connection_item_g.search('my_connection_item_g')

    """
    filter_ = _create_connection_item_g_filter(
        self._view_id,
        name,
        name_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

ConnectionItemGInwardsMultiPropertyAPI

Bases: EdgePropertyAPI

Source code in examples/omni/_api/connection_item_g_inwards_multi_property.py
class ConnectionItemGInwardsMultiPropertyAPI(EdgePropertyAPI):
    _view_id = dm.ViewId("pygen-models", "ConnectionEdgeA", "1")
    _class_type = ConnectionEdgeA
    _class_write_type = ConnectionEdgeAWrite
    _class_list = ConnectionEdgeAList

    def list(
        self,
        from_connection_item_g: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_connection_item_g_space: str = DEFAULT_INSTANCE_SPACE,
        to_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
        min_end_time: datetime.datetime | None = None,
        max_end_time: datetime.datetime | None = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        min_start_time: datetime.datetime | None = None,
        max_start_time: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> ConnectionEdgeAList:
        """List inwards multi property edges of a connection item g.

        Args:
            from_connection_item_g: ID of the source connection item g.
            from_connection_item_g_space: Location of the connection item gs.
            to_connection_item_f: ID of the target connection item f.
            to_connection_item_f_space: Location of the connection item fs.
            min_end_time: The minimum value of the end time to filter on.
            max_end_time: The maximum value of the end time to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            min_start_time: The minimum value of the start time to filter on.
            max_start_time: The maximum value of the start time to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of inwards multi property edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested inwards multi property edges.

        Examples:

            List 5 inwards multi property edges connected to "my_connection_item_g":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> connection_item_g = client.connection_item_g.inwards_multi_property_edge.list("my_connection_item_g", limit=5)

        """
        filter_ = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "multiProperty"),
            self._view_id,
            to_connection_item_f,
            to_connection_item_f_space,
            from_connection_item_g,
            from_connection_item_g_space,
            min_end_time,
            max_end_time,
            name,
            name_prefix,
            min_start_time,
            max_start_time,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_connection_item_g=None, from_connection_item_g_space=DEFAULT_INSTANCE_SPACE, to_connection_item_f=None, to_connection_item_f_space=DEFAULT_INSTANCE_SPACE, min_end_time=None, max_end_time=None, name=None, name_prefix=None, min_start_time=None, max_start_time=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List inwards multi property edges of a connection item g.

Parameters:

Name Type Description Default
from_connection_item_g str | list[str] | NodeId | list[NodeId] | None

ID of the source connection item g.

None
from_connection_item_g_space str

Location of the connection item gs.

DEFAULT_INSTANCE_SPACE
to_connection_item_f str | list[str] | NodeId | list[NodeId] | None

ID of the target connection item f.

None
to_connection_item_f_space str

Location of the connection item fs.

DEFAULT_INSTANCE_SPACE
min_end_time datetime | None

The minimum value of the end time to filter on.

None
max_end_time datetime | None

The maximum value of the end time to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
min_start_time datetime | None

The minimum value of the start time to filter on.

None
max_start_time datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of inwards multi property edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
ConnectionEdgeAList

The requested inwards multi property edges.

Examples:

List 5 inwards multi property edges connected to "my_connection_item_g":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> connection_item_g = client.connection_item_g.inwards_multi_property_edge.list("my_connection_item_g", limit=5)
Source code in examples/omni/_api/connection_item_g_inwards_multi_property.py
def list(
    self,
    from_connection_item_g: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_connection_item_g_space: str = DEFAULT_INSTANCE_SPACE,
    to_connection_item_f: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_connection_item_f_space: str = DEFAULT_INSTANCE_SPACE,
    min_end_time: datetime.datetime | None = None,
    max_end_time: datetime.datetime | None = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    min_start_time: datetime.datetime | None = None,
    max_start_time: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> ConnectionEdgeAList:
    """List inwards multi property edges of a connection item g.

    Args:
        from_connection_item_g: ID of the source connection item g.
        from_connection_item_g_space: Location of the connection item gs.
        to_connection_item_f: ID of the target connection item f.
        to_connection_item_f_space: Location of the connection item fs.
        min_end_time: The minimum value of the end time to filter on.
        max_end_time: The maximum value of the end time to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        min_start_time: The minimum value of the start time to filter on.
        max_start_time: The maximum value of the start time to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of inwards multi property edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested inwards multi property edges.

    Examples:

        List 5 inwards multi property edges connected to "my_connection_item_g":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> connection_item_g = client.connection_item_g.inwards_multi_property_edge.list("my_connection_item_g", limit=5)

    """
    filter_ = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "multiProperty"),
        self._view_id,
        to_connection_item_f,
        to_connection_item_f_space,
        from_connection_item_g,
        from_connection_item_g_space,
        min_end_time,
        max_end_time,
        name,
        name_prefix,
        min_start_time,
        max_start_time,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

ConnectionItemGQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/connection_item_g_query.py
class ConnectionItemGQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "ConnectionItemG", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=ConnectionItemG,
                max_retrieve_limit=limit,
            )
        )

    def inwards_multi_property(
        self,
        direct_list: (
            str
            | tuple[str, str]
            | dm.NodeId
            | dm.DirectRelationReference
            | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
            | None
        ) = None,
        name: str | list[str] | None = None,
        name_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        min_end_time_edge: datetime.datetime | None = None,
        max_end_time_edge: datetime.datetime | None = None,
        name_edge: str | list[str] | None = None,
        name_prefix_edge: str | None = None,
        min_start_time_edge: datetime.datetime | None = None,
        max_start_time_edge: datetime.datetime | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> ConnectionItemFQueryAPI[T_DomainModelList]:
        """Query along the inwards multi property edges of the connection item g.

        Args:
            direct_list: The direct list to filter on.
            name: The name to filter on.
            name_prefix: The prefix of the name to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            min_end_time_edge: The minimum value of the end time to filter on.
            max_end_time_edge: The maximum value of the end time to filter on.
            name_edge: The name to filter on.
            name_prefix_edge: The prefix of the name to filter on.
            min_start_time_edge: The minimum value of the start time to filter on.
            max_start_time_edge: The maximum value of the start time to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of inwards multi property edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            ConnectionItemFQueryAPI: The query API for the connection item f.
        """
        from .connection_item_f_query import ConnectionItemFQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_view = ConnectionEdgeA._view_id
        edge_filter = _create_connection_edge_a_filter(
            dm.DirectRelationReference("pygen-models", "multiProperty"),
            edge_view,
            min_end_time=min_end_time_edge,
            max_end_time=max_end_time_edge,
            name=name_edge,
            name_prefix=name_prefix_edge,
            min_start_time=min_start_time_edge,
            max_start_time=max_start_time_edge,
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="inwards",
                ),
                result_cls=ConnectionEdgeA,
                max_retrieve_limit=limit,
            )
        )

        view_id = ConnectionItemFQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_connection_item_f_filter(
            view_id,
            direct_list,
            name,
            name_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return ConnectionItemFQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

inwards_multi_property(direct_list=None, name=None, name_prefix=None, external_id_prefix=None, space=None, min_end_time_edge=None, max_end_time_edge=None, name_edge=None, name_prefix_edge=None, min_start_time_edge=None, max_start_time_edge=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the inwards multi property edges of the connection item g.

Parameters:

Name Type Description Default
direct_list str | tuple[str, str] | NodeId | DirectRelationReference | Sequence[str | tuple[str, str] | NodeId | DirectRelationReference] | None

The direct list to filter on.

None
name str | list[str] | None

The name to filter on.

None
name_prefix str | None

The prefix of the name to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
min_end_time_edge datetime | None

The minimum value of the end time to filter on.

None
max_end_time_edge datetime | None

The maximum value of the end time to filter on.

None
name_edge str | list[str] | None

The name to filter on.

None
name_prefix_edge str | None

The prefix of the name to filter on.

None
min_start_time_edge datetime | None

The minimum value of the start time to filter on.

None
max_start_time_edge datetime | None

The maximum value of the start time to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of inwards multi property edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
ConnectionItemFQueryAPI ConnectionItemFQueryAPI[T_DomainModelList]

The query API for the connection item f.

Source code in examples/omni/_api/connection_item_g_query.py
def inwards_multi_property(
    self,
    direct_list: (
        str
        | tuple[str, str]
        | dm.NodeId
        | dm.DirectRelationReference
        | Sequence[str | tuple[str, str] | dm.NodeId | dm.DirectRelationReference]
        | None
    ) = None,
    name: str | list[str] | None = None,
    name_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    min_end_time_edge: datetime.datetime | None = None,
    max_end_time_edge: datetime.datetime | None = None,
    name_edge: str | list[str] | None = None,
    name_prefix_edge: str | None = None,
    min_start_time_edge: datetime.datetime | None = None,
    max_start_time_edge: datetime.datetime | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> ConnectionItemFQueryAPI[T_DomainModelList]:
    """Query along the inwards multi property edges of the connection item g.

    Args:
        direct_list: The direct list to filter on.
        name: The name to filter on.
        name_prefix: The prefix of the name to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        min_end_time_edge: The minimum value of the end time to filter on.
        max_end_time_edge: The maximum value of the end time to filter on.
        name_edge: The name to filter on.
        name_prefix_edge: The prefix of the name to filter on.
        min_start_time_edge: The minimum value of the start time to filter on.
        max_start_time_edge: The maximum value of the start time to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of inwards multi property edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        ConnectionItemFQueryAPI: The query API for the connection item f.
    """
    from .connection_item_f_query import ConnectionItemFQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_view = ConnectionEdgeA._view_id
    edge_filter = _create_connection_edge_a_filter(
        dm.DirectRelationReference("pygen-models", "multiProperty"),
        edge_view,
        min_end_time=min_end_time_edge,
        max_end_time=max_end_time_edge,
        name=name_edge,
        name_prefix=name_prefix_edge,
        min_start_time=min_start_time_edge,
        max_start_time=max_start_time_edge,
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="inwards",
            ),
            result_cls=ConnectionEdgeA,
            max_retrieve_limit=limit,
        )
    )

    view_id = ConnectionItemFQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_connection_item_f_filter(
        view_id,
        direct_list,
        name,
        name_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return ConnectionItemFQueryAPI(self._client, self._builder, node_filer, limit)

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/connection_item_g_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

DependentOnNonWritableAPI

Bases: NodeAPI[DependentOnNonWritable, DependentOnNonWritableWrite, DependentOnNonWritableList, DependentOnNonWritableWriteList]

Source code in examples/omni/_api/dependent_on_non_writable.py
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
class DependentOnNonWritableAPI(
    NodeAPI[
        DependentOnNonWritable, DependentOnNonWritableWrite, DependentOnNonWritableList, DependentOnNonWritableWriteList
    ]
):
    _view_id = dm.ViewId("pygen-models", "DependentOnNonWritable", "1")
    _properties_by_field = _DEPENDENTONNONWRITABLE_PROPERTIES_BY_FIELD
    _class_type = DependentOnNonWritable
    _class_list = DependentOnNonWritableList
    _class_write_list = DependentOnNonWritableWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

        self.to_non_writable_edge = DependentOnNonWritableToNonWritableAPI(client)

    def __call__(
        self,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> DependentOnNonWritableQueryAPI[DependentOnNonWritableList]:
        """Query starting at dependent on non writables.

        Args:
            a_value: The a value to filter on.
            a_value_prefix: The prefix of the a value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for dependent on non writables.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_dependent_on_non_writable_filter(
            self._view_id,
            a_value,
            a_value_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(DependentOnNonWritableList)
        return DependentOnNonWritableQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        dependent_on_non_writable: DependentOnNonWritableWrite | Sequence[DependentOnNonWritableWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) dependent on non writables.

        Note: This method iterates through all nodes and timeseries linked to dependent_on_non_writable and creates them including the edges
        between the nodes. For example, if any of `to_non_writable` are set, then these
        nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

        Args:
            dependent_on_non_writable: Dependent on non writable or sequence of dependent on non writables to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new dependent_on_non_writable:

                >>> from omni import OmniClient
                >>> from omni.data_classes import DependentOnNonWritableWrite
                >>> client = OmniClient()
                >>> dependent_on_non_writable = DependentOnNonWritableWrite(external_id="my_dependent_on_non_writable", ...)
                >>> result = client.dependent_on_non_writable.apply(dependent_on_non_writable)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.dependent_on_non_writable.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(dependent_on_non_writable, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more dependent on non writable.

        Args:
            external_id: External id of the dependent on non writable to delete.
            space: The space where all the dependent on non writable are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete dependent_on_non_writable by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.dependent_on_non_writable.delete("my_dependent_on_non_writable")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.dependent_on_non_writable.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> DependentOnNonWritable | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> DependentOnNonWritableList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> DependentOnNonWritable | DependentOnNonWritableList | None:
        """Retrieve one or more dependent on non writables by id(s).

        Args:
            external_id: External id or list of external ids of the dependent on non writables.
            space: The space where all the dependent on non writables are located.

        Returns:
            The requested dependent on non writables.

        Examples:

            Retrieve dependent_on_non_writable by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> dependent_on_non_writable = client.dependent_on_non_writable.retrieve("my_dependent_on_non_writable")

        """
        return self._retrieve(
            external_id,
            space,
            retrieve_edges=True,
            edge_api_name_type_direction_view_id_penta=[
                (
                    self.to_non_writable_edge,
                    "to_non_writable",
                    dm.DirectRelationReference("pygen-models", "toNonWritable"),
                    "outwards",
                    dm.ViewId("pygen-models", "Implementation1NonWriteable", "1"),
                ),
            ],
        )

    def search(
        self,
        query: str,
        properties: DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None = None,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> DependentOnNonWritableList:
        """Search dependent on non writables

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            a_value: The a value to filter on.
            a_value_prefix: The prefix of the a value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results dependent on non writables matching the query.

        Examples:

           Search for 'my_dependent_on_non_writable' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> dependent_on_non_writables = client.dependent_on_non_writable.search('my_dependent_on_non_writable')

        """
        filter_ = _create_dependent_on_non_writable_filter(
            self._view_id,
            a_value,
            a_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
        query: str | None = None,
        search_property: (
            DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None
        ) = None,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
        query: str | None = None,
        search_property: (
            DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None
        ) = None,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields],
        property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
        query: str | None = None,
        search_property: (
            DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None
        ) = None,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
        property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
        query: str | None = None,
        search_property: (
            DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None
        ) = None,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across dependent on non writables

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            a_value: The a value to filter on.
            a_value_prefix: The prefix of the a value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count dependent on non writables in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.dependent_on_non_writable.aggregate("count", space="my_space")

        """

        filter_ = _create_dependent_on_non_writable_filter(
            self._view_id,
            a_value,
            a_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: DependentOnNonWritableFields,
        interval: float,
        query: str | None = None,
        search_property: (
            DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None
        ) = None,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for dependent on non writables

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            a_value: The a value to filter on.
            a_value_prefix: The prefix of the a value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_dependent_on_non_writable_filter(
            self._view_id,
            a_value,
            a_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> DependentOnNonWritableQuery:
        """Start a query for dependent on non writables."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return DependentOnNonWritableQuery(self._client)

    def list(
        self,
        a_value: str | list[str] | None = None,
        a_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: DependentOnNonWritableFields | Sequence[DependentOnNonWritableFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
        retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
    ) -> DependentOnNonWritableList:
        """List/filter dependent on non writables

        Args:
            a_value: The a value to filter on.
            a_value_prefix: The prefix of the a value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.
            retrieve_connections: Whether to retrieve `to_non_writable` for the dependent on non writables. Defaults to 'skip'.
                'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

        Returns:
            List of requested dependent on non writables

        Examples:

            List dependent on non writables and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> dependent_on_non_writables = client.dependent_on_non_writable.list(limit=5)

        """
        filter_ = _create_dependent_on_non_writable_filter(
            self._view_id,
            a_value,
            a_value_prefix,
            external_id_prefix,
            space,
            filter,
        )

        if retrieve_connections == "skip":
            return self._list(
                limit=limit,
                filter=filter_,
                sort_by=sort_by,  # type: ignore[arg-type]
                direction=direction,
                sort=sort,
            )

        builder = QueryBuilder(DependentOnNonWritableList)
        has_data = dm.filters.HasData(views=[self._view_id])
        builder.append(
            NodeQueryStep(
                builder.create_name(None),
                dm.query.NodeResultSetExpression(
                    filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                    sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
                ),
                DependentOnNonWritable,
                max_retrieve_limit=limit,
            )
        )
        from_root = builder.get_from()
        edge_to_non_writable = builder.create_name(from_root)
        builder.append(
            EdgeQueryStep(
                edge_to_non_writable,
                dm.query.EdgeResultSetExpression(
                    from_=from_root,
                    direction="outwards",
                    chain_to="destination",
                ),
            )
        )
        if retrieve_connections == "full":
            builder.append(
                NodeQueryStep(
                    builder.create_name(edge_to_non_writable),
                    dm.query.NodeResultSetExpression(
                        from_=edge_to_non_writable,
                        filter=dm.filters.HasData(views=[Implementation1NonWriteable._view_id]),
                    ),
                    Implementation1NonWriteable,
                )
            )

        return builder.execute(self._client)

__call__(a_value=None, a_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at dependent on non writables.

Parameters:

Name Type Description Default
a_value str | list[str] | None

The a value to filter on.

None
a_value_prefix str | None

The prefix of the a value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
DependentOnNonWritableQueryAPI[DependentOnNonWritableList]

A query API for dependent on non writables.

Source code in examples/omni/_api/dependent_on_non_writable.py
def __call__(
    self,
    a_value: str | list[str] | None = None,
    a_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> DependentOnNonWritableQueryAPI[DependentOnNonWritableList]:
    """Query starting at dependent on non writables.

    Args:
        a_value: The a value to filter on.
        a_value_prefix: The prefix of the a value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for dependent on non writables.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_dependent_on_non_writable_filter(
        self._view_id,
        a_value,
        a_value_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(DependentOnNonWritableList)
    return DependentOnNonWritableQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, a_value=None, a_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None, query: str | None = None, search_property: DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None = None, a_value: str | list[str] | None = None, a_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None, query: str | None = None, search_property: DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None = None, a_value: str | list[str] | None = None, a_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields], property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None, query: str | None = None, search_property: DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None = None, a_value: str | list[str] | None = None, a_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across dependent on non writables

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None

The property to group by when doing the aggregation.

None
property DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None

The text field to search in.

None
a_value str | list[str] | None

The a value to filter on.

None
a_value_prefix str | None

The prefix of the a value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count dependent on non writables in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.dependent_on_non_writable.aggregate("count", space="my_space")
Source code in examples/omni/_api/dependent_on_non_writable.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
    property: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
    query: str | None = None,
    search_property: (
        DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None
    ) = None,
    a_value: str | list[str] | None = None,
    a_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across dependent on non writables

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        a_value: The a value to filter on.
        a_value_prefix: The prefix of the a value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count dependent on non writables in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.dependent_on_non_writable.aggregate("count", space="my_space")

    """

    filter_ = _create_dependent_on_non_writable_filter(
        self._view_id,
        a_value,
        a_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(dependent_on_non_writable, replace=False, write_none=False)

Add or update (upsert) dependent on non writables.

Note: This method iterates through all nodes and timeseries linked to dependent_on_non_writable and creates them including the edges between the nodes. For example, if any of to_non_writable are set, then these nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

Parameters:

Name Type Description Default
dependent_on_non_writable DependentOnNonWritableWrite | Sequence[DependentOnNonWritableWrite]

Dependent on non writable or sequence of dependent on non writables to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new dependent_on_non_writable:

    >>> from omni import OmniClient
    >>> from omni.data_classes import DependentOnNonWritableWrite
    >>> client = OmniClient()
    >>> dependent_on_non_writable = DependentOnNonWritableWrite(external_id="my_dependent_on_non_writable", ...)
    >>> result = client.dependent_on_non_writable.apply(dependent_on_non_writable)
Source code in examples/omni/_api/dependent_on_non_writable.py
def apply(
    self,
    dependent_on_non_writable: DependentOnNonWritableWrite | Sequence[DependentOnNonWritableWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) dependent on non writables.

    Note: This method iterates through all nodes and timeseries linked to dependent_on_non_writable and creates them including the edges
    between the nodes. For example, if any of `to_non_writable` are set, then these
    nodes as well as any nodes linked to them, and all the edges linking these nodes will be created.

    Args:
        dependent_on_non_writable: Dependent on non writable or sequence of dependent on non writables to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new dependent_on_non_writable:

            >>> from omni import OmniClient
            >>> from omni.data_classes import DependentOnNonWritableWrite
            >>> client = OmniClient()
            >>> dependent_on_non_writable = DependentOnNonWritableWrite(external_id="my_dependent_on_non_writable", ...)
            >>> result = client.dependent_on_non_writable.apply(dependent_on_non_writable)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.dependent_on_non_writable.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(dependent_on_non_writable, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more dependent on non writable.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the dependent on non writable to delete.

required
space str

The space where all the dependent on non writable are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete dependent_on_non_writable by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.dependent_on_non_writable.delete("my_dependent_on_non_writable")
Source code in examples/omni/_api/dependent_on_non_writable.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more dependent on non writable.

    Args:
        external_id: External id of the dependent on non writable to delete.
        space: The space where all the dependent on non writable are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete dependent_on_non_writable by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.dependent_on_non_writable.delete("my_dependent_on_non_writable")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.dependent_on_non_writable.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, a_value=None, a_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for dependent on non writables

Parameters:

Name Type Description Default
property DependentOnNonWritableFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None

The text field to search in.

None
a_value str | list[str] | None

The a value to filter on.

None
a_value_prefix str | None

The prefix of the a value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/dependent_on_non_writable.py
def histogram(
    self,
    property: DependentOnNonWritableFields,
    interval: float,
    query: str | None = None,
    search_property: (
        DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None
    ) = None,
    a_value: str | list[str] | None = None,
    a_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for dependent on non writables

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        a_value: The a value to filter on.
        a_value_prefix: The prefix of the a value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_dependent_on_non_writable_filter(
        self._view_id,
        a_value,
        a_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(a_value=None, a_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None, retrieve_connections='skip')

List/filter dependent on non writables

Parameters:

Name Type Description Default
a_value str | list[str] | None

The a value to filter on.

None
a_value_prefix str | None

The prefix of the a value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by DependentOnNonWritableFields | Sequence[DependentOnNonWritableFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None
retrieve_connections Literal['skip', 'identifier', 'full']

Whether to retrieve to_non_writable for the dependent on non writables. Defaults to 'skip'. 'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

'skip'

Returns:

Type Description
DependentOnNonWritableList

List of requested dependent on non writables

Examples:

List dependent on non writables and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> dependent_on_non_writables = client.dependent_on_non_writable.list(limit=5)
Source code in examples/omni/_api/dependent_on_non_writable.py
def list(
    self,
    a_value: str | list[str] | None = None,
    a_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: DependentOnNonWritableFields | Sequence[DependentOnNonWritableFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
    retrieve_connections: Literal["skip", "identifier", "full"] = "skip",
) -> DependentOnNonWritableList:
    """List/filter dependent on non writables

    Args:
        a_value: The a value to filter on.
        a_value_prefix: The prefix of the a value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.
        retrieve_connections: Whether to retrieve `to_non_writable` for the dependent on non writables. Defaults to 'skip'.
            'skip' will not retrieve any connections, 'identifier' will only retrieve the identifier of the connected items, and 'full' will retrieve the full connected items.

    Returns:
        List of requested dependent on non writables

    Examples:

        List dependent on non writables and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> dependent_on_non_writables = client.dependent_on_non_writable.list(limit=5)

    """
    filter_ = _create_dependent_on_non_writable_filter(
        self._view_id,
        a_value,
        a_value_prefix,
        external_id_prefix,
        space,
        filter,
    )

    if retrieve_connections == "skip":
        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    builder = QueryBuilder(DependentOnNonWritableList)
    has_data = dm.filters.HasData(views=[self._view_id])
    builder.append(
        NodeQueryStep(
            builder.create_name(None),
            dm.query.NodeResultSetExpression(
                filter=dm.filters.And(filter_, has_data) if filter_ else has_data,
                sort=self._create_sort(sort_by, direction, sort),  # type: ignore[arg-type]
            ),
            DependentOnNonWritable,
            max_retrieve_limit=limit,
        )
    )
    from_root = builder.get_from()
    edge_to_non_writable = builder.create_name(from_root)
    builder.append(
        EdgeQueryStep(
            edge_to_non_writable,
            dm.query.EdgeResultSetExpression(
                from_=from_root,
                direction="outwards",
                chain_to="destination",
            ),
        )
    )
    if retrieve_connections == "full":
        builder.append(
            NodeQueryStep(
                builder.create_name(edge_to_non_writable),
                dm.query.NodeResultSetExpression(
                    from_=edge_to_non_writable,
                    filter=dm.filters.HasData(views=[Implementation1NonWriteable._view_id]),
                ),
                Implementation1NonWriteable,
            )
        )

    return builder.execute(self._client)

query()

Start a query for dependent on non writables.

Source code in examples/omni/_api/dependent_on_non_writable.py
def query(self) -> DependentOnNonWritableQuery:
    """Start a query for dependent on non writables."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return DependentOnNonWritableQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> DependentOnNonWritable | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> DependentOnNonWritableList

Retrieve one or more dependent on non writables by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the dependent on non writables.

required
space str

The space where all the dependent on non writables are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
DependentOnNonWritable | DependentOnNonWritableList | None

The requested dependent on non writables.

Examples:

Retrieve dependent_on_non_writable by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> dependent_on_non_writable = client.dependent_on_non_writable.retrieve("my_dependent_on_non_writable")
Source code in examples/omni/_api/dependent_on_non_writable.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> DependentOnNonWritable | DependentOnNonWritableList | None:
    """Retrieve one or more dependent on non writables by id(s).

    Args:
        external_id: External id or list of external ids of the dependent on non writables.
        space: The space where all the dependent on non writables are located.

    Returns:
        The requested dependent on non writables.

    Examples:

        Retrieve dependent_on_non_writable by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> dependent_on_non_writable = client.dependent_on_non_writable.retrieve("my_dependent_on_non_writable")

    """
    return self._retrieve(
        external_id,
        space,
        retrieve_edges=True,
        edge_api_name_type_direction_view_id_penta=[
            (
                self.to_non_writable_edge,
                "to_non_writable",
                dm.DirectRelationReference("pygen-models", "toNonWritable"),
                "outwards",
                dm.ViewId("pygen-models", "Implementation1NonWriteable", "1"),
            ),
        ],
    )

search(query, properties=None, a_value=None, a_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search dependent on non writables

Parameters:

Name Type Description Default
query str

The search query,

required
properties DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
a_value str | list[str] | None

The a value to filter on.

None
a_value_prefix str | None

The prefix of the a value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
DependentOnNonWritableList

Search results dependent on non writables matching the query.

Examples:

Search for 'my_dependent_on_non_writable' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> dependent_on_non_writables = client.dependent_on_non_writable.search('my_dependent_on_non_writable')
Source code in examples/omni/_api/dependent_on_non_writable.py
def search(
    self,
    query: str,
    properties: DependentOnNonWritableTextFields | SequenceNotStr[DependentOnNonWritableTextFields] | None = None,
    a_value: str | list[str] | None = None,
    a_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: DependentOnNonWritableFields | SequenceNotStr[DependentOnNonWritableFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> DependentOnNonWritableList:
    """Search dependent on non writables

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        a_value: The a value to filter on.
        a_value_prefix: The prefix of the a value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of dependent on non writables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results dependent on non writables matching the query.

    Examples:

       Search for 'my_dependent_on_non_writable' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> dependent_on_non_writables = client.dependent_on_non_writable.search('my_dependent_on_non_writable')

    """
    filter_ = _create_dependent_on_non_writable_filter(
        self._view_id,
        a_value,
        a_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

DependentOnNonWritableQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/dependent_on_non_writable_query.py
class DependentOnNonWritableQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "DependentOnNonWritable", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=DependentOnNonWritable,
                max_retrieve_limit=limit,
            )
        )

    def to_non_writable(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        external_id_prefix_edge: str | None = None,
        space_edge: str | list[str] | None = None,
        filter: dm.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ) -> Implementation1NonWriteableQueryAPI[T_DomainModelList]:
        """Query along the to non writable edges of the dependent on non writable.

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            external_id_prefix_edge: The prefix of the external ID to filter on.
            space_edge: The space to filter on.
            filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            limit: Maximum number of to non writable edges to return. Defaults to 3. Set to -1, float("inf") or None
                to return all items.

        Returns:
            Implementation1NonWriteableQueryAPI: The query API for the implementation 1 non writeable.
        """
        from .implementation_1_non_writeable_query import Implementation1NonWriteableQueryAPI

        # from is a string as we added a node query step in the __init__ method
        from_ = cast(str, self._builder.get_from())
        edge_filter = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "toNonWritable"),
            external_id_prefix=external_id_prefix_edge,
            space=space_edge,
        )
        self._builder.append(
            EdgeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.EdgeResultSetExpression(
                    filter=edge_filter,
                    from_=from_,
                    direction="outwards",
                ),
                max_retrieve_limit=limit,
            )
        )

        view_id = Implementation1NonWriteableQueryAPI._view_id
        has_data = dm.filters.HasData(views=[view_id])
        node_filer = _create_implementation_1_non_writeable_filter(
            view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        return Implementation1NonWriteableQueryAPI(self._client, self._builder, node_filer, limit)

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/dependent_on_non_writable_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

to_non_writable(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, external_id_prefix=None, space=None, external_id_prefix_edge=None, space_edge=None, filter=None, limit=DEFAULT_QUERY_LIMIT)

Query along the to non writable edges of the dependent on non writable.

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
external_id_prefix_edge str | None

The prefix of the external ID to filter on.

None
space_edge str | list[str] | None

The space to filter on.

None
filter Filter | None

(Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
limit int

Maximum number of to non writable edges to return. Defaults to 3. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT

Returns:

Name Type Description
Implementation1NonWriteableQueryAPI Implementation1NonWriteableQueryAPI[T_DomainModelList]

The query API for the implementation 1 non writeable.

Source code in examples/omni/_api/dependent_on_non_writable_query.py
def to_non_writable(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    external_id_prefix_edge: str | None = None,
    space_edge: str | list[str] | None = None,
    filter: dm.Filter | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
) -> Implementation1NonWriteableQueryAPI[T_DomainModelList]:
    """Query along the to non writable edges of the dependent on non writable.

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        external_id_prefix_edge: The prefix of the external ID to filter on.
        space_edge: The space to filter on.
        filter: (Advanced) Filter applied to node. If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        limit: Maximum number of to non writable edges to return. Defaults to 3. Set to -1, float("inf") or None
            to return all items.

    Returns:
        Implementation1NonWriteableQueryAPI: The query API for the implementation 1 non writeable.
    """
    from .implementation_1_non_writeable_query import Implementation1NonWriteableQueryAPI

    # from is a string as we added a node query step in the __init__ method
    from_ = cast(str, self._builder.get_from())
    edge_filter = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "toNonWritable"),
        external_id_prefix=external_id_prefix_edge,
        space=space_edge,
    )
    self._builder.append(
        EdgeQueryStep(
            name=self._builder.create_name(from_),
            expression=dm.query.EdgeResultSetExpression(
                filter=edge_filter,
                from_=from_,
                direction="outwards",
            ),
            max_retrieve_limit=limit,
        )
    )

    view_id = Implementation1NonWriteableQueryAPI._view_id
    has_data = dm.filters.HasData(views=[view_id])
    node_filer = _create_implementation_1_non_writeable_filter(
        view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    return Implementation1NonWriteableQueryAPI(self._client, self._builder, node_filer, limit)

DependentOnNonWritableToNonWritableAPI

Bases: EdgeAPI

Source code in examples/omni/_api/dependent_on_non_writable_to_non_writable.py
class DependentOnNonWritableToNonWritableAPI(EdgeAPI):
    def list(
        self,
        from_dependent_on_non_writable: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        from_dependent_on_non_writable_space: str = DEFAULT_INSTANCE_SPACE,
        to_implementation_1_non_writeable: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
        to_implementation_1_non_writeable_space: str = DEFAULT_INSTANCE_SPACE,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit=DEFAULT_LIMIT_READ,
    ) -> dm.EdgeList:
        """List to non writable edges of a dependent on non writable.

        Args:
            from_dependent_on_non_writable: ID of the source dependent on non writable.
            from_dependent_on_non_writable_space: Location of the dependent on non writables.
            to_implementation_1_non_writeable: ID of the target implementation 1 non writeable.
            to_implementation_1_non_writeable_space: Location of the implementation 1 non writeables.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of to non writable edges to return. Defaults to 25. Set to -1, float("inf") or None
                to return all items.

        Returns:
            The requested to non writable edges.

        Examples:

            List 5 to non writable edges connected to "my_dependent_on_non_writable":

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> dependent_on_non_writable = client.dependent_on_non_writable.to_non_writable_edge.list("my_dependent_on_non_writable", limit=5)

        """
        filter_ = _create_edge_filter(
            dm.DirectRelationReference("pygen-models", "toNonWritable"),
            from_dependent_on_non_writable,
            from_dependent_on_non_writable_space,
            to_implementation_1_non_writeable,
            to_implementation_1_non_writeable_space,
            external_id_prefix,
            space,
        )
        return self._list(filter_=filter_, limit=limit)

list(from_dependent_on_non_writable=None, from_dependent_on_non_writable_space=DEFAULT_INSTANCE_SPACE, to_implementation_1_non_writeable=None, to_implementation_1_non_writeable_space=DEFAULT_INSTANCE_SPACE, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ)

List to non writable edges of a dependent on non writable.

Parameters:

Name Type Description Default
from_dependent_on_non_writable str | list[str] | NodeId | list[NodeId] | None

ID of the source dependent on non writable.

None
from_dependent_on_non_writable_space str

Location of the dependent on non writables.

DEFAULT_INSTANCE_SPACE
to_implementation_1_non_writeable str | list[str] | NodeId | list[NodeId] | None

ID of the target implementation 1 non writeable.

None
to_implementation_1_non_writeable_space str

Location of the implementation 1 non writeables.

DEFAULT_INSTANCE_SPACE
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit

Maximum number of to non writable edges to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ

Returns:

Type Description
EdgeList

The requested to non writable edges.

Examples:

List 5 to non writable edges connected to "my_dependent_on_non_writable":

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> dependent_on_non_writable = client.dependent_on_non_writable.to_non_writable_edge.list("my_dependent_on_non_writable", limit=5)
Source code in examples/omni/_api/dependent_on_non_writable_to_non_writable.py
def list(
    self,
    from_dependent_on_non_writable: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    from_dependent_on_non_writable_space: str = DEFAULT_INSTANCE_SPACE,
    to_implementation_1_non_writeable: str | list[str] | dm.NodeId | list[dm.NodeId] | None = None,
    to_implementation_1_non_writeable_space: str = DEFAULT_INSTANCE_SPACE,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit=DEFAULT_LIMIT_READ,
) -> dm.EdgeList:
    """List to non writable edges of a dependent on non writable.

    Args:
        from_dependent_on_non_writable: ID of the source dependent on non writable.
        from_dependent_on_non_writable_space: Location of the dependent on non writables.
        to_implementation_1_non_writeable: ID of the target implementation 1 non writeable.
        to_implementation_1_non_writeable_space: Location of the implementation 1 non writeables.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of to non writable edges to return. Defaults to 25. Set to -1, float("inf") or None
            to return all items.

    Returns:
        The requested to non writable edges.

    Examples:

        List 5 to non writable edges connected to "my_dependent_on_non_writable":

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> dependent_on_non_writable = client.dependent_on_non_writable.to_non_writable_edge.list("my_dependent_on_non_writable", limit=5)

    """
    filter_ = _create_edge_filter(
        dm.DirectRelationReference("pygen-models", "toNonWritable"),
        from_dependent_on_non_writable,
        from_dependent_on_non_writable_space,
        to_implementation_1_non_writeable,
        to_implementation_1_non_writeable_space,
        external_id_prefix,
        space,
    )
    return self._list(filter_=filter_, limit=limit)

EmptyAPI

Bases: NodeAPI[Empty, EmptyWrite, EmptyList, EmptyWriteList]

Source code in examples/omni/_api/empty.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
class EmptyAPI(NodeAPI[Empty, EmptyWrite, EmptyList, EmptyWriteList]):
    _view_id = dm.ViewId("pygen-models", "Empty", "1")
    _properties_by_field = _EMPTY_PROPERTIES_BY_FIELD
    _class_type = Empty
    _class_list = EmptyList
    _class_write_list = EmptyWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> EmptyQueryAPI[EmptyList]:
        """Query starting at empties.

        Args:
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for empties.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_empty_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(EmptyList)
        return EmptyQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        empty: EmptyWrite | Sequence[EmptyWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) empties.

        Args:
            empty: Empty or sequence of empties to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new empty:

                >>> from omni import OmniClient
                >>> from omni.data_classes import EmptyWrite
                >>> client = OmniClient()
                >>> empty = EmptyWrite(external_id="my_empty", ...)
                >>> result = client.empty.apply(empty)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.empty.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(empty, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more empty.

        Args:
            external_id: External id of the empty to delete.
            space: The space where all the empty are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete empty by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.empty.delete("my_empty")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.empty.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Empty | None: ...

    @overload
    def retrieve(self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> EmptyList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> Empty | EmptyList | None:
        """Retrieve one or more empties by id(s).

        Args:
            external_id: External id or list of external ids of the empties.
            space: The space where all the empties are located.

        Returns:
            The requested empties.

        Examples:

            Retrieve empty by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> empty = client.empty.retrieve("my_empty")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> EmptyList:
        """Search empties

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results empties matching the query.

        Examples:

           Search for 'my_empty' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> empties = client.empty.search('my_empty')

        """
        filter_ = _create_empty_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
        query: str | None = None,
        search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
        query: str | None = None,
        search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: EmptyFields | SequenceNotStr[EmptyFields],
        property: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
        query: str | None = None,
        search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
        property: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
        query: str | None = None,
        search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across empties

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count empties in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.empty.aggregate("count", space="my_space")

        """

        filter_ = _create_empty_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: EmptyFields,
        interval: float,
        query: str | None = None,
        search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for empties

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_empty_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> EmptyQuery:
        """Start a query for empties."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return EmptyQuery(self._client)

    def list(
        self,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: EmptyFields | Sequence[EmptyFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> EmptyList:
        """List/filter empties

        Args:
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested empties

        Examples:

            List empties and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> empties = client.empty.list(limit=5)

        """
        filter_ = _create_empty_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at empties.

Parameters:

Name Type Description Default
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
EmptyQueryAPI[EmptyList]

A query API for empties.

Source code in examples/omni/_api/empty.py
def __call__(
    self,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> EmptyQueryAPI[EmptyList]:
    """Query starting at empties.

    Args:
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for empties.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_empty_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(EmptyList)
    return EmptyQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: EmptyFields | SequenceNotStr[EmptyFields] | None = None, query: str | None = None, search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: EmptyFields | SequenceNotStr[EmptyFields] | None = None, query: str | None = None, search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: EmptyFields | SequenceNotStr[EmptyFields], property: EmptyFields | SequenceNotStr[EmptyFields] | None = None, query: str | None = None, search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across empties

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by EmptyFields | SequenceNotStr[EmptyFields] | None

The property to group by when doing the aggregation.

None
property EmptyFields | SequenceNotStr[EmptyFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property EmptyTextFields | SequenceNotStr[EmptyTextFields] | None

The text field to search in.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count empties in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.empty.aggregate("count", space="my_space")
Source code in examples/omni/_api/empty.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
    property: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
    query: str | None = None,
    search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across empties

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count empties in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.empty.aggregate("count", space="my_space")

    """

    filter_ = _create_empty_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(empty, replace=False, write_none=False)

Add or update (upsert) empties.

Parameters:

Name Type Description Default
empty EmptyWrite | Sequence[EmptyWrite]

Empty or sequence of empties to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new empty:

    >>> from omni import OmniClient
    >>> from omni.data_classes import EmptyWrite
    >>> client = OmniClient()
    >>> empty = EmptyWrite(external_id="my_empty", ...)
    >>> result = client.empty.apply(empty)
Source code in examples/omni/_api/empty.py
def apply(
    self,
    empty: EmptyWrite | Sequence[EmptyWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) empties.

    Args:
        empty: Empty or sequence of empties to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new empty:

            >>> from omni import OmniClient
            >>> from omni.data_classes import EmptyWrite
            >>> client = OmniClient()
            >>> empty = EmptyWrite(external_id="my_empty", ...)
            >>> result = client.empty.apply(empty)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.empty.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(empty, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more empty.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the empty to delete.

required
space str

The space where all the empty are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete empty by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.empty.delete("my_empty")
Source code in examples/omni/_api/empty.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more empty.

    Args:
        external_id: External id of the empty to delete.
        space: The space where all the empty are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete empty by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.empty.delete("my_empty")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.empty.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for empties

Parameters:

Name Type Description Default
property EmptyFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property EmptyTextFields | SequenceNotStr[EmptyTextFields] | None

The text field to search in.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/empty.py
def histogram(
    self,
    property: EmptyFields,
    interval: float,
    query: str | None = None,
    search_property: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for empties

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_empty_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter empties

Parameters:

Name Type Description Default
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by EmptyFields | Sequence[EmptyFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
EmptyList

List of requested empties

Examples:

List empties and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> empties = client.empty.list(limit=5)
Source code in examples/omni/_api/empty.py
def list(
    self,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: EmptyFields | Sequence[EmptyFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> EmptyList:
    """List/filter empties

    Args:
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested empties

    Examples:

        List empties and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> empties = client.empty.list(limit=5)

    """
    filter_ = _create_empty_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for empties.

Source code in examples/omni/_api/empty.py
def query(self) -> EmptyQuery:
    """Start a query for empties."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return EmptyQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Empty | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> EmptyList

Retrieve one or more empties by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the empties.

required
space str

The space where all the empties are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
Empty | EmptyList | None

The requested empties.

Examples:

Retrieve empty by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> empty = client.empty.retrieve("my_empty")
Source code in examples/omni/_api/empty.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> Empty | EmptyList | None:
    """Retrieve one or more empties by id(s).

    Args:
        external_id: External id or list of external ids of the empties.
        space: The space where all the empties are located.

    Returns:
        The requested empties.

    Examples:

        Retrieve empty by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> empty = client.empty.retrieve("my_empty")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search empties

Parameters:

Name Type Description Default
query str

The search query,

required
properties EmptyTextFields | SequenceNotStr[EmptyTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by EmptyFields | SequenceNotStr[EmptyFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
EmptyList

Search results empties matching the query.

Examples:

Search for 'my_empty' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> empties = client.empty.search('my_empty')
Source code in examples/omni/_api/empty.py
def search(
    self,
    query: str,
    properties: EmptyTextFields | SequenceNotStr[EmptyTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: EmptyFields | SequenceNotStr[EmptyFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> EmptyList:
    """Search empties

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of empties to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results empties matching the query.

    Examples:

       Search for 'my_empty' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> empties = client.empty.search('my_empty')

    """
    filter_ = _create_empty_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

EmptyQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/empty_query.py
class EmptyQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "Empty", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=Empty,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/empty_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

Implementation1API

Bases: NodeAPI[Implementation1, Implementation1Write, Implementation1List, Implementation1WriteList]

Source code in examples/omni/_api/implementation_1.py
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
class Implementation1API(NodeAPI[Implementation1, Implementation1Write, Implementation1List, Implementation1WriteList]):
    _view_id = dm.ViewId("pygen-models", "Implementation1", "1")
    _properties_by_field = _IMPLEMENTATION1_PROPERTIES_BY_FIELD
    _class_type = Implementation1
    _class_list = Implementation1List
    _class_write_list = Implementation1WriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> Implementation1QueryAPI[Implementation1List]:
        """Query starting at implementation 1.

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            value_2: The value 2 to filter on.
            value_2_prefix: The prefix of the value 2 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for implementation 1.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_implementation_1_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            value_2,
            value_2_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(Implementation1List)
        return Implementation1QueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        implementation_1: Implementation1Write | Sequence[Implementation1Write],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) implementation 1.

        Args:
            implementation_1: Implementation 1 or sequence of implementation 1 to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new implementation_1:

                >>> from omni import OmniClient
                >>> from omni.data_classes import Implementation1Write
                >>> client = OmniClient()
                >>> implementation_1 = Implementation1Write(external_id="my_implementation_1", ...)
                >>> result = client.implementation_1.apply(implementation_1)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.implementation_1.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(implementation_1, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more implementation 1.

        Args:
            external_id: External id of the implementation 1 to delete.
            space: The space where all the implementation 1 are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete implementation_1 by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.implementation_1.delete("my_implementation_1")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.implementation_1.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Implementation1 | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> Implementation1List: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> Implementation1 | Implementation1List | None:
        """Retrieve one or more implementation 1 by id(s).

        Args:
            external_id: External id or list of external ids of the implementation 1.
            space: The space where all the implementation 1 are located.

        Returns:
            The requested implementation 1.

        Examples:

            Retrieve implementation_1 by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_1 = client.implementation_1.retrieve("my_implementation_1")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> Implementation1List:
        """Search implementation 1

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            value_2: The value 2 to filter on.
            value_2_prefix: The prefix of the value 2 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results implementation 1 matching the query.

        Examples:

           Search for 'my_implementation_1' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_1_list = client.implementation_1.search('my_implementation_1')

        """
        filter_ = _create_implementation_1_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            value_2,
            value_2_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
        query: str | None = None,
        search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
        query: str | None = None,
        search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: Implementation1Fields | SequenceNotStr[Implementation1Fields],
        property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
        query: str | None = None,
        search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
        property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
        query: str | None = None,
        search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across implementation 1

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            value_2: The value 2 to filter on.
            value_2_prefix: The prefix of the value 2 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count implementation 1 in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.implementation_1.aggregate("count", space="my_space")

        """

        filter_ = _create_implementation_1_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            value_2,
            value_2_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: Implementation1Fields,
        interval: float,
        query: str | None = None,
        search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for implementation 1

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            value_2: The value 2 to filter on.
            value_2_prefix: The prefix of the value 2 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_implementation_1_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            value_2,
            value_2_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> Implementation1Query:
        """Start a query for implementation 1."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return Implementation1Query(self._client)

    def list(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        value_2: str | list[str] | None = None,
        value_2_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: Implementation1Fields | Sequence[Implementation1Fields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> Implementation1List:
        """List/filter implementation 1

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            value_2: The value 2 to filter on.
            value_2_prefix: The prefix of the value 2 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested implementation 1

        Examples:

            List implementation 1 and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_1_list = client.implementation_1.list(limit=5)

        """
        filter_ = _create_implementation_1_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            value_2,
            value_2_prefix,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, value_2=None, value_2_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at implementation 1.

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
value_2 str | list[str] | None

The value 2 to filter on.

None
value_2_prefix str | None

The prefix of the value 2 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
Implementation1QueryAPI[Implementation1List]

A query API for implementation 1.

Source code in examples/omni/_api/implementation_1.py
def __call__(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    value_2: str | list[str] | None = None,
    value_2_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> Implementation1QueryAPI[Implementation1List]:
    """Query starting at implementation 1.

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        value_2: The value 2 to filter on.
        value_2_prefix: The prefix of the value 2 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for implementation 1.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_implementation_1_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        value_2,
        value_2_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(Implementation1List)
    return Implementation1QueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, value_2=None, value_2_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None, query: str | None = None, search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, value_1: str | list[str] | None = None, value_1_prefix: str | None = None, value_2: str | list[str] | None = None, value_2_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None, query: str | None = None, search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, value_1: str | list[str] | None = None, value_1_prefix: str | None = None, value_2: str | list[str] | None = None, value_2_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: Implementation1Fields | SequenceNotStr[Implementation1Fields], property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None, query: str | None = None, search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, value_1: str | list[str] | None = None, value_1_prefix: str | None = None, value_2: str | list[str] | None = None, value_2_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across implementation 1

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by Implementation1Fields | SequenceNotStr[Implementation1Fields] | None

The property to group by when doing the aggregation.

None
property Implementation1Fields | SequenceNotStr[Implementation1Fields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
value_2 str | list[str] | None

The value 2 to filter on.

None
value_2_prefix str | None

The prefix of the value 2 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count implementation 1 in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.implementation_1.aggregate("count", space="my_space")
Source code in examples/omni/_api/implementation_1.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
    property: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
    query: str | None = None,
    search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    value_2: str | list[str] | None = None,
    value_2_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across implementation 1

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        value_2: The value 2 to filter on.
        value_2_prefix: The prefix of the value 2 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count implementation 1 in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.implementation_1.aggregate("count", space="my_space")

    """

    filter_ = _create_implementation_1_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        value_2,
        value_2_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(implementation_1, replace=False, write_none=False)

Add or update (upsert) implementation 1.

Parameters:

Name Type Description Default
implementation_1 Implementation1Write | Sequence[Implementation1Write]

Implementation 1 or sequence of implementation 1 to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new implementation_1:

    >>> from omni import OmniClient
    >>> from omni.data_classes import Implementation1Write
    >>> client = OmniClient()
    >>> implementation_1 = Implementation1Write(external_id="my_implementation_1", ...)
    >>> result = client.implementation_1.apply(implementation_1)
Source code in examples/omni/_api/implementation_1.py
def apply(
    self,
    implementation_1: Implementation1Write | Sequence[Implementation1Write],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) implementation 1.

    Args:
        implementation_1: Implementation 1 or sequence of implementation 1 to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new implementation_1:

            >>> from omni import OmniClient
            >>> from omni.data_classes import Implementation1Write
            >>> client = OmniClient()
            >>> implementation_1 = Implementation1Write(external_id="my_implementation_1", ...)
            >>> result = client.implementation_1.apply(implementation_1)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.implementation_1.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(implementation_1, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more implementation 1.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the implementation 1 to delete.

required
space str

The space where all the implementation 1 are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete implementation_1 by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.implementation_1.delete("my_implementation_1")
Source code in examples/omni/_api/implementation_1.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more implementation 1.

    Args:
        external_id: External id of the implementation 1 to delete.
        space: The space where all the implementation 1 are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete implementation_1 by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.implementation_1.delete("my_implementation_1")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.implementation_1.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, value_2=None, value_2_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for implementation 1

Parameters:

Name Type Description Default
property Implementation1Fields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
value_2 str | list[str] | None

The value 2 to filter on.

None
value_2_prefix str | None

The prefix of the value 2 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/implementation_1.py
def histogram(
    self,
    property: Implementation1Fields,
    interval: float,
    query: str | None = None,
    search_property: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    value_2: str | list[str] | None = None,
    value_2_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for implementation 1

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        value_2: The value 2 to filter on.
        value_2_prefix: The prefix of the value 2 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_implementation_1_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        value_2,
        value_2_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, value_2=None, value_2_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter implementation 1

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
value_2 str | list[str] | None

The value 2 to filter on.

None
value_2_prefix str | None

The prefix of the value 2 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by Implementation1Fields | Sequence[Implementation1Fields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
Implementation1List

List of requested implementation 1

Examples:

List implementation 1 and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_1_list = client.implementation_1.list(limit=5)
Source code in examples/omni/_api/implementation_1.py
def list(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    value_2: str | list[str] | None = None,
    value_2_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: Implementation1Fields | Sequence[Implementation1Fields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> Implementation1List:
    """List/filter implementation 1

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        value_2: The value 2 to filter on.
        value_2_prefix: The prefix of the value 2 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested implementation 1

    Examples:

        List implementation 1 and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_1_list = client.implementation_1.list(limit=5)

    """
    filter_ = _create_implementation_1_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        value_2,
        value_2_prefix,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for implementation 1.

Source code in examples/omni/_api/implementation_1.py
def query(self) -> Implementation1Query:
    """Start a query for implementation 1."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return Implementation1Query(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Implementation1 | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> Implementation1List

Retrieve one or more implementation 1 by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the implementation 1.

required
space str

The space where all the implementation 1 are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
Implementation1 | Implementation1List | None

The requested implementation 1.

Examples:

Retrieve implementation_1 by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_1 = client.implementation_1.retrieve("my_implementation_1")
Source code in examples/omni/_api/implementation_1.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> Implementation1 | Implementation1List | None:
    """Retrieve one or more implementation 1 by id(s).

    Args:
        external_id: External id or list of external ids of the implementation 1.
        space: The space where all the implementation 1 are located.

    Returns:
        The requested implementation 1.

    Examples:

        Retrieve implementation_1 by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_1 = client.implementation_1.retrieve("my_implementation_1")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, value_2=None, value_2_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search implementation 1

Parameters:

Name Type Description Default
query str

The search query,

required
properties Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
value_2 str | list[str] | None

The value 2 to filter on.

None
value_2_prefix str | None

The prefix of the value 2 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by Implementation1Fields | SequenceNotStr[Implementation1Fields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
Implementation1List

Search results implementation 1 matching the query.

Examples:

Search for 'my_implementation_1' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_1_list = client.implementation_1.search('my_implementation_1')
Source code in examples/omni/_api/implementation_1.py
def search(
    self,
    query: str,
    properties: Implementation1TextFields | SequenceNotStr[Implementation1TextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    value_2: str | list[str] | None = None,
    value_2_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: Implementation1Fields | SequenceNotStr[Implementation1Fields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> Implementation1List:
    """Search implementation 1

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        value_2: The value 2 to filter on.
        value_2_prefix: The prefix of the value 2 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results implementation 1 matching the query.

    Examples:

       Search for 'my_implementation_1' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_1_list = client.implementation_1.search('my_implementation_1')

    """
    filter_ = _create_implementation_1_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        value_2,
        value_2_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

Implementation1NonWriteableAPI

Bases: NodeReadAPI[Implementation1NonWriteable, Implementation1NonWriteableList]

Source code in examples/omni/_api/implementation_1_non_writeable.py
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
class Implementation1NonWriteableAPI(NodeReadAPI[Implementation1NonWriteable, Implementation1NonWriteableList]):
    _view_id = dm.ViewId("pygen-models", "Implementation1NonWriteable", "1")
    _properties_by_field = _IMPLEMENTATION1NONWRITEABLE_PROPERTIES_BY_FIELD
    _class_type = Implementation1NonWriteable
    _class_list = Implementation1NonWriteableList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> Implementation1NonWriteableQueryAPI[Implementation1NonWriteableList]:
        """Query starting at implementation 1 non writeables.

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for implementation 1 non writeables.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_implementation_1_non_writeable_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(Implementation1NonWriteableList)
        return Implementation1NonWriteableQueryAPI(self._client, builder, filter_, limit)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more implementation 1 non writeable.

        Args:
            external_id: External id of the implementation 1 non writeable to delete.
            space: The space where all the implementation 1 non writeable are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete implementation_1_non_writeable by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.implementation_1_non_writeable.delete("my_implementation_1_non_writeable")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.implementation_1_non_writeable.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Implementation1NonWriteable | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> Implementation1NonWriteableList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> Implementation1NonWriteable | Implementation1NonWriteableList | None:
        """Retrieve one or more implementation 1 non writeables by id(s).

        Args:
            external_id: External id or list of external ids of the implementation 1 non writeables.
            space: The space where all the implementation 1 non writeables are located.

        Returns:
            The requested implementation 1 non writeables.

        Examples:

            Retrieve implementation_1_non_writeable by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_1_non_writeable = client.implementation_1_non_writeable.retrieve("my_implementation_1_non_writeable")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: (
            Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
        ) = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> Implementation1NonWriteableList:
        """Search implementation 1 non writeables

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results implementation 1 non writeables matching the query.

        Examples:

           Search for 'my_implementation_1_non_writeable' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_1_non_writeables = client.implementation_1_non_writeable.search('my_implementation_1_non_writeable')

        """
        filter_ = _create_implementation_1_non_writeable_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
        query: str | None = None,
        search_property: (
            Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
        ) = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
        query: str | None = None,
        search_property: (
            Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
        ) = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields],
        property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
        query: str | None = None,
        search_property: (
            Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
        ) = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
        property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
        query: str | None = None,
        search_property: (
            Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
        ) = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across implementation 1 non writeables

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count implementation 1 non writeables in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.implementation_1_non_writeable.aggregate("count", space="my_space")

        """

        filter_ = _create_implementation_1_non_writeable_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: Implementation1NonWriteableFields,
        interval: float,
        query: str | None = None,
        search_property: (
            Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
        ) = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for implementation 1 non writeables

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_implementation_1_non_writeable_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> Implementation1NonWriteableQuery:
        """Start a query for implementation 1 non writeables."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return Implementation1NonWriteableQuery(self._client)

    def list(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        value_1: str | list[str] | None = None,
        value_1_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: Implementation1NonWriteableFields | Sequence[Implementation1NonWriteableFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> Implementation1NonWriteableList:
        """List/filter implementation 1 non writeables

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            value_1: The value 1 to filter on.
            value_1_prefix: The prefix of the value 1 to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested implementation 1 non writeables

        Examples:

            List implementation 1 non writeables and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_1_non_writeables = client.implementation_1_non_writeable.list(limit=5)

        """
        filter_ = _create_implementation_1_non_writeable_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            value_1,
            value_1_prefix,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at implementation 1 non writeables.

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
Implementation1NonWriteableQueryAPI[Implementation1NonWriteableList]

A query API for implementation 1 non writeables.

Source code in examples/omni/_api/implementation_1_non_writeable.py
def __call__(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> Implementation1NonWriteableQueryAPI[Implementation1NonWriteableList]:
    """Query starting at implementation 1 non writeables.

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for implementation 1 non writeables.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_implementation_1_non_writeable_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(Implementation1NonWriteableList)
    return Implementation1NonWriteableQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None, query: str | None = None, search_property: Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, value_1: str | list[str] | None = None, value_1_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None, query: str | None = None, search_property: Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, value_1: str | list[str] | None = None, value_1_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields], property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None, query: str | None = None, search_property: Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, value_1: str | list[str] | None = None, value_1_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across implementation 1 non writeables

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None

The property to group by when doing the aggregation.

None
property Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count implementation 1 non writeables in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.implementation_1_non_writeable.aggregate("count", space="my_space")
Source code in examples/omni/_api/implementation_1_non_writeable.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
    property: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
    query: str | None = None,
    search_property: (
        Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
    ) = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across implementation 1 non writeables

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count implementation 1 non writeables in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.implementation_1_non_writeable.aggregate("count", space="my_space")

    """

    filter_ = _create_implementation_1_non_writeable_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more implementation 1 non writeable.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the implementation 1 non writeable to delete.

required
space str

The space where all the implementation 1 non writeable are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete implementation_1_non_writeable by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.implementation_1_non_writeable.delete("my_implementation_1_non_writeable")
Source code in examples/omni/_api/implementation_1_non_writeable.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more implementation 1 non writeable.

    Args:
        external_id: External id of the implementation 1 non writeable to delete.
        space: The space where all the implementation 1 non writeable are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete implementation_1_non_writeable by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.implementation_1_non_writeable.delete("my_implementation_1_non_writeable")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.implementation_1_non_writeable.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for implementation 1 non writeables

Parameters:

Name Type Description Default
property Implementation1NonWriteableFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/implementation_1_non_writeable.py
def histogram(
    self,
    property: Implementation1NonWriteableFields,
    interval: float,
    query: str | None = None,
    search_property: (
        Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
    ) = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for implementation 1 non writeables

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_implementation_1_non_writeable_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter implementation 1 non writeables

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by Implementation1NonWriteableFields | Sequence[Implementation1NonWriteableFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
Implementation1NonWriteableList

List of requested implementation 1 non writeables

Examples:

List implementation 1 non writeables and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_1_non_writeables = client.implementation_1_non_writeable.list(limit=5)
Source code in examples/omni/_api/implementation_1_non_writeable.py
def list(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: Implementation1NonWriteableFields | Sequence[Implementation1NonWriteableFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> Implementation1NonWriteableList:
    """List/filter implementation 1 non writeables

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested implementation 1 non writeables

    Examples:

        List implementation 1 non writeables and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_1_non_writeables = client.implementation_1_non_writeable.list(limit=5)

    """
    filter_ = _create_implementation_1_non_writeable_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for implementation 1 non writeables.

Source code in examples/omni/_api/implementation_1_non_writeable.py
def query(self) -> Implementation1NonWriteableQuery:
    """Start a query for implementation 1 non writeables."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return Implementation1NonWriteableQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Implementation1NonWriteable | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> Implementation1NonWriteableList

Retrieve one or more implementation 1 non writeables by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the implementation 1 non writeables.

required
space str

The space where all the implementation 1 non writeables are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
Implementation1NonWriteable | Implementation1NonWriteableList | None

The requested implementation 1 non writeables.

Examples:

Retrieve implementation_1_non_writeable by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_1_non_writeable = client.implementation_1_non_writeable.retrieve("my_implementation_1_non_writeable")
Source code in examples/omni/_api/implementation_1_non_writeable.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> Implementation1NonWriteable | Implementation1NonWriteableList | None:
    """Retrieve one or more implementation 1 non writeables by id(s).

    Args:
        external_id: External id or list of external ids of the implementation 1 non writeables.
        space: The space where all the implementation 1 non writeables are located.

    Returns:
        The requested implementation 1 non writeables.

    Examples:

        Retrieve implementation_1_non_writeable by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_1_non_writeable = client.implementation_1_non_writeable.retrieve("my_implementation_1_non_writeable")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, value_1=None, value_1_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search implementation 1 non writeables

Parameters:

Name Type Description Default
query str

The search query,

required
properties Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
value_1 str | list[str] | None

The value 1 to filter on.

None
value_1_prefix str | None

The prefix of the value 1 to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
Implementation1NonWriteableList

Search results implementation 1 non writeables matching the query.

Examples:

Search for 'my_implementation_1_non_writeable' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_1_non_writeables = client.implementation_1_non_writeable.search('my_implementation_1_non_writeable')
Source code in examples/omni/_api/implementation_1_non_writeable.py
def search(
    self,
    query: str,
    properties: (
        Implementation1NonWriteableTextFields | SequenceNotStr[Implementation1NonWriteableTextFields] | None
    ) = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    value_1: str | list[str] | None = None,
    value_1_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: Implementation1NonWriteableFields | SequenceNotStr[Implementation1NonWriteableFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> Implementation1NonWriteableList:
    """Search implementation 1 non writeables

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        value_1: The value 1 to filter on.
        value_1_prefix: The prefix of the value 1 to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 1 non writeables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results implementation 1 non writeables matching the query.

    Examples:

       Search for 'my_implementation_1_non_writeable' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_1_non_writeables = client.implementation_1_non_writeable.search('my_implementation_1_non_writeable')

    """
    filter_ = _create_implementation_1_non_writeable_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        value_1,
        value_1_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

Implementation1NonWriteableQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/implementation_1_non_writeable_query.py
class Implementation1NonWriteableQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "Implementation1NonWriteable", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=Implementation1NonWriteable,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/implementation_1_non_writeable_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

Implementation1QueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/implementation_1_query.py
class Implementation1QueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "Implementation1", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=Implementation1,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/implementation_1_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

Implementation2API

Bases: NodeAPI[Implementation2, Implementation2Write, Implementation2List, Implementation2WriteList]

Source code in examples/omni/_api/implementation_2.py
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
class Implementation2API(NodeAPI[Implementation2, Implementation2Write, Implementation2List, Implementation2WriteList]):
    _view_id = dm.ViewId("pygen-models", "Implementation2", "1")
    _properties_by_field = _IMPLEMENTATION2_PROPERTIES_BY_FIELD
    _class_type = Implementation2
    _class_list = Implementation2List
    _class_write_list = Implementation2WriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> Implementation2QueryAPI[Implementation2List]:
        """Query starting at implementation 2.

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for implementation 2.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_implementation_2_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(Implementation2List)
        return Implementation2QueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        implementation_2: Implementation2Write | Sequence[Implementation2Write],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) implementation 2.

        Args:
            implementation_2: Implementation 2 or sequence of implementation 2 to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new implementation_2:

                >>> from omni import OmniClient
                >>> from omni.data_classes import Implementation2Write
                >>> client = OmniClient()
                >>> implementation_2 = Implementation2Write(external_id="my_implementation_2", ...)
                >>> result = client.implementation_2.apply(implementation_2)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.implementation_2.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(implementation_2, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more implementation 2.

        Args:
            external_id: External id of the implementation 2 to delete.
            space: The space where all the implementation 2 are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete implementation_2 by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.implementation_2.delete("my_implementation_2")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.implementation_2.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Implementation2 | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> Implementation2List: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> Implementation2 | Implementation2List | None:
        """Retrieve one or more implementation 2 by id(s).

        Args:
            external_id: External id or list of external ids of the implementation 2.
            space: The space where all the implementation 2 are located.

        Returns:
            The requested implementation 2.

        Examples:

            Retrieve implementation_2 by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_2 = client.implementation_2.retrieve("my_implementation_2")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> Implementation2List:
        """Search implementation 2

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results implementation 2 matching the query.

        Examples:

           Search for 'my_implementation_2' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_2_list = client.implementation_2.search('my_implementation_2')

        """
        filter_ = _create_implementation_2_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
        query: str | None = None,
        search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
        query: str | None = None,
        search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: Implementation2Fields | SequenceNotStr[Implementation2Fields],
        property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
        query: str | None = None,
        search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
        property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
        query: str | None = None,
        search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across implementation 2

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count implementation 2 in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.implementation_2.aggregate("count", space="my_space")

        """

        filter_ = _create_implementation_2_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: Implementation2Fields,
        interval: float,
        query: str | None = None,
        search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for implementation 2

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_implementation_2_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> Implementation2Query:
        """Start a query for implementation 2."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return Implementation2Query(self._client)

    def list(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: Implementation2Fields | Sequence[Implementation2Fields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> Implementation2List:
        """List/filter implementation 2

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested implementation 2

        Examples:

            List implementation 2 and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> implementation_2_list = client.implementation_2.list(limit=5)

        """
        filter_ = _create_implementation_2_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at implementation 2.

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
Implementation2QueryAPI[Implementation2List]

A query API for implementation 2.

Source code in examples/omni/_api/implementation_2.py
def __call__(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> Implementation2QueryAPI[Implementation2List]:
    """Query starting at implementation 2.

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for implementation 2.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_implementation_2_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(Implementation2List)
    return Implementation2QueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None, query: str | None = None, search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None, query: str | None = None, search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: Implementation2Fields | SequenceNotStr[Implementation2Fields], property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None, query: str | None = None, search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across implementation 2

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by Implementation2Fields | SequenceNotStr[Implementation2Fields] | None

The property to group by when doing the aggregation.

None
property Implementation2Fields | SequenceNotStr[Implementation2Fields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count implementation 2 in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.implementation_2.aggregate("count", space="my_space")
Source code in examples/omni/_api/implementation_2.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
    property: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
    query: str | None = None,
    search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across implementation 2

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count implementation 2 in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.implementation_2.aggregate("count", space="my_space")

    """

    filter_ = _create_implementation_2_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(implementation_2, replace=False, write_none=False)

Add or update (upsert) implementation 2.

Parameters:

Name Type Description Default
implementation_2 Implementation2Write | Sequence[Implementation2Write]

Implementation 2 or sequence of implementation 2 to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new implementation_2:

    >>> from omni import OmniClient
    >>> from omni.data_classes import Implementation2Write
    >>> client = OmniClient()
    >>> implementation_2 = Implementation2Write(external_id="my_implementation_2", ...)
    >>> result = client.implementation_2.apply(implementation_2)
Source code in examples/omni/_api/implementation_2.py
def apply(
    self,
    implementation_2: Implementation2Write | Sequence[Implementation2Write],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) implementation 2.

    Args:
        implementation_2: Implementation 2 or sequence of implementation 2 to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new implementation_2:

            >>> from omni import OmniClient
            >>> from omni.data_classes import Implementation2Write
            >>> client = OmniClient()
            >>> implementation_2 = Implementation2Write(external_id="my_implementation_2", ...)
            >>> result = client.implementation_2.apply(implementation_2)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.implementation_2.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(implementation_2, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more implementation 2.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the implementation 2 to delete.

required
space str

The space where all the implementation 2 are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete implementation_2 by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.implementation_2.delete("my_implementation_2")
Source code in examples/omni/_api/implementation_2.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more implementation 2.

    Args:
        external_id: External id of the implementation 2 to delete.
        space: The space where all the implementation 2 are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete implementation_2 by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.implementation_2.delete("my_implementation_2")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.implementation_2.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for implementation 2

Parameters:

Name Type Description Default
property Implementation2Fields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/implementation_2.py
def histogram(
    self,
    property: Implementation2Fields,
    interval: float,
    query: str | None = None,
    search_property: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for implementation 2

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_implementation_2_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter implementation 2

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by Implementation2Fields | Sequence[Implementation2Fields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
Implementation2List

List of requested implementation 2

Examples:

List implementation 2 and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_2_list = client.implementation_2.list(limit=5)
Source code in examples/omni/_api/implementation_2.py
def list(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: Implementation2Fields | Sequence[Implementation2Fields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> Implementation2List:
    """List/filter implementation 2

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested implementation 2

    Examples:

        List implementation 2 and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_2_list = client.implementation_2.list(limit=5)

    """
    filter_ = _create_implementation_2_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for implementation 2.

Source code in examples/omni/_api/implementation_2.py
def query(self) -> Implementation2Query:
    """Start a query for implementation 2."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return Implementation2Query(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> Implementation2 | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> Implementation2List

Retrieve one or more implementation 2 by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the implementation 2.

required
space str

The space where all the implementation 2 are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
Implementation2 | Implementation2List | None

The requested implementation 2.

Examples:

Retrieve implementation_2 by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_2 = client.implementation_2.retrieve("my_implementation_2")
Source code in examples/omni/_api/implementation_2.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> Implementation2 | Implementation2List | None:
    """Retrieve one or more implementation 2 by id(s).

    Args:
        external_id: External id or list of external ids of the implementation 2.
        space: The space where all the implementation 2 are located.

    Returns:
        The requested implementation 2.

    Examples:

        Retrieve implementation_2 by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_2 = client.implementation_2.retrieve("my_implementation_2")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search implementation 2

Parameters:

Name Type Description Default
query str

The search query,

required
properties Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by Implementation2Fields | SequenceNotStr[Implementation2Fields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
Implementation2List

Search results implementation 2 matching the query.

Examples:

Search for 'my_implementation_2' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> implementation_2_list = client.implementation_2.search('my_implementation_2')
Source code in examples/omni/_api/implementation_2.py
def search(
    self,
    query: str,
    properties: Implementation2TextFields | SequenceNotStr[Implementation2TextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: Implementation2Fields | SequenceNotStr[Implementation2Fields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> Implementation2List:
    """Search implementation 2

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of implementation 2 to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results implementation 2 matching the query.

    Examples:

       Search for 'my_implementation_2' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> implementation_2_list = client.implementation_2.search('my_implementation_2')

    """
    filter_ = _create_implementation_2_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

Implementation2QueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/implementation_2_query.py
class Implementation2QueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "Implementation2", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=Implementation2,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/implementation_2_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

MainInterfaceAPI

Bases: NodeAPI[MainInterface, MainInterfaceWrite, MainInterfaceList, MainInterfaceWriteList]

Source code in examples/omni/_api/main_interface.py
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
class MainInterfaceAPI(NodeAPI[MainInterface, MainInterfaceWrite, MainInterfaceList, MainInterfaceWriteList]):
    _view_id = dm.ViewId("pygen-models", "MainInterface", "1")
    _properties_by_field = _MAININTERFACE_PROPERTIES_BY_FIELD
    _direct_children_by_external_id = {
        "Implementation1": Implementation1,
        "SubInterface": SubInterface,
    }
    _class_type = MainInterface
    _class_list = MainInterfaceList
    _class_write_list = MainInterfaceWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> MainInterfaceQueryAPI[MainInterfaceList]:
        """Query starting at main interfaces.

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for main interfaces.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_main_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(MainInterfaceList)
        return MainInterfaceQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        main_interface: MainInterfaceWrite | Sequence[MainInterfaceWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) main interfaces.

        Args:
            main_interface: Main interface or sequence of main interfaces to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new main_interface:

                >>> from omni import OmniClient
                >>> from omni.data_classes import MainInterfaceWrite
                >>> client = OmniClient()
                >>> main_interface = MainInterfaceWrite(external_id="my_main_interface", ...)
                >>> result = client.main_interface.apply(main_interface)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.main_interface.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(main_interface, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more main interface.

        Args:
            external_id: External id of the main interface to delete.
            space: The space where all the main interface are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete main_interface by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.main_interface.delete("my_main_interface")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.main_interface.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(
        self,
        external_id: str,
        space: str = DEFAULT_INSTANCE_SPACE,
        as_child_class: SequenceNotStr[Literal["Implementation1", "SubInterface"]] | None = None,
    ) -> MainInterface | None: ...

    @overload
    def retrieve(
        self,
        external_id: SequenceNotStr[str],
        space: str = DEFAULT_INSTANCE_SPACE,
        as_child_class: SequenceNotStr[Literal["Implementation1", "SubInterface"]] | None = None,
    ) -> MainInterfaceList: ...

    def retrieve(
        self,
        external_id: str | SequenceNotStr[str],
        space: str = DEFAULT_INSTANCE_SPACE,
        as_child_class: SequenceNotStr[Literal["Implementation1", "SubInterface"]] | None = None,
    ) -> MainInterface | MainInterfaceList | None:
        """Retrieve one or more main interfaces by id(s).

        Args:
            external_id: External id or list of external ids of the main interfaces.
            space: The space where all the main interfaces are located.
            as_child_class: If you want to retrieve the main interfaces as a child class,
                you can specify the child class here. Note that if one node has properties in
                multiple child classes, you will get duplicate nodes in the result.

        Returns:
            The requested main interfaces.

        Examples:

            Retrieve main_interface by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> main_interface = client.main_interface.retrieve("my_main_interface")

        """
        return self._retrieve(external_id, space, as_child_class=as_child_class)

    def search(
        self,
        query: str,
        properties: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> MainInterfaceList:
        """Search main interfaces

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results main interfaces matching the query.

        Examples:

           Search for 'my_main_interface' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> main_interfaces = client.main_interface.search('my_main_interface')

        """
        filter_ = _create_main_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
        query: str | None = None,
        search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
        query: str | None = None,
        search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: MainInterfaceFields | SequenceNotStr[MainInterfaceFields],
        property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
        query: str | None = None,
        search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
        property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
        query: str | None = None,
        search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across main interfaces

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count main interfaces in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.main_interface.aggregate("count", space="my_space")

        """

        filter_ = _create_main_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: MainInterfaceFields,
        interval: float,
        query: str | None = None,
        search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for main interfaces

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_main_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> MainInterfaceQuery:
        """Start a query for main interfaces."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return MainInterfaceQuery(self._client)

    def list(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: MainInterfaceFields | Sequence[MainInterfaceFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> MainInterfaceList:
        """List/filter main interfaces

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested main interfaces

        Examples:

            List main interfaces and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> main_interfaces = client.main_interface.list(limit=5)

        """
        filter_ = _create_main_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(main_value=None, main_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at main interfaces.

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
MainInterfaceQueryAPI[MainInterfaceList]

A query API for main interfaces.

Source code in examples/omni/_api/main_interface.py
def __call__(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> MainInterfaceQueryAPI[MainInterfaceList]:
    """Query starting at main interfaces.

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for main interfaces.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_main_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(MainInterfaceList)
    return MainInterfaceQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, main_value=None, main_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None, query: str | None = None, search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None, query: str | None = None, search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: MainInterfaceFields | SequenceNotStr[MainInterfaceFields], property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None, query: str | None = None, search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across main interfaces

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None

The property to group by when doing the aggregation.

None
property MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count main interfaces in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.main_interface.aggregate("count", space="my_space")
Source code in examples/omni/_api/main_interface.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
    property: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
    query: str | None = None,
    search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across main interfaces

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count main interfaces in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.main_interface.aggregate("count", space="my_space")

    """

    filter_ = _create_main_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(main_interface, replace=False, write_none=False)

Add or update (upsert) main interfaces.

Parameters:

Name Type Description Default
main_interface MainInterfaceWrite | Sequence[MainInterfaceWrite]

Main interface or sequence of main interfaces to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new main_interface:

    >>> from omni import OmniClient
    >>> from omni.data_classes import MainInterfaceWrite
    >>> client = OmniClient()
    >>> main_interface = MainInterfaceWrite(external_id="my_main_interface", ...)
    >>> result = client.main_interface.apply(main_interface)
Source code in examples/omni/_api/main_interface.py
def apply(
    self,
    main_interface: MainInterfaceWrite | Sequence[MainInterfaceWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) main interfaces.

    Args:
        main_interface: Main interface or sequence of main interfaces to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new main_interface:

            >>> from omni import OmniClient
            >>> from omni.data_classes import MainInterfaceWrite
            >>> client = OmniClient()
            >>> main_interface = MainInterfaceWrite(external_id="my_main_interface", ...)
            >>> result = client.main_interface.apply(main_interface)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.main_interface.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(main_interface, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more main interface.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the main interface to delete.

required
space str

The space where all the main interface are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete main_interface by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.main_interface.delete("my_main_interface")
Source code in examples/omni/_api/main_interface.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more main interface.

    Args:
        external_id: External id of the main interface to delete.
        space: The space where all the main interface are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete main_interface by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.main_interface.delete("my_main_interface")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.main_interface.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, main_value=None, main_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for main interfaces

Parameters:

Name Type Description Default
property MainInterfaceFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/main_interface.py
def histogram(
    self,
    property: MainInterfaceFields,
    interval: float,
    query: str | None = None,
    search_property: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for main interfaces

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_main_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(main_value=None, main_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter main interfaces

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by MainInterfaceFields | Sequence[MainInterfaceFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
MainInterfaceList

List of requested main interfaces

Examples:

List main interfaces and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> main_interfaces = client.main_interface.list(limit=5)
Source code in examples/omni/_api/main_interface.py
def list(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: MainInterfaceFields | Sequence[MainInterfaceFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> MainInterfaceList:
    """List/filter main interfaces

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested main interfaces

    Examples:

        List main interfaces and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> main_interfaces = client.main_interface.list(limit=5)

    """
    filter_ = _create_main_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for main interfaces.

Source code in examples/omni/_api/main_interface.py
def query(self) -> MainInterfaceQuery:
    """Start a query for main interfaces."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return MainInterfaceQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE, as_child_class=None)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE, as_child_class: SequenceNotStr[Literal['Implementation1', 'SubInterface']] | None = None) -> MainInterface | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE, as_child_class: SequenceNotStr[Literal['Implementation1', 'SubInterface']] | None = None) -> MainInterfaceList

Retrieve one or more main interfaces by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the main interfaces.

required
space str

The space where all the main interfaces are located.

DEFAULT_INSTANCE_SPACE
as_child_class SequenceNotStr[Literal['Implementation1', 'SubInterface']] | None

If you want to retrieve the main interfaces as a child class, you can specify the child class here. Note that if one node has properties in multiple child classes, you will get duplicate nodes in the result.

None

Returns:

Type Description
MainInterface | MainInterfaceList | None

The requested main interfaces.

Examples:

Retrieve main_interface by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> main_interface = client.main_interface.retrieve("my_main_interface")
Source code in examples/omni/_api/main_interface.py
def retrieve(
    self,
    external_id: str | SequenceNotStr[str],
    space: str = DEFAULT_INSTANCE_SPACE,
    as_child_class: SequenceNotStr[Literal["Implementation1", "SubInterface"]] | None = None,
) -> MainInterface | MainInterfaceList | None:
    """Retrieve one or more main interfaces by id(s).

    Args:
        external_id: External id or list of external ids of the main interfaces.
        space: The space where all the main interfaces are located.
        as_child_class: If you want to retrieve the main interfaces as a child class,
            you can specify the child class here. Note that if one node has properties in
            multiple child classes, you will get duplicate nodes in the result.

    Returns:
        The requested main interfaces.

    Examples:

        Retrieve main_interface by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> main_interface = client.main_interface.retrieve("my_main_interface")

    """
    return self._retrieve(external_id, space, as_child_class=as_child_class)

search(query, properties=None, main_value=None, main_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search main interfaces

Parameters:

Name Type Description Default
query str

The search query,

required
properties MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
MainInterfaceList

Search results main interfaces matching the query.

Examples:

Search for 'my_main_interface' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> main_interfaces = client.main_interface.search('my_main_interface')
Source code in examples/omni/_api/main_interface.py
def search(
    self,
    query: str,
    properties: MainInterfaceTextFields | SequenceNotStr[MainInterfaceTextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: MainInterfaceFields | SequenceNotStr[MainInterfaceFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> MainInterfaceList:
    """Search main interfaces

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of main interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results main interfaces matching the query.

    Examples:

       Search for 'my_main_interface' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> main_interfaces = client.main_interface.search('my_main_interface')

    """
    filter_ = _create_main_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

MainInterfaceQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/main_interface_query.py
class MainInterfaceQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "MainInterface", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=MainInterface,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/main_interface_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

PrimitiveNullableAPI

Bases: NodeAPI[PrimitiveNullable, PrimitiveNullableWrite, PrimitiveNullableList, PrimitiveNullableWriteList]

Source code in examples/omni/_api/primitive_nullable.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
class PrimitiveNullableAPI(
    NodeAPI[PrimitiveNullable, PrimitiveNullableWrite, PrimitiveNullableList, PrimitiveNullableWriteList]
):
    _view_id = dm.ViewId("pygen-models", "PrimitiveNullable", "1")
    _properties_by_field = _PRIMITIVENULLABLE_PROPERTIES_BY_FIELD
    _class_type = PrimitiveNullable
    _class_list = PrimitiveNullableList
    _class_write_list = PrimitiveNullableWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> PrimitiveNullableQueryAPI[PrimitiveNullableList]:
        """Query starting at primitive nullables.

        Args:
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for primitive nullables.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_primitive_nullable_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(PrimitiveNullableList)
        return PrimitiveNullableQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        primitive_nullable: PrimitiveNullableWrite | Sequence[PrimitiveNullableWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) primitive nullables.

        Args:
            primitive_nullable: Primitive nullable or sequence of primitive nullables to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new primitive_nullable:

                >>> from omni import OmniClient
                >>> from omni.data_classes import PrimitiveNullableWrite
                >>> client = OmniClient()
                >>> primitive_nullable = PrimitiveNullableWrite(external_id="my_primitive_nullable", ...)
                >>> result = client.primitive_nullable.apply(primitive_nullable)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.primitive_nullable.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(primitive_nullable, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more primitive nullable.

        Args:
            external_id: External id of the primitive nullable to delete.
            space: The space where all the primitive nullable are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete primitive_nullable by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.primitive_nullable.delete("my_primitive_nullable")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.primitive_nullable.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveNullable | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveNullableList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveNullable | PrimitiveNullableList | None:
        """Retrieve one or more primitive nullables by id(s).

        Args:
            external_id: External id or list of external ids of the primitive nullables.
            space: The space where all the primitive nullables are located.

        Returns:
            The requested primitive nullables.

        Examples:

            Retrieve primitive_nullable by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_nullable = client.primitive_nullable.retrieve("my_primitive_nullable")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveNullableList:
        """Search primitive nullables

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results primitive nullables matching the query.

        Examples:

           Search for 'my_primitive_nullable' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_nullables = client.primitive_nullable.search('my_primitive_nullable')

        """
        filter_ = _create_primitive_nullable_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields],
        property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
        property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across primitive nullables

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count primitive nullables in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.primitive_nullable.aggregate("count", space="my_space")

        """

        filter_ = _create_primitive_nullable_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: PrimitiveNullableFields,
        interval: float,
        query: str | None = None,
        search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for primitive nullables

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_primitive_nullable_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> PrimitiveNullableQuery:
        """Start a query for primitive nullables."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return PrimitiveNullableQuery(self._client)

    def list(
        self,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveNullableFields | Sequence[PrimitiveNullableFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveNullableList:
        """List/filter primitive nullables

        Args:
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested primitive nullables

        Examples:

            List primitive nullables and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_nullables = client.primitive_nullable.list(limit=5)

        """
        filter_ = _create_primitive_nullable_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at primitive nullables.

Parameters:

Name Type Description Default
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
PrimitiveNullableQueryAPI[PrimitiveNullableList]

A query API for primitive nullables.

Source code in examples/omni/_api/primitive_nullable.py
def __call__(
    self,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> PrimitiveNullableQueryAPI[PrimitiveNullableList]:
    """Query starting at primitive nullables.

    Args:
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for primitive nullables.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_primitive_nullable_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(PrimitiveNullableList)
    return PrimitiveNullableQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None, query: str | None = None, search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None, query: str | None = None, search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields], property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None, query: str | None = None, search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across primitive nullables

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None

The property to group by when doing the aggregation.

None
property PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None

The text field to search in.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count primitive nullables in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.primitive_nullable.aggregate("count", space="my_space")
Source code in examples/omni/_api/primitive_nullable.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
    property: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
    query: str | None = None,
    search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across primitive nullables

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count primitive nullables in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.primitive_nullable.aggregate("count", space="my_space")

    """

    filter_ = _create_primitive_nullable_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(primitive_nullable, replace=False, write_none=False)

Add or update (upsert) primitive nullables.

Parameters:

Name Type Description Default
primitive_nullable PrimitiveNullableWrite | Sequence[PrimitiveNullableWrite]

Primitive nullable or sequence of primitive nullables to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new primitive_nullable:

    >>> from omni import OmniClient
    >>> from omni.data_classes import PrimitiveNullableWrite
    >>> client = OmniClient()
    >>> primitive_nullable = PrimitiveNullableWrite(external_id="my_primitive_nullable", ...)
    >>> result = client.primitive_nullable.apply(primitive_nullable)
Source code in examples/omni/_api/primitive_nullable.py
def apply(
    self,
    primitive_nullable: PrimitiveNullableWrite | Sequence[PrimitiveNullableWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) primitive nullables.

    Args:
        primitive_nullable: Primitive nullable or sequence of primitive nullables to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new primitive_nullable:

            >>> from omni import OmniClient
            >>> from omni.data_classes import PrimitiveNullableWrite
            >>> client = OmniClient()
            >>> primitive_nullable = PrimitiveNullableWrite(external_id="my_primitive_nullable", ...)
            >>> result = client.primitive_nullable.apply(primitive_nullable)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.primitive_nullable.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(primitive_nullable, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more primitive nullable.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the primitive nullable to delete.

required
space str

The space where all the primitive nullable are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete primitive_nullable by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.primitive_nullable.delete("my_primitive_nullable")
Source code in examples/omni/_api/primitive_nullable.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more primitive nullable.

    Args:
        external_id: External id of the primitive nullable to delete.
        space: The space where all the primitive nullable are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete primitive_nullable by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.primitive_nullable.delete("my_primitive_nullable")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.primitive_nullable.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for primitive nullables

Parameters:

Name Type Description Default
property PrimitiveNullableFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None

The text field to search in.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/primitive_nullable.py
def histogram(
    self,
    property: PrimitiveNullableFields,
    interval: float,
    query: str | None = None,
    search_property: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for primitive nullables

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_primitive_nullable_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter primitive nullables

Parameters:

Name Type Description Default
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveNullableFields | Sequence[PrimitiveNullableFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveNullableList

List of requested primitive nullables

Examples:

List primitive nullables and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_nullables = client.primitive_nullable.list(limit=5)
Source code in examples/omni/_api/primitive_nullable.py
def list(
    self,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveNullableFields | Sequence[PrimitiveNullableFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveNullableList:
    """List/filter primitive nullables

    Args:
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested primitive nullables

    Examples:

        List primitive nullables and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_nullables = client.primitive_nullable.list(limit=5)

    """
    filter_ = _create_primitive_nullable_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for primitive nullables.

Source code in examples/omni/_api/primitive_nullable.py
def query(self) -> PrimitiveNullableQuery:
    """Start a query for primitive nullables."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return PrimitiveNullableQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveNullable | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveNullableList

Retrieve one or more primitive nullables by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the primitive nullables.

required
space str

The space where all the primitive nullables are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
PrimitiveNullable | PrimitiveNullableList | None

The requested primitive nullables.

Examples:

Retrieve primitive_nullable by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_nullable = client.primitive_nullable.retrieve("my_primitive_nullable")
Source code in examples/omni/_api/primitive_nullable.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> PrimitiveNullable | PrimitiveNullableList | None:
    """Retrieve one or more primitive nullables by id(s).

    Args:
        external_id: External id or list of external ids of the primitive nullables.
        space: The space where all the primitive nullables are located.

    Returns:
        The requested primitive nullables.

    Examples:

        Retrieve primitive_nullable by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_nullable = client.primitive_nullable.retrieve("my_primitive_nullable")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search primitive nullables

Parameters:

Name Type Description Default
query str

The search query,

required
properties PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveNullableList

Search results primitive nullables matching the query.

Examples:

Search for 'my_primitive_nullable' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_nullables = client.primitive_nullable.search('my_primitive_nullable')
Source code in examples/omni/_api/primitive_nullable.py
def search(
    self,
    query: str,
    properties: PrimitiveNullableTextFields | SequenceNotStr[PrimitiveNullableTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveNullableFields | SequenceNotStr[PrimitiveNullableFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveNullableList:
    """Search primitive nullables

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullables to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results primitive nullables matching the query.

    Examples:

       Search for 'my_primitive_nullable' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_nullables = client.primitive_nullable.search('my_primitive_nullable')

    """
    filter_ = _create_primitive_nullable_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

PrimitiveNullableListedAPI

Bases: NodeAPI[PrimitiveNullableListed, PrimitiveNullableListedWrite, PrimitiveNullableListedList, PrimitiveNullableListedWriteList]

Source code in examples/omni/_api/primitive_nullable_listed.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
class PrimitiveNullableListedAPI(
    NodeAPI[
        PrimitiveNullableListed,
        PrimitiveNullableListedWrite,
        PrimitiveNullableListedList,
        PrimitiveNullableListedWriteList,
    ]
):
    _view_id = dm.ViewId("pygen-models", "PrimitiveNullableListed", "1")
    _properties_by_field = _PRIMITIVENULLABLELISTED_PROPERTIES_BY_FIELD
    _class_type = PrimitiveNullableListed
    _class_list = PrimitiveNullableListedList
    _class_write_list = PrimitiveNullableListedWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> PrimitiveNullableListedQueryAPI[PrimitiveNullableListedList]:
        """Query starting at primitive nullable listeds.

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for primitive nullable listeds.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_primitive_nullable_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(PrimitiveNullableListedList)
        return PrimitiveNullableListedQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        primitive_nullable_listed: PrimitiveNullableListedWrite | Sequence[PrimitiveNullableListedWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) primitive nullable listeds.

        Args:
            primitive_nullable_listed: Primitive nullable listed or sequence of primitive nullable listeds to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new primitive_nullable_listed:

                >>> from omni import OmniClient
                >>> from omni.data_classes import PrimitiveNullableListedWrite
                >>> client = OmniClient()
                >>> primitive_nullable_listed = PrimitiveNullableListedWrite(external_id="my_primitive_nullable_listed", ...)
                >>> result = client.primitive_nullable_listed.apply(primitive_nullable_listed)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.primitive_nullable_listed.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(primitive_nullable_listed, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more primitive nullable listed.

        Args:
            external_id: External id of the primitive nullable listed to delete.
            space: The space where all the primitive nullable listed are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete primitive_nullable_listed by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.primitive_nullable_listed.delete("my_primitive_nullable_listed")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.primitive_nullable_listed.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveNullableListed | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveNullableListedList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveNullableListed | PrimitiveNullableListedList | None:
        """Retrieve one or more primitive nullable listeds by id(s).

        Args:
            external_id: External id or list of external ids of the primitive nullable listeds.
            space: The space where all the primitive nullable listeds are located.

        Returns:
            The requested primitive nullable listeds.

        Examples:

            Retrieve primitive_nullable_listed by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_nullable_listed = client.primitive_nullable_listed.retrieve("my_primitive_nullable_listed")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveNullableListedList:
        """Search primitive nullable listeds

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results primitive nullable listeds matching the query.

        Examples:

           Search for 'my_primitive_nullable_listed' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_nullable_listeds = client.primitive_nullable_listed.search('my_primitive_nullable_listed')

        """
        filter_ = _create_primitive_nullable_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields],
        property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
        property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across primitive nullable listeds

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count primitive nullable listeds in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.primitive_nullable_listed.aggregate("count", space="my_space")

        """

        filter_ = _create_primitive_nullable_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: PrimitiveNullableListedFields,
        interval: float,
        query: str | None = None,
        search_property: (
            PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for primitive nullable listeds

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_primitive_nullable_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> PrimitiveNullableListedQuery:
        """Start a query for primitive nullable listeds."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return PrimitiveNullableListedQuery(self._client)

    def list(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveNullableListedFields | Sequence[PrimitiveNullableListedFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveNullableListedList:
        """List/filter primitive nullable listeds

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested primitive nullable listeds

        Examples:

            List primitive nullable listeds and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_nullable_listeds = client.primitive_nullable_listed.list(limit=5)

        """
        filter_ = _create_primitive_nullable_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at primitive nullable listeds.

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
PrimitiveNullableListedQueryAPI[PrimitiveNullableListedList]

A query API for primitive nullable listeds.

Source code in examples/omni/_api/primitive_nullable_listed.py
def __call__(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> PrimitiveNullableListedQueryAPI[PrimitiveNullableListedList]:
    """Query starting at primitive nullable listeds.

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for primitive nullable listeds.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_primitive_nullable_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(PrimitiveNullableListedList)
    return PrimitiveNullableListedQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None, query: str | None = None, search_property: PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None, query: str | None = None, search_property: PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields], property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None, query: str | None = None, search_property: PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across primitive nullable listeds

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None

The property to group by when doing the aggregation.

None
property PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None

The text field to search in.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count primitive nullable listeds in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.primitive_nullable_listed.aggregate("count", space="my_space")
Source code in examples/omni/_api/primitive_nullable_listed.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
    property: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
    query: str | None = None,
    search_property: (
        PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across primitive nullable listeds

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count primitive nullable listeds in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.primitive_nullable_listed.aggregate("count", space="my_space")

    """

    filter_ = _create_primitive_nullable_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(primitive_nullable_listed, replace=False, write_none=False)

Add or update (upsert) primitive nullable listeds.

Parameters:

Name Type Description Default
primitive_nullable_listed PrimitiveNullableListedWrite | Sequence[PrimitiveNullableListedWrite]

Primitive nullable listed or sequence of primitive nullable listeds to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new primitive_nullable_listed:

    >>> from omni import OmniClient
    >>> from omni.data_classes import PrimitiveNullableListedWrite
    >>> client = OmniClient()
    >>> primitive_nullable_listed = PrimitiveNullableListedWrite(external_id="my_primitive_nullable_listed", ...)
    >>> result = client.primitive_nullable_listed.apply(primitive_nullable_listed)
Source code in examples/omni/_api/primitive_nullable_listed.py
def apply(
    self,
    primitive_nullable_listed: PrimitiveNullableListedWrite | Sequence[PrimitiveNullableListedWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) primitive nullable listeds.

    Args:
        primitive_nullable_listed: Primitive nullable listed or sequence of primitive nullable listeds to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new primitive_nullable_listed:

            >>> from omni import OmniClient
            >>> from omni.data_classes import PrimitiveNullableListedWrite
            >>> client = OmniClient()
            >>> primitive_nullable_listed = PrimitiveNullableListedWrite(external_id="my_primitive_nullable_listed", ...)
            >>> result = client.primitive_nullable_listed.apply(primitive_nullable_listed)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.primitive_nullable_listed.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(primitive_nullable_listed, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more primitive nullable listed.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the primitive nullable listed to delete.

required
space str

The space where all the primitive nullable listed are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete primitive_nullable_listed by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.primitive_nullable_listed.delete("my_primitive_nullable_listed")
Source code in examples/omni/_api/primitive_nullable_listed.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more primitive nullable listed.

    Args:
        external_id: External id of the primitive nullable listed to delete.
        space: The space where all the primitive nullable listed are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete primitive_nullable_listed by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.primitive_nullable_listed.delete("my_primitive_nullable_listed")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.primitive_nullable_listed.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for primitive nullable listeds

Parameters:

Name Type Description Default
property PrimitiveNullableListedFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None

The text field to search in.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/primitive_nullable_listed.py
def histogram(
    self,
    property: PrimitiveNullableListedFields,
    interval: float,
    query: str | None = None,
    search_property: (
        PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for primitive nullable listeds

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_primitive_nullable_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter primitive nullable listeds

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveNullableListedFields | Sequence[PrimitiveNullableListedFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveNullableListedList

List of requested primitive nullable listeds

Examples:

List primitive nullable listeds and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_nullable_listeds = client.primitive_nullable_listed.list(limit=5)
Source code in examples/omni/_api/primitive_nullable_listed.py
def list(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveNullableListedFields | Sequence[PrimitiveNullableListedFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveNullableListedList:
    """List/filter primitive nullable listeds

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested primitive nullable listeds

    Examples:

        List primitive nullable listeds and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_nullable_listeds = client.primitive_nullable_listed.list(limit=5)

    """
    filter_ = _create_primitive_nullable_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for primitive nullable listeds.

Source code in examples/omni/_api/primitive_nullable_listed.py
def query(self) -> PrimitiveNullableListedQuery:
    """Start a query for primitive nullable listeds."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return PrimitiveNullableListedQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveNullableListed | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveNullableListedList

Retrieve one or more primitive nullable listeds by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the primitive nullable listeds.

required
space str

The space where all the primitive nullable listeds are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
PrimitiveNullableListed | PrimitiveNullableListedList | None

The requested primitive nullable listeds.

Examples:

Retrieve primitive_nullable_listed by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_nullable_listed = client.primitive_nullable_listed.retrieve("my_primitive_nullable_listed")
Source code in examples/omni/_api/primitive_nullable_listed.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> PrimitiveNullableListed | PrimitiveNullableListedList | None:
    """Retrieve one or more primitive nullable listeds by id(s).

    Args:
        external_id: External id or list of external ids of the primitive nullable listeds.
        space: The space where all the primitive nullable listeds are located.

    Returns:
        The requested primitive nullable listeds.

    Examples:

        Retrieve primitive_nullable_listed by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_nullable_listed = client.primitive_nullable_listed.retrieve("my_primitive_nullable_listed")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search primitive nullable listeds

Parameters:

Name Type Description Default
query str

The search query,

required
properties PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveNullableListedList

Search results primitive nullable listeds matching the query.

Examples:

Search for 'my_primitive_nullable_listed' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_nullable_listeds = client.primitive_nullable_listed.search('my_primitive_nullable_listed')
Source code in examples/omni/_api/primitive_nullable_listed.py
def search(
    self,
    query: str,
    properties: PrimitiveNullableListedTextFields | SequenceNotStr[PrimitiveNullableListedTextFields] | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveNullableListedFields | SequenceNotStr[PrimitiveNullableListedFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveNullableListedList:
    """Search primitive nullable listeds

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive nullable listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results primitive nullable listeds matching the query.

    Examples:

       Search for 'my_primitive_nullable_listed' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_nullable_listeds = client.primitive_nullable_listed.search('my_primitive_nullable_listed')

    """
    filter_ = _create_primitive_nullable_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

PrimitiveNullableListedQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/primitive_nullable_listed_query.py
class PrimitiveNullableListedQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "PrimitiveNullableListed", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=PrimitiveNullableListed,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/primitive_nullable_listed_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

PrimitiveNullableQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/primitive_nullable_query.py
class PrimitiveNullableQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "PrimitiveNullable", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=PrimitiveNullable,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/primitive_nullable_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

PrimitiveRequiredAPI

Bases: NodeAPI[PrimitiveRequired, PrimitiveRequiredWrite, PrimitiveRequiredList, PrimitiveRequiredWriteList]

Source code in examples/omni/_api/primitive_required.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
class PrimitiveRequiredAPI(
    NodeAPI[PrimitiveRequired, PrimitiveRequiredWrite, PrimitiveRequiredList, PrimitiveRequiredWriteList]
):
    _view_id = dm.ViewId("pygen-models", "PrimitiveRequired", "1")
    _properties_by_field = _PRIMITIVEREQUIRED_PROPERTIES_BY_FIELD
    _class_type = PrimitiveRequired
    _class_list = PrimitiveRequiredList
    _class_write_list = PrimitiveRequiredWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> PrimitiveRequiredQueryAPI[PrimitiveRequiredList]:
        """Query starting at primitive requireds.

        Args:
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for primitive requireds.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_primitive_required_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(PrimitiveRequiredList)
        return PrimitiveRequiredQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        primitive_required: PrimitiveRequiredWrite | Sequence[PrimitiveRequiredWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) primitive requireds.

        Args:
            primitive_required: Primitive required or sequence of primitive requireds to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new primitive_required:

                >>> from omni import OmniClient
                >>> from omni.data_classes import PrimitiveRequiredWrite
                >>> client = OmniClient()
                >>> primitive_required = PrimitiveRequiredWrite(external_id="my_primitive_required", ...)
                >>> result = client.primitive_required.apply(primitive_required)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.primitive_required.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(primitive_required, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more primitive required.

        Args:
            external_id: External id of the primitive required to delete.
            space: The space where all the primitive required are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete primitive_required by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.primitive_required.delete("my_primitive_required")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.primitive_required.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveRequired | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveRequiredList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveRequired | PrimitiveRequiredList | None:
        """Retrieve one or more primitive requireds by id(s).

        Args:
            external_id: External id or list of external ids of the primitive requireds.
            space: The space where all the primitive requireds are located.

        Returns:
            The requested primitive requireds.

        Examples:

            Retrieve primitive_required by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_required = client.primitive_required.retrieve("my_primitive_required")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveRequiredList:
        """Search primitive requireds

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results primitive requireds matching the query.

        Examples:

           Search for 'my_primitive_required' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_requireds = client.primitive_required.search('my_primitive_required')

        """
        filter_ = _create_primitive_required_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields],
        property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
        property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
        query: str | None = None,
        search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across primitive requireds

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count primitive requireds in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.primitive_required.aggregate("count", space="my_space")

        """

        filter_ = _create_primitive_required_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: PrimitiveRequiredFields,
        interval: float,
        query: str | None = None,
        search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for primitive requireds

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_primitive_required_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> PrimitiveRequiredQuery:
        """Start a query for primitive requireds."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return PrimitiveRequiredQuery(self._client)

    def list(
        self,
        boolean: bool | None = None,
        min_date: datetime.date | None = None,
        max_date: datetime.date | None = None,
        min_float_32: float | None = None,
        max_float_32: float | None = None,
        min_float_64: float | None = None,
        max_float_64: float | None = None,
        min_int_32: int | None = None,
        max_int_32: int | None = None,
        min_int_64: int | None = None,
        max_int_64: int | None = None,
        text: str | list[str] | None = None,
        text_prefix: str | None = None,
        min_timestamp: datetime.datetime | None = None,
        max_timestamp: datetime.datetime | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveRequiredFields | Sequence[PrimitiveRequiredFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveRequiredList:
        """List/filter primitive requireds

        Args:
            boolean: The boolean to filter on.
            min_date: The minimum value of the date to filter on.
            max_date: The maximum value of the date to filter on.
            min_float_32: The minimum value of the float 32 to filter on.
            max_float_32: The maximum value of the float 32 to filter on.
            min_float_64: The minimum value of the float 64 to filter on.
            max_float_64: The maximum value of the float 64 to filter on.
            min_int_32: The minimum value of the int 32 to filter on.
            max_int_32: The maximum value of the int 32 to filter on.
            min_int_64: The minimum value of the int 64 to filter on.
            max_int_64: The maximum value of the int 64 to filter on.
            text: The text to filter on.
            text_prefix: The prefix of the text to filter on.
            min_timestamp: The minimum value of the timestamp to filter on.
            max_timestamp: The maximum value of the timestamp to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested primitive requireds

        Examples:

            List primitive requireds and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_requireds = client.primitive_required.list(limit=5)

        """
        filter_ = _create_primitive_required_filter(
            self._view_id,
            boolean,
            min_date,
            max_date,
            min_float_32,
            max_float_32,
            min_float_64,
            max_float_64,
            min_int_32,
            max_int_32,
            min_int_64,
            max_int_64,
            text,
            text_prefix,
            min_timestamp,
            max_timestamp,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at primitive requireds.

Parameters:

Name Type Description Default
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
PrimitiveRequiredQueryAPI[PrimitiveRequiredList]

A query API for primitive requireds.

Source code in examples/omni/_api/primitive_required.py
def __call__(
    self,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> PrimitiveRequiredQueryAPI[PrimitiveRequiredList]:
    """Query starting at primitive requireds.

    Args:
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for primitive requireds.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_primitive_required_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(PrimitiveRequiredList)
    return PrimitiveRequiredQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None, query: str | None = None, search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None, query: str | None = None, search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields], property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None, query: str | None = None, search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None, boolean: bool | None = None, min_date: datetime.date | None = None, max_date: datetime.date | None = None, min_float_32: float | None = None, max_float_32: float | None = None, min_float_64: float | None = None, max_float_64: float | None = None, min_int_32: int | None = None, max_int_32: int | None = None, min_int_64: int | None = None, max_int_64: int | None = None, text: str | list[str] | None = None, text_prefix: str | None = None, min_timestamp: datetime.datetime | None = None, max_timestamp: datetime.datetime | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across primitive requireds

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None

The property to group by when doing the aggregation.

None
property PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None

The text field to search in.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count primitive requireds in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.primitive_required.aggregate("count", space="my_space")
Source code in examples/omni/_api/primitive_required.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
    property: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
    query: str | None = None,
    search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across primitive requireds

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count primitive requireds in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.primitive_required.aggregate("count", space="my_space")

    """

    filter_ = _create_primitive_required_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(primitive_required, replace=False, write_none=False)

Add or update (upsert) primitive requireds.

Parameters:

Name Type Description Default
primitive_required PrimitiveRequiredWrite | Sequence[PrimitiveRequiredWrite]

Primitive required or sequence of primitive requireds to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new primitive_required:

    >>> from omni import OmniClient
    >>> from omni.data_classes import PrimitiveRequiredWrite
    >>> client = OmniClient()
    >>> primitive_required = PrimitiveRequiredWrite(external_id="my_primitive_required", ...)
    >>> result = client.primitive_required.apply(primitive_required)
Source code in examples/omni/_api/primitive_required.py
def apply(
    self,
    primitive_required: PrimitiveRequiredWrite | Sequence[PrimitiveRequiredWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) primitive requireds.

    Args:
        primitive_required: Primitive required or sequence of primitive requireds to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new primitive_required:

            >>> from omni import OmniClient
            >>> from omni.data_classes import PrimitiveRequiredWrite
            >>> client = OmniClient()
            >>> primitive_required = PrimitiveRequiredWrite(external_id="my_primitive_required", ...)
            >>> result = client.primitive_required.apply(primitive_required)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.primitive_required.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(primitive_required, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more primitive required.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the primitive required to delete.

required
space str

The space where all the primitive required are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete primitive_required by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.primitive_required.delete("my_primitive_required")
Source code in examples/omni/_api/primitive_required.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more primitive required.

    Args:
        external_id: External id of the primitive required to delete.
        space: The space where all the primitive required are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete primitive_required by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.primitive_required.delete("my_primitive_required")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.primitive_required.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for primitive requireds

Parameters:

Name Type Description Default
property PrimitiveRequiredFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None

The text field to search in.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/primitive_required.py
def histogram(
    self,
    property: PrimitiveRequiredFields,
    interval: float,
    query: str | None = None,
    search_property: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for primitive requireds

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_primitive_required_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter primitive requireds

Parameters:

Name Type Description Default
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveRequiredFields | Sequence[PrimitiveRequiredFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveRequiredList

List of requested primitive requireds

Examples:

List primitive requireds and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_requireds = client.primitive_required.list(limit=5)
Source code in examples/omni/_api/primitive_required.py
def list(
    self,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveRequiredFields | Sequence[PrimitiveRequiredFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveRequiredList:
    """List/filter primitive requireds

    Args:
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested primitive requireds

    Examples:

        List primitive requireds and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_requireds = client.primitive_required.list(limit=5)

    """
    filter_ = _create_primitive_required_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for primitive requireds.

Source code in examples/omni/_api/primitive_required.py
def query(self) -> PrimitiveRequiredQuery:
    """Start a query for primitive requireds."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return PrimitiveRequiredQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveRequired | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveRequiredList

Retrieve one or more primitive requireds by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the primitive requireds.

required
space str

The space where all the primitive requireds are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
PrimitiveRequired | PrimitiveRequiredList | None

The requested primitive requireds.

Examples:

Retrieve primitive_required by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_required = client.primitive_required.retrieve("my_primitive_required")
Source code in examples/omni/_api/primitive_required.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> PrimitiveRequired | PrimitiveRequiredList | None:
    """Retrieve one or more primitive requireds by id(s).

    Args:
        external_id: External id or list of external ids of the primitive requireds.
        space: The space where all the primitive requireds are located.

    Returns:
        The requested primitive requireds.

    Examples:

        Retrieve primitive_required by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_required = client.primitive_required.retrieve("my_primitive_required")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, boolean=None, min_date=None, max_date=None, min_float_32=None, max_float_32=None, min_float_64=None, max_float_64=None, min_int_32=None, max_int_32=None, min_int_64=None, max_int_64=None, text=None, text_prefix=None, min_timestamp=None, max_timestamp=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search primitive requireds

Parameters:

Name Type Description Default
query str

The search query,

required
properties PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
boolean bool | None

The boolean to filter on.

None
min_date date | None

The minimum value of the date to filter on.

None
max_date date | None

The maximum value of the date to filter on.

None
min_float_32 float | None

The minimum value of the float 32 to filter on.

None
max_float_32 float | None

The maximum value of the float 32 to filter on.

None
min_float_64 float | None

The minimum value of the float 64 to filter on.

None
max_float_64 float | None

The maximum value of the float 64 to filter on.

None
min_int_32 int | None

The minimum value of the int 32 to filter on.

None
max_int_32 int | None

The maximum value of the int 32 to filter on.

None
min_int_64 int | None

The minimum value of the int 64 to filter on.

None
max_int_64 int | None

The maximum value of the int 64 to filter on.

None
text str | list[str] | None

The text to filter on.

None
text_prefix str | None

The prefix of the text to filter on.

None
min_timestamp datetime | None

The minimum value of the timestamp to filter on.

None
max_timestamp datetime | None

The maximum value of the timestamp to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveRequiredList

Search results primitive requireds matching the query.

Examples:

Search for 'my_primitive_required' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_requireds = client.primitive_required.search('my_primitive_required')
Source code in examples/omni/_api/primitive_required.py
def search(
    self,
    query: str,
    properties: PrimitiveRequiredTextFields | SequenceNotStr[PrimitiveRequiredTextFields] | None = None,
    boolean: bool | None = None,
    min_date: datetime.date | None = None,
    max_date: datetime.date | None = None,
    min_float_32: float | None = None,
    max_float_32: float | None = None,
    min_float_64: float | None = None,
    max_float_64: float | None = None,
    min_int_32: int | None = None,
    max_int_32: int | None = None,
    min_int_64: int | None = None,
    max_int_64: int | None = None,
    text: str | list[str] | None = None,
    text_prefix: str | None = None,
    min_timestamp: datetime.datetime | None = None,
    max_timestamp: datetime.datetime | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveRequiredFields | SequenceNotStr[PrimitiveRequiredFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveRequiredList:
    """Search primitive requireds

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        boolean: The boolean to filter on.
        min_date: The minimum value of the date to filter on.
        max_date: The maximum value of the date to filter on.
        min_float_32: The minimum value of the float 32 to filter on.
        max_float_32: The maximum value of the float 32 to filter on.
        min_float_64: The minimum value of the float 64 to filter on.
        max_float_64: The maximum value of the float 64 to filter on.
        min_int_32: The minimum value of the int 32 to filter on.
        max_int_32: The maximum value of the int 32 to filter on.
        min_int_64: The minimum value of the int 64 to filter on.
        max_int_64: The maximum value of the int 64 to filter on.
        text: The text to filter on.
        text_prefix: The prefix of the text to filter on.
        min_timestamp: The minimum value of the timestamp to filter on.
        max_timestamp: The maximum value of the timestamp to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive requireds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results primitive requireds matching the query.

    Examples:

       Search for 'my_primitive_required' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_requireds = client.primitive_required.search('my_primitive_required')

    """
    filter_ = _create_primitive_required_filter(
        self._view_id,
        boolean,
        min_date,
        max_date,
        min_float_32,
        max_float_32,
        min_float_64,
        max_float_64,
        min_int_32,
        max_int_32,
        min_int_64,
        max_int_64,
        text,
        text_prefix,
        min_timestamp,
        max_timestamp,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

PrimitiveRequiredListedAPI

Bases: NodeAPI[PrimitiveRequiredListed, PrimitiveRequiredListedWrite, PrimitiveRequiredListedList, PrimitiveRequiredListedWriteList]

Source code in examples/omni/_api/primitive_required_listed.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
class PrimitiveRequiredListedAPI(
    NodeAPI[
        PrimitiveRequiredListed,
        PrimitiveRequiredListedWrite,
        PrimitiveRequiredListedList,
        PrimitiveRequiredListedWriteList,
    ]
):
    _view_id = dm.ViewId("pygen-models", "PrimitiveRequiredListed", "1")
    _properties_by_field = _PRIMITIVEREQUIREDLISTED_PROPERTIES_BY_FIELD
    _class_type = PrimitiveRequiredListed
    _class_list = PrimitiveRequiredListedList
    _class_write_list = PrimitiveRequiredListedWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> PrimitiveRequiredListedQueryAPI[PrimitiveRequiredListedList]:
        """Query starting at primitive required listeds.

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for primitive required listeds.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_primitive_required_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(PrimitiveRequiredListedList)
        return PrimitiveRequiredListedQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        primitive_required_listed: PrimitiveRequiredListedWrite | Sequence[PrimitiveRequiredListedWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) primitive required listeds.

        Args:
            primitive_required_listed: Primitive required listed or sequence of primitive required listeds to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new primitive_required_listed:

                >>> from omni import OmniClient
                >>> from omni.data_classes import PrimitiveRequiredListedWrite
                >>> client = OmniClient()
                >>> primitive_required_listed = PrimitiveRequiredListedWrite(external_id="my_primitive_required_listed", ...)
                >>> result = client.primitive_required_listed.apply(primitive_required_listed)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.primitive_required_listed.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(primitive_required_listed, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more primitive required listed.

        Args:
            external_id: External id of the primitive required listed to delete.
            space: The space where all the primitive required listed are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete primitive_required_listed by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.primitive_required_listed.delete("my_primitive_required_listed")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.primitive_required_listed.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveRequiredListed | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveRequiredListedList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveRequiredListed | PrimitiveRequiredListedList | None:
        """Retrieve one or more primitive required listeds by id(s).

        Args:
            external_id: External id or list of external ids of the primitive required listeds.
            space: The space where all the primitive required listeds are located.

        Returns:
            The requested primitive required listeds.

        Examples:

            Retrieve primitive_required_listed by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_required_listed = client.primitive_required_listed.retrieve("my_primitive_required_listed")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveRequiredListedList:
        """Search primitive required listeds

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results primitive required listeds matching the query.

        Examples:

           Search for 'my_primitive_required_listed' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_required_listeds = client.primitive_required_listed.search('my_primitive_required_listed')

        """
        filter_ = _create_primitive_required_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields],
        property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
        property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across primitive required listeds

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count primitive required listeds in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.primitive_required_listed.aggregate("count", space="my_space")

        """

        filter_ = _create_primitive_required_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: PrimitiveRequiredListedFields,
        interval: float,
        query: str | None = None,
        search_property: (
            PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None
        ) = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for primitive required listeds

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_primitive_required_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> PrimitiveRequiredListedQuery:
        """Start a query for primitive required listeds."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return PrimitiveRequiredListedQuery(self._client)

    def list(
        self,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveRequiredListedFields | Sequence[PrimitiveRequiredListedFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveRequiredListedList:
        """List/filter primitive required listeds

        Args:
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested primitive required listeds

        Examples:

            List primitive required listeds and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_required_listeds = client.primitive_required_listed.list(limit=5)

        """
        filter_ = _create_primitive_required_listed_filter(
            self._view_id,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at primitive required listeds.

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
PrimitiveRequiredListedQueryAPI[PrimitiveRequiredListedList]

A query API for primitive required listeds.

Source code in examples/omni/_api/primitive_required_listed.py
def __call__(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> PrimitiveRequiredListedQueryAPI[PrimitiveRequiredListedList]:
    """Query starting at primitive required listeds.

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for primitive required listeds.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_primitive_required_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(PrimitiveRequiredListedList)
    return PrimitiveRequiredListedQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None, query: str | None = None, search_property: PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None, query: str | None = None, search_property: PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields], property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None, query: str | None = None, search_property: PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across primitive required listeds

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None

The property to group by when doing the aggregation.

None
property PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None

The text field to search in.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count primitive required listeds in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.primitive_required_listed.aggregate("count", space="my_space")
Source code in examples/omni/_api/primitive_required_listed.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
    property: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
    query: str | None = None,
    search_property: (
        PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across primitive required listeds

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count primitive required listeds in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.primitive_required_listed.aggregate("count", space="my_space")

    """

    filter_ = _create_primitive_required_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(primitive_required_listed, replace=False, write_none=False)

Add or update (upsert) primitive required listeds.

Parameters:

Name Type Description Default
primitive_required_listed PrimitiveRequiredListedWrite | Sequence[PrimitiveRequiredListedWrite]

Primitive required listed or sequence of primitive required listeds to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new primitive_required_listed:

    >>> from omni import OmniClient
    >>> from omni.data_classes import PrimitiveRequiredListedWrite
    >>> client = OmniClient()
    >>> primitive_required_listed = PrimitiveRequiredListedWrite(external_id="my_primitive_required_listed", ...)
    >>> result = client.primitive_required_listed.apply(primitive_required_listed)
Source code in examples/omni/_api/primitive_required_listed.py
def apply(
    self,
    primitive_required_listed: PrimitiveRequiredListedWrite | Sequence[PrimitiveRequiredListedWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) primitive required listeds.

    Args:
        primitive_required_listed: Primitive required listed or sequence of primitive required listeds to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new primitive_required_listed:

            >>> from omni import OmniClient
            >>> from omni.data_classes import PrimitiveRequiredListedWrite
            >>> client = OmniClient()
            >>> primitive_required_listed = PrimitiveRequiredListedWrite(external_id="my_primitive_required_listed", ...)
            >>> result = client.primitive_required_listed.apply(primitive_required_listed)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.primitive_required_listed.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(primitive_required_listed, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more primitive required listed.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the primitive required listed to delete.

required
space str

The space where all the primitive required listed are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete primitive_required_listed by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.primitive_required_listed.delete("my_primitive_required_listed")
Source code in examples/omni/_api/primitive_required_listed.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more primitive required listed.

    Args:
        external_id: External id of the primitive required listed to delete.
        space: The space where all the primitive required listed are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete primitive_required_listed by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.primitive_required_listed.delete("my_primitive_required_listed")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.primitive_required_listed.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for primitive required listeds

Parameters:

Name Type Description Default
property PrimitiveRequiredListedFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None

The text field to search in.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/primitive_required_listed.py
def histogram(
    self,
    property: PrimitiveRequiredListedFields,
    interval: float,
    query: str | None = None,
    search_property: (
        PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None
    ) = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for primitive required listeds

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_primitive_required_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter primitive required listeds

Parameters:

Name Type Description Default
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveRequiredListedFields | Sequence[PrimitiveRequiredListedFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveRequiredListedList

List of requested primitive required listeds

Examples:

List primitive required listeds and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_required_listeds = client.primitive_required_listed.list(limit=5)
Source code in examples/omni/_api/primitive_required_listed.py
def list(
    self,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveRequiredListedFields | Sequence[PrimitiveRequiredListedFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveRequiredListedList:
    """List/filter primitive required listeds

    Args:
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested primitive required listeds

    Examples:

        List primitive required listeds and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_required_listeds = client.primitive_required_listed.list(limit=5)

    """
    filter_ = _create_primitive_required_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for primitive required listeds.

Source code in examples/omni/_api/primitive_required_listed.py
def query(self) -> PrimitiveRequiredListedQuery:
    """Start a query for primitive required listeds."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return PrimitiveRequiredListedQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveRequiredListed | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveRequiredListedList

Retrieve one or more primitive required listeds by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the primitive required listeds.

required
space str

The space where all the primitive required listeds are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
PrimitiveRequiredListed | PrimitiveRequiredListedList | None

The requested primitive required listeds.

Examples:

Retrieve primitive_required_listed by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_required_listed = client.primitive_required_listed.retrieve("my_primitive_required_listed")
Source code in examples/omni/_api/primitive_required_listed.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> PrimitiveRequiredListed | PrimitiveRequiredListedList | None:
    """Retrieve one or more primitive required listeds by id(s).

    Args:
        external_id: External id or list of external ids of the primitive required listeds.
        space: The space where all the primitive required listeds are located.

    Returns:
        The requested primitive required listeds.

    Examples:

        Retrieve primitive_required_listed by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_required_listed = client.primitive_required_listed.retrieve("my_primitive_required_listed")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search primitive required listeds

Parameters:

Name Type Description Default
query str

The search query,

required
properties PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveRequiredListedList

Search results primitive required listeds matching the query.

Examples:

Search for 'my_primitive_required_listed' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_required_listeds = client.primitive_required_listed.search('my_primitive_required_listed')
Source code in examples/omni/_api/primitive_required_listed.py
def search(
    self,
    query: str,
    properties: PrimitiveRequiredListedTextFields | SequenceNotStr[PrimitiveRequiredListedTextFields] | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveRequiredListedFields | SequenceNotStr[PrimitiveRequiredListedFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveRequiredListedList:
    """Search primitive required listeds

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive required listeds to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results primitive required listeds matching the query.

    Examples:

       Search for 'my_primitive_required_listed' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_required_listeds = client.primitive_required_listed.search('my_primitive_required_listed')

    """
    filter_ = _create_primitive_required_listed_filter(
        self._view_id,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

PrimitiveRequiredListedQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/primitive_required_listed_query.py
class PrimitiveRequiredListedQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "PrimitiveRequiredListed", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=PrimitiveRequiredListed,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/primitive_required_listed_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

PrimitiveRequiredQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/primitive_required_query.py
class PrimitiveRequiredQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "PrimitiveRequired", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=PrimitiveRequired,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/primitive_required_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

PrimitiveWithDefaultsAPI

Bases: NodeAPI[PrimitiveWithDefaults, PrimitiveWithDefaultsWrite, PrimitiveWithDefaultsList, PrimitiveWithDefaultsWriteList]

Source code in examples/omni/_api/primitive_with_defaults.py
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
class PrimitiveWithDefaultsAPI(
    NodeAPI[
        PrimitiveWithDefaults, PrimitiveWithDefaultsWrite, PrimitiveWithDefaultsList, PrimitiveWithDefaultsWriteList
    ]
):
    _view_id = dm.ViewId("pygen-models", "PrimitiveWithDefaults", "1")
    _properties_by_field = _PRIMITIVEWITHDEFAULTS_PROPERTIES_BY_FIELD
    _class_type = PrimitiveWithDefaults
    _class_list = PrimitiveWithDefaultsList
    _class_write_list = PrimitiveWithDefaultsWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> PrimitiveWithDefaultsQueryAPI[PrimitiveWithDefaultsList]:
        """Query starting at primitive with defaults.

        Args:
            min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
            max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
            default_boolean: The default boolean to filter on.
            min_default_float_32: The minimum value of the default float 32 to filter on.
            max_default_float_32: The maximum value of the default float 32 to filter on.
            default_string: The default string to filter on.
            default_string_prefix: The prefix of the default string to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for primitive with defaults.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_primitive_with_default_filter(
            self._view_id,
            min_auto_increment_int_32,
            max_auto_increment_int_32,
            default_boolean,
            min_default_float_32,
            max_default_float_32,
            default_string,
            default_string_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(PrimitiveWithDefaultsList)
        return PrimitiveWithDefaultsQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        primitive_with_default: PrimitiveWithDefaultsWrite | Sequence[PrimitiveWithDefaultsWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) primitive with defaults.

        Args:
            primitive_with_default: Primitive with default or sequence of primitive with defaults to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new primitive_with_default:

                >>> from omni import OmniClient
                >>> from omni.data_classes import PrimitiveWithDefaultsWrite
                >>> client = OmniClient()
                >>> primitive_with_default = PrimitiveWithDefaultsWrite(external_id="my_primitive_with_default", ...)
                >>> result = client.primitive_with_defaults.apply(primitive_with_default)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.primitive_with_defaults.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(primitive_with_default, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more primitive with default.

        Args:
            external_id: External id of the primitive with default to delete.
            space: The space where all the primitive with default are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete primitive_with_default by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.primitive_with_defaults.delete("my_primitive_with_default")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.primitive_with_defaults.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(self, external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveWithDefaults | None: ...

    @overload
    def retrieve(
        self, external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveWithDefaultsList: ...

    def retrieve(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> PrimitiveWithDefaults | PrimitiveWithDefaultsList | None:
        """Retrieve one or more primitive with defaults by id(s).

        Args:
            external_id: External id or list of external ids of the primitive with defaults.
            space: The space where all the primitive with defaults are located.

        Returns:
            The requested primitive with defaults.

        Examples:

            Retrieve primitive_with_default by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_with_default = client.primitive_with_defaults.retrieve("my_primitive_with_default")

        """
        return self._retrieve(external_id, space)

    def search(
        self,
        query: str,
        properties: PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None = None,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveWithDefaultsList:
        """Search primitive with defaults

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
            max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
            default_boolean: The default boolean to filter on.
            min_default_float_32: The minimum value of the default float 32 to filter on.
            max_default_float_32: The maximum value of the default float 32 to filter on.
            default_string: The default string to filter on.
            default_string_prefix: The prefix of the default string to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results primitive with defaults matching the query.

        Examples:

           Search for 'my_primitive_with_default' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_with_defaults = client.primitive_with_defaults.search('my_primitive_with_default')

        """
        filter_ = _create_primitive_with_default_filter(
            self._view_id,
            min_auto_increment_int_32,
            max_auto_increment_int_32,
            default_boolean,
            min_default_float_32,
            max_default_float_32,
            default_string,
            default_string_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None
        ) = None,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None
        ) = None,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields],
        property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None
        ) = None,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
        property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
        query: str | None = None,
        search_property: (
            PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None
        ) = None,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across primitive with defaults

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
            max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
            default_boolean: The default boolean to filter on.
            min_default_float_32: The minimum value of the default float 32 to filter on.
            max_default_float_32: The maximum value of the default float 32 to filter on.
            default_string: The default string to filter on.
            default_string_prefix: The prefix of the default string to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count primitive with defaults in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.primitive_with_defaults.aggregate("count", space="my_space")

        """

        filter_ = _create_primitive_with_default_filter(
            self._view_id,
            min_auto_increment_int_32,
            max_auto_increment_int_32,
            default_boolean,
            min_default_float_32,
            max_default_float_32,
            default_string,
            default_string_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: PrimitiveWithDefaultsFields,
        interval: float,
        query: str | None = None,
        search_property: (
            PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None
        ) = None,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for primitive with defaults

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
            max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
            default_boolean: The default boolean to filter on.
            min_default_float_32: The minimum value of the default float 32 to filter on.
            max_default_float_32: The maximum value of the default float 32 to filter on.
            default_string: The default string to filter on.
            default_string_prefix: The prefix of the default string to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_primitive_with_default_filter(
            self._view_id,
            min_auto_increment_int_32,
            max_auto_increment_int_32,
            default_boolean,
            min_default_float_32,
            max_default_float_32,
            default_string,
            default_string_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> PrimitiveWithDefaultsQuery:
        """Start a query for primitive with defaults."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return PrimitiveWithDefaultsQuery(self._client)

    def list(
        self,
        min_auto_increment_int_32: int | None = None,
        max_auto_increment_int_32: int | None = None,
        default_boolean: bool | None = None,
        min_default_float_32: float | None = None,
        max_default_float_32: float | None = None,
        default_string: str | list[str] | None = None,
        default_string_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: PrimitiveWithDefaultsFields | Sequence[PrimitiveWithDefaultsFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> PrimitiveWithDefaultsList:
        """List/filter primitive with defaults

        Args:
            min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
            max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
            default_boolean: The default boolean to filter on.
            min_default_float_32: The minimum value of the default float 32 to filter on.
            max_default_float_32: The maximum value of the default float 32 to filter on.
            default_string: The default string to filter on.
            default_string_prefix: The prefix of the default string to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested primitive with defaults

        Examples:

            List primitive with defaults and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> primitive_with_defaults = client.primitive_with_defaults.list(limit=5)

        """
        filter_ = _create_primitive_with_default_filter(
            self._view_id,
            min_auto_increment_int_32,
            max_auto_increment_int_32,
            default_boolean,
            min_default_float_32,
            max_default_float_32,
            default_string,
            default_string_prefix,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(min_auto_increment_int_32=None, max_auto_increment_int_32=None, default_boolean=None, min_default_float_32=None, max_default_float_32=None, default_string=None, default_string_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at primitive with defaults.

Parameters:

Name Type Description Default
min_auto_increment_int_32 int | None

The minimum value of the auto increment int 32 to filter on.

None
max_auto_increment_int_32 int | None

The maximum value of the auto increment int 32 to filter on.

None
default_boolean bool | None

The default boolean to filter on.

None
min_default_float_32 float | None

The minimum value of the default float 32 to filter on.

None
max_default_float_32 float | None

The maximum value of the default float 32 to filter on.

None
default_string str | list[str] | None

The default string to filter on.

None
default_string_prefix str | None

The prefix of the default string to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
PrimitiveWithDefaultsQueryAPI[PrimitiveWithDefaultsList]

A query API for primitive with defaults.

Source code in examples/omni/_api/primitive_with_defaults.py
def __call__(
    self,
    min_auto_increment_int_32: int | None = None,
    max_auto_increment_int_32: int | None = None,
    default_boolean: bool | None = None,
    min_default_float_32: float | None = None,
    max_default_float_32: float | None = None,
    default_string: str | list[str] | None = None,
    default_string_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> PrimitiveWithDefaultsQueryAPI[PrimitiveWithDefaultsList]:
    """Query starting at primitive with defaults.

    Args:
        min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
        max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
        default_boolean: The default boolean to filter on.
        min_default_float_32: The minimum value of the default float 32 to filter on.
        max_default_float_32: The maximum value of the default float 32 to filter on.
        default_string: The default string to filter on.
        default_string_prefix: The prefix of the default string to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for primitive with defaults.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_primitive_with_default_filter(
        self._view_id,
        min_auto_increment_int_32,
        max_auto_increment_int_32,
        default_boolean,
        min_default_float_32,
        max_default_float_32,
        default_string,
        default_string_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(PrimitiveWithDefaultsList)
    return PrimitiveWithDefaultsQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, min_auto_increment_int_32=None, max_auto_increment_int_32=None, default_boolean=None, min_default_float_32=None, max_default_float_32=None, default_string=None, default_string_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None, query: str | None = None, search_property: PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None = None, min_auto_increment_int_32: int | None = None, max_auto_increment_int_32: int | None = None, default_boolean: bool | None = None, min_default_float_32: float | None = None, max_default_float_32: float | None = None, default_string: str | list[str] | None = None, default_string_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None, query: str | None = None, search_property: PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None = None, min_auto_increment_int_32: int | None = None, max_auto_increment_int_32: int | None = None, default_boolean: bool | None = None, min_default_float_32: float | None = None, max_default_float_32: float | None = None, default_string: str | list[str] | None = None, default_string_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields], property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None, query: str | None = None, search_property: PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None = None, min_auto_increment_int_32: int | None = None, max_auto_increment_int_32: int | None = None, default_boolean: bool | None = None, min_default_float_32: float | None = None, max_default_float_32: float | None = None, default_string: str | list[str] | None = None, default_string_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across primitive with defaults

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None

The property to group by when doing the aggregation.

None
property PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None

The text field to search in.

None
min_auto_increment_int_32 int | None

The minimum value of the auto increment int 32 to filter on.

None
max_auto_increment_int_32 int | None

The maximum value of the auto increment int 32 to filter on.

None
default_boolean bool | None

The default boolean to filter on.

None
min_default_float_32 float | None

The minimum value of the default float 32 to filter on.

None
max_default_float_32 float | None

The maximum value of the default float 32 to filter on.

None
default_string str | list[str] | None

The default string to filter on.

None
default_string_prefix str | None

The prefix of the default string to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count primitive with defaults in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.primitive_with_defaults.aggregate("count", space="my_space")
Source code in examples/omni/_api/primitive_with_defaults.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
    property: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
    query: str | None = None,
    search_property: (
        PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None
    ) = None,
    min_auto_increment_int_32: int | None = None,
    max_auto_increment_int_32: int | None = None,
    default_boolean: bool | None = None,
    min_default_float_32: float | None = None,
    max_default_float_32: float | None = None,
    default_string: str | list[str] | None = None,
    default_string_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across primitive with defaults

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
        max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
        default_boolean: The default boolean to filter on.
        min_default_float_32: The minimum value of the default float 32 to filter on.
        max_default_float_32: The maximum value of the default float 32 to filter on.
        default_string: The default string to filter on.
        default_string_prefix: The prefix of the default string to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count primitive with defaults in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.primitive_with_defaults.aggregate("count", space="my_space")

    """

    filter_ = _create_primitive_with_default_filter(
        self._view_id,
        min_auto_increment_int_32,
        max_auto_increment_int_32,
        default_boolean,
        min_default_float_32,
        max_default_float_32,
        default_string,
        default_string_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(primitive_with_default, replace=False, write_none=False)

Add or update (upsert) primitive with defaults.

Parameters:

Name Type Description Default
primitive_with_default PrimitiveWithDefaultsWrite | Sequence[PrimitiveWithDefaultsWrite]

Primitive with default or sequence of primitive with defaults to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new primitive_with_default:

    >>> from omni import OmniClient
    >>> from omni.data_classes import PrimitiveWithDefaultsWrite
    >>> client = OmniClient()
    >>> primitive_with_default = PrimitiveWithDefaultsWrite(external_id="my_primitive_with_default", ...)
    >>> result = client.primitive_with_defaults.apply(primitive_with_default)
Source code in examples/omni/_api/primitive_with_defaults.py
def apply(
    self,
    primitive_with_default: PrimitiveWithDefaultsWrite | Sequence[PrimitiveWithDefaultsWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) primitive with defaults.

    Args:
        primitive_with_default: Primitive with default or sequence of primitive with defaults to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new primitive_with_default:

            >>> from omni import OmniClient
            >>> from omni.data_classes import PrimitiveWithDefaultsWrite
            >>> client = OmniClient()
            >>> primitive_with_default = PrimitiveWithDefaultsWrite(external_id="my_primitive_with_default", ...)
            >>> result = client.primitive_with_defaults.apply(primitive_with_default)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.primitive_with_defaults.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(primitive_with_default, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more primitive with default.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the primitive with default to delete.

required
space str

The space where all the primitive with default are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete primitive_with_default by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.primitive_with_defaults.delete("my_primitive_with_default")
Source code in examples/omni/_api/primitive_with_defaults.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more primitive with default.

    Args:
        external_id: External id of the primitive with default to delete.
        space: The space where all the primitive with default are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete primitive_with_default by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.primitive_with_defaults.delete("my_primitive_with_default")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.primitive_with_defaults.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, min_auto_increment_int_32=None, max_auto_increment_int_32=None, default_boolean=None, min_default_float_32=None, max_default_float_32=None, default_string=None, default_string_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for primitive with defaults

Parameters:

Name Type Description Default
property PrimitiveWithDefaultsFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None

The text field to search in.

None
min_auto_increment_int_32 int | None

The minimum value of the auto increment int 32 to filter on.

None
max_auto_increment_int_32 int | None

The maximum value of the auto increment int 32 to filter on.

None
default_boolean bool | None

The default boolean to filter on.

None
min_default_float_32 float | None

The minimum value of the default float 32 to filter on.

None
max_default_float_32 float | None

The maximum value of the default float 32 to filter on.

None
default_string str | list[str] | None

The default string to filter on.

None
default_string_prefix str | None

The prefix of the default string to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/primitive_with_defaults.py
def histogram(
    self,
    property: PrimitiveWithDefaultsFields,
    interval: float,
    query: str | None = None,
    search_property: (
        PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None
    ) = None,
    min_auto_increment_int_32: int | None = None,
    max_auto_increment_int_32: int | None = None,
    default_boolean: bool | None = None,
    min_default_float_32: float | None = None,
    max_default_float_32: float | None = None,
    default_string: str | list[str] | None = None,
    default_string_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for primitive with defaults

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
        max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
        default_boolean: The default boolean to filter on.
        min_default_float_32: The minimum value of the default float 32 to filter on.
        max_default_float_32: The maximum value of the default float 32 to filter on.
        default_string: The default string to filter on.
        default_string_prefix: The prefix of the default string to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_primitive_with_default_filter(
        self._view_id,
        min_auto_increment_int_32,
        max_auto_increment_int_32,
        default_boolean,
        min_default_float_32,
        max_default_float_32,
        default_string,
        default_string_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(min_auto_increment_int_32=None, max_auto_increment_int_32=None, default_boolean=None, min_default_float_32=None, max_default_float_32=None, default_string=None, default_string_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter primitive with defaults

Parameters:

Name Type Description Default
min_auto_increment_int_32 int | None

The minimum value of the auto increment int 32 to filter on.

None
max_auto_increment_int_32 int | None

The maximum value of the auto increment int 32 to filter on.

None
default_boolean bool | None

The default boolean to filter on.

None
min_default_float_32 float | None

The minimum value of the default float 32 to filter on.

None
max_default_float_32 float | None

The maximum value of the default float 32 to filter on.

None
default_string str | list[str] | None

The default string to filter on.

None
default_string_prefix str | None

The prefix of the default string to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveWithDefaultsFields | Sequence[PrimitiveWithDefaultsFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveWithDefaultsList

List of requested primitive with defaults

Examples:

List primitive with defaults and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_with_defaults = client.primitive_with_defaults.list(limit=5)
Source code in examples/omni/_api/primitive_with_defaults.py
def list(
    self,
    min_auto_increment_int_32: int | None = None,
    max_auto_increment_int_32: int | None = None,
    default_boolean: bool | None = None,
    min_default_float_32: float | None = None,
    max_default_float_32: float | None = None,
    default_string: str | list[str] | None = None,
    default_string_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveWithDefaultsFields | Sequence[PrimitiveWithDefaultsFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveWithDefaultsList:
    """List/filter primitive with defaults

    Args:
        min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
        max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
        default_boolean: The default boolean to filter on.
        min_default_float_32: The minimum value of the default float 32 to filter on.
        max_default_float_32: The maximum value of the default float 32 to filter on.
        default_string: The default string to filter on.
        default_string_prefix: The prefix of the default string to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested primitive with defaults

    Examples:

        List primitive with defaults and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_with_defaults = client.primitive_with_defaults.list(limit=5)

    """
    filter_ = _create_primitive_with_default_filter(
        self._view_id,
        min_auto_increment_int_32,
        max_auto_increment_int_32,
        default_boolean,
        min_default_float_32,
        max_default_float_32,
        default_string,
        default_string_prefix,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for primitive with defaults.

Source code in examples/omni/_api/primitive_with_defaults.py
def query(self) -> PrimitiveWithDefaultsQuery:
    """Start a query for primitive with defaults."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return PrimitiveWithDefaultsQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveWithDefaults | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE) -> PrimitiveWithDefaultsList

Retrieve one or more primitive with defaults by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the primitive with defaults.

required
space str

The space where all the primitive with defaults are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
PrimitiveWithDefaults | PrimitiveWithDefaultsList | None

The requested primitive with defaults.

Examples:

Retrieve primitive_with_default by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_with_default = client.primitive_with_defaults.retrieve("my_primitive_with_default")
Source code in examples/omni/_api/primitive_with_defaults.py
def retrieve(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> PrimitiveWithDefaults | PrimitiveWithDefaultsList | None:
    """Retrieve one or more primitive with defaults by id(s).

    Args:
        external_id: External id or list of external ids of the primitive with defaults.
        space: The space where all the primitive with defaults are located.

    Returns:
        The requested primitive with defaults.

    Examples:

        Retrieve primitive_with_default by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_with_default = client.primitive_with_defaults.retrieve("my_primitive_with_default")

    """
    return self._retrieve(external_id, space)

search(query, properties=None, min_auto_increment_int_32=None, max_auto_increment_int_32=None, default_boolean=None, min_default_float_32=None, max_default_float_32=None, default_string=None, default_string_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search primitive with defaults

Parameters:

Name Type Description Default
query str

The search query,

required
properties PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
min_auto_increment_int_32 int | None

The minimum value of the auto increment int 32 to filter on.

None
max_auto_increment_int_32 int | None

The maximum value of the auto increment int 32 to filter on.

None
default_boolean bool | None

The default boolean to filter on.

None
min_default_float_32 float | None

The minimum value of the default float 32 to filter on.

None
max_default_float_32 float | None

The maximum value of the default float 32 to filter on.

None
default_string str | list[str] | None

The default string to filter on.

None
default_string_prefix str | None

The prefix of the default string to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
PrimitiveWithDefaultsList

Search results primitive with defaults matching the query.

Examples:

Search for 'my_primitive_with_default' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> primitive_with_defaults = client.primitive_with_defaults.search('my_primitive_with_default')
Source code in examples/omni/_api/primitive_with_defaults.py
def search(
    self,
    query: str,
    properties: PrimitiveWithDefaultsTextFields | SequenceNotStr[PrimitiveWithDefaultsTextFields] | None = None,
    min_auto_increment_int_32: int | None = None,
    max_auto_increment_int_32: int | None = None,
    default_boolean: bool | None = None,
    min_default_float_32: float | None = None,
    max_default_float_32: float | None = None,
    default_string: str | list[str] | None = None,
    default_string_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: PrimitiveWithDefaultsFields | SequenceNotStr[PrimitiveWithDefaultsFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> PrimitiveWithDefaultsList:
    """Search primitive with defaults

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        min_auto_increment_int_32: The minimum value of the auto increment int 32 to filter on.
        max_auto_increment_int_32: The maximum value of the auto increment int 32 to filter on.
        default_boolean: The default boolean to filter on.
        min_default_float_32: The minimum value of the default float 32 to filter on.
        max_default_float_32: The maximum value of the default float 32 to filter on.
        default_string: The default string to filter on.
        default_string_prefix: The prefix of the default string to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of primitive with defaults to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results primitive with defaults matching the query.

    Examples:

       Search for 'my_primitive_with_default' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> primitive_with_defaults = client.primitive_with_defaults.search('my_primitive_with_default')

    """
    filter_ = _create_primitive_with_default_filter(
        self._view_id,
        min_auto_increment_int_32,
        max_auto_increment_int_32,
        default_boolean,
        min_default_float_32,
        max_default_float_32,
        default_string,
        default_string_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

PrimitiveWithDefaultsQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/primitive_with_defaults_query.py
class PrimitiveWithDefaultsQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "PrimitiveWithDefaults", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=PrimitiveWithDefaults,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/primitive_with_defaults_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()

SubInterfaceAPI

Bases: NodeAPI[SubInterface, SubInterfaceWrite, SubInterfaceList, SubInterfaceWriteList]

Source code in examples/omni/_api/sub_interface.py
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
class SubInterfaceAPI(NodeAPI[SubInterface, SubInterfaceWrite, SubInterfaceList, SubInterfaceWriteList]):
    _view_id = dm.ViewId("pygen-models", "SubInterface", "1")
    _properties_by_field = _SUBINTERFACE_PROPERTIES_BY_FIELD
    _direct_children_by_external_id = {
        "Implementation1": Implementation1,
        "Implementation1NonWriteable": Implementation1NonWriteable,
        "Implementation2": Implementation2,
    }
    _class_type = SubInterface
    _class_list = SubInterfaceList
    _class_write_list = SubInterfaceWriteList

    def __init__(self, client: CogniteClient):
        super().__init__(client=client)

    def __call__(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
        filter: dm.Filter | None = None,
    ) -> SubInterfaceQueryAPI[SubInterfaceList]:
        """Query starting at sub interfaces.

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            A query API for sub interfaces.

        """
        has_data = dm.filters.HasData(views=[self._view_id])
        filter_ = _create_sub_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            (filter and dm.filters.And(filter, has_data)) or has_data,
        )
        builder = QueryBuilder(SubInterfaceList)
        return SubInterfaceQueryAPI(self._client, builder, filter_, limit)

    def apply(
        self,
        sub_interface: SubInterfaceWrite | Sequence[SubInterfaceWrite],
        replace: bool = False,
        write_none: bool = False,
    ) -> ResourcesWriteResult:
        """Add or update (upsert) sub interfaces.

        Args:
            sub_interface: Sub interface or sequence of sub interfaces to upsert.
            replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
                Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
            write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
                you can set this parameter to True. Note this only applies to properties that are nullable.
        Returns:
            Created instance(s), i.e., nodes, edges, and time series.

        Examples:

            Create a new sub_interface:

                >>> from omni import OmniClient
                >>> from omni.data_classes import SubInterfaceWrite
                >>> client = OmniClient()
                >>> sub_interface = SubInterfaceWrite(external_id="my_sub_interface", ...)
                >>> result = client.sub_interface.apply(sub_interface)

        """
        warnings.warn(
            "The .apply method is deprecated and will be removed in v1.0. "
            "Please use the .upsert method on the client instead. This means instead of "
            "`my_client.sub_interface.apply(my_items)` please use `my_client.upsert(my_items)`."
            "The motivation is that all apply methods are the same, and having one apply method per API "
            " class encourages users to create items in small batches, which is inefficient."
            "In addition, .upsert method is more descriptive of what the method does.",
            UserWarning,
            stacklevel=2,
        )
        return self._apply(sub_interface, replace, write_none)

    def delete(
        self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
    ) -> dm.InstancesDeleteResult:
        """Delete one or more sub interface.

        Args:
            external_id: External id of the sub interface to delete.
            space: The space where all the sub interface are located.

        Returns:
            The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

        Examples:

            Delete sub_interface by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> client.sub_interface.delete("my_sub_interface")
        """
        warnings.warn(
            "The .delete method is deprecated and will be removed in v1.0. "
            "Please use the .delete method on the client instead. This means instead of "
            "`my_client.sub_interface.delete(my_ids)` please use `my_client.delete(my_ids)`."
            "The motivation is that all delete methods are the same, and having one delete method per API "
            " class encourages users to delete items in small batches, which is inefficient.",
            UserWarning,
            stacklevel=2,
        )
        return self._delete(external_id, space)

    @overload
    def retrieve(
        self,
        external_id: str,
        space: str = DEFAULT_INSTANCE_SPACE,
        as_child_class: (
            SequenceNotStr[Literal["Implementation1", "Implementation1NonWriteable", "Implementation2"]] | None
        ) = None,
    ) -> SubInterface | None: ...

    @overload
    def retrieve(
        self,
        external_id: SequenceNotStr[str],
        space: str = DEFAULT_INSTANCE_SPACE,
        as_child_class: (
            SequenceNotStr[Literal["Implementation1", "Implementation1NonWriteable", "Implementation2"]] | None
        ) = None,
    ) -> SubInterfaceList: ...

    def retrieve(
        self,
        external_id: str | SequenceNotStr[str],
        space: str = DEFAULT_INSTANCE_SPACE,
        as_child_class: (
            SequenceNotStr[Literal["Implementation1", "Implementation1NonWriteable", "Implementation2"]] | None
        ) = None,
    ) -> SubInterface | SubInterfaceList | None:
        """Retrieve one or more sub interfaces by id(s).

        Args:
            external_id: External id or list of external ids of the sub interfaces.
            space: The space where all the sub interfaces are located.
            as_child_class: If you want to retrieve the sub interfaces as a child class,
                you can specify the child class here. Note that if one node has properties in
                multiple child classes, you will get duplicate nodes in the result.

        Returns:
            The requested sub interfaces.

        Examples:

            Retrieve sub_interface by id:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> sub_interface = client.sub_interface.retrieve("my_sub_interface")

        """
        return self._retrieve(external_id, space, as_child_class=as_child_class)

    def search(
        self,
        query: str,
        properties: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> SubInterfaceList:
        """Search sub interfaces

        Args:
            query: The search query,
            properties: The property to search, if nothing is passed all text fields will be searched.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            Search results sub interfaces matching the query.

        Examples:

           Search for 'my_sub_interface' in all text properties:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> sub_interfaces = client.sub_interface.search('my_sub_interface')

        """
        filter_ = _create_sub_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._search(
            query=query,
            properties=properties,
            filter_=filter_,
            limit=limit,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

    @overload
    def aggregate(
        self,
        aggregate: Aggregations | dm.aggregations.MetricAggregation,
        group_by: None = None,
        property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
        query: str | None = None,
        search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.AggregatedNumberedValue: ...

    @overload
    def aggregate(
        self,
        aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation],
        group_by: None = None,
        property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
        query: str | None = None,
        search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> list[dm.aggregations.AggregatedNumberedValue]: ...

    @overload
    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: SubInterfaceFields | SequenceNotStr[SubInterfaceFields],
        property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
        query: str | None = None,
        search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> InstanceAggregationResultList: ...

    def aggregate(
        self,
        aggregate: (
            Aggregations
            | dm.aggregations.MetricAggregation
            | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
        ),
        group_by: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
        property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
        query: str | None = None,
        search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> (
        dm.aggregations.AggregatedNumberedValue
        | list[dm.aggregations.AggregatedNumberedValue]
        | InstanceAggregationResultList
    ):
        """Aggregate data across sub interfaces

        Args:
            aggregate: The aggregation to perform.
            group_by: The property to group by when doing the aggregation.
            property: The property to perform aggregation on.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Aggregation results.

        Examples:

            Count sub interfaces in space `my_space`:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> result = client.sub_interface.aggregate("count", space="my_space")

        """

        filter_ = _create_sub_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._aggregate(
            aggregate=aggregate,
            group_by=group_by,  # type: ignore[arg-type]
            properties=property,  # type: ignore[arg-type]
            query=query,
            search_properties=search_property,  # type: ignore[arg-type]
            limit=limit,
            filter=filter_,
        )

    def histogram(
        self,
        property: SubInterfaceFields,
        interval: float,
        query: str | None = None,
        search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
    ) -> dm.aggregations.HistogramValue:
        """Produces histograms for sub interfaces

        Args:
            property: The property to use as the value in the histogram.
            interval: The interval to use for the histogram bins.
            query: The query to search for in the text field.
            search_property: The text field to search in.
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

        Returns:
            Bucketed histogram results.

        """
        filter_ = _create_sub_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )
        return self._histogram(
            property,
            interval,
            query,
            search_property,  # type: ignore[arg-type]
            limit,
            filter_,
        )

    def query(self) -> SubInterfaceQuery:
        """Start a query for sub interfaces."""
        warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
        return SubInterfaceQuery(self._client)

    def list(
        self,
        main_value: str | list[str] | None = None,
        main_value_prefix: str | None = None,
        sub_value: str | list[str] | None = None,
        sub_value_prefix: str | None = None,
        external_id_prefix: str | None = None,
        space: str | list[str] | None = None,
        limit: int = DEFAULT_LIMIT_READ,
        filter: dm.Filter | None = None,
        sort_by: SubInterfaceFields | Sequence[SubInterfaceFields] | None = None,
        direction: Literal["ascending", "descending"] = "ascending",
        sort: InstanceSort | list[InstanceSort] | None = None,
    ) -> SubInterfaceList:
        """List/filter sub interfaces

        Args:
            main_value: The main value to filter on.
            main_value_prefix: The prefix of the main value to filter on.
            sub_value: The sub value to filter on.
            sub_value_prefix: The prefix of the sub value to filter on.
            external_id_prefix: The prefix of the external ID to filter on.
            space: The space to filter on.
            limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
            filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
            sort_by: The property to sort by.
            direction: The direction to sort by, either 'ascending' or 'descending'.
            sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
                This will override the sort_by and direction. This allowos you to sort by multiple fields and
                specify the direction for each field as well as how to handle null values.

        Returns:
            List of requested sub interfaces

        Examples:

            List sub interfaces and limit to 5:

                >>> from omni import OmniClient
                >>> client = OmniClient()
                >>> sub_interfaces = client.sub_interface.list(limit=5)

        """
        filter_ = _create_sub_interface_filter(
            self._view_id,
            main_value,
            main_value_prefix,
            sub_value,
            sub_value_prefix,
            external_id_prefix,
            space,
            filter,
        )

        return self._list(
            limit=limit,
            filter=filter_,
            sort_by=sort_by,  # type: ignore[arg-type]
            direction=direction,
            sort=sort,
        )

__call__(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_QUERY_LIMIT, filter=None)

Query starting at sub interfaces.

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_QUERY_LIMIT
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
SubInterfaceQueryAPI[SubInterfaceList]

A query API for sub interfaces.

Source code in examples/omni/_api/sub_interface.py
def __call__(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_QUERY_LIMIT,
    filter: dm.Filter | None = None,
) -> SubInterfaceQueryAPI[SubInterfaceList]:
    """Query starting at sub interfaces.

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        A query API for sub interfaces.

    """
    has_data = dm.filters.HasData(views=[self._view_id])
    filter_ = _create_sub_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        (filter and dm.filters.And(filter, has_data)) or has_data,
    )
    builder = QueryBuilder(SubInterfaceList)
    return SubInterfaceQueryAPI(self._client, builder, filter_, limit)

aggregate(aggregate, group_by=None, property=None, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation, group_by: None = None, property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None, query: str | None = None, search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> dm.aggregations.AggregatedNumberedValue
aggregate(aggregate: SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: None = None, property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None, query: str | None = None, search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> list[dm.aggregations.AggregatedNumberedValue]
aggregate(aggregate: Aggregations | dm.aggregations.MetricAggregation | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation], group_by: SubInterfaceFields | SequenceNotStr[SubInterfaceFields], property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None, query: str | None = None, search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None, main_value: str | list[str] | None = None, main_value_prefix: str | None = None, sub_value: str | list[str] | None = None, sub_value_prefix: str | None = None, external_id_prefix: str | None = None, space: str | list[str] | None = None, limit: int = DEFAULT_LIMIT_READ, filter: dm.Filter | None = None) -> InstanceAggregationResultList

Aggregate data across sub interfaces

Parameters:

Name Type Description Default
aggregate Aggregations | MetricAggregation | SequenceNotStr[Aggregations | MetricAggregation]

The aggregation to perform.

required
group_by SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None

The property to group by when doing the aggregation.

None
property SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None

The property to perform aggregation on.

None
query str | None

The query to search for in the text field.

None
search_property SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
AggregatedNumberedValue | list[AggregatedNumberedValue] | InstanceAggregationResultList

Aggregation results.

Examples:

Count sub interfaces in space `my_space`:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> result = client.sub_interface.aggregate("count", space="my_space")
Source code in examples/omni/_api/sub_interface.py
def aggregate(
    self,
    aggregate: (
        Aggregations
        | dm.aggregations.MetricAggregation
        | SequenceNotStr[Aggregations | dm.aggregations.MetricAggregation]
    ),
    group_by: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
    property: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
    query: str | None = None,
    search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> (
    dm.aggregations.AggregatedNumberedValue
    | list[dm.aggregations.AggregatedNumberedValue]
    | InstanceAggregationResultList
):
    """Aggregate data across sub interfaces

    Args:
        aggregate: The aggregation to perform.
        group_by: The property to group by when doing the aggregation.
        property: The property to perform aggregation on.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Aggregation results.

    Examples:

        Count sub interfaces in space `my_space`:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> result = client.sub_interface.aggregate("count", space="my_space")

    """

    filter_ = _create_sub_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._aggregate(
        aggregate=aggregate,
        group_by=group_by,  # type: ignore[arg-type]
        properties=property,  # type: ignore[arg-type]
        query=query,
        search_properties=search_property,  # type: ignore[arg-type]
        limit=limit,
        filter=filter_,
    )

apply(sub_interface, replace=False, write_none=False)

Add or update (upsert) sub interfaces.

Parameters:

Name Type Description Default
sub_interface SubInterfaceWrite | Sequence[SubInterfaceWrite]

Sub interface or sequence of sub interfaces to upsert.

required
replace bool

How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)? Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.

False
write_none bool

This method, will by default, skip properties that are set to None. However, if you want to set properties to None, you can set this parameter to True. Note this only applies to properties that are nullable.

False

Returns: Created instance(s), i.e., nodes, edges, and time series.

Examples:

Create a new sub_interface:

    >>> from omni import OmniClient
    >>> from omni.data_classes import SubInterfaceWrite
    >>> client = OmniClient()
    >>> sub_interface = SubInterfaceWrite(external_id="my_sub_interface", ...)
    >>> result = client.sub_interface.apply(sub_interface)
Source code in examples/omni/_api/sub_interface.py
def apply(
    self,
    sub_interface: SubInterfaceWrite | Sequence[SubInterfaceWrite],
    replace: bool = False,
    write_none: bool = False,
) -> ResourcesWriteResult:
    """Add or update (upsert) sub interfaces.

    Args:
        sub_interface: Sub interface or sequence of sub interfaces to upsert.
        replace (bool): How do we behave when a property value exists? Do we replace all matching and existing values with the supplied values (true)?
            Or should we merge in new values for properties together with the existing values (false)? Note: This setting applies for all nodes or edges specified in the ingestion call.
        write_none (bool): This method, will by default, skip properties that are set to None. However, if you want to set properties to None,
            you can set this parameter to True. Note this only applies to properties that are nullable.
    Returns:
        Created instance(s), i.e., nodes, edges, and time series.

    Examples:

        Create a new sub_interface:

            >>> from omni import OmniClient
            >>> from omni.data_classes import SubInterfaceWrite
            >>> client = OmniClient()
            >>> sub_interface = SubInterfaceWrite(external_id="my_sub_interface", ...)
            >>> result = client.sub_interface.apply(sub_interface)

    """
    warnings.warn(
        "The .apply method is deprecated and will be removed in v1.0. "
        "Please use the .upsert method on the client instead. This means instead of "
        "`my_client.sub_interface.apply(my_items)` please use `my_client.upsert(my_items)`."
        "The motivation is that all apply methods are the same, and having one apply method per API "
        " class encourages users to create items in small batches, which is inefficient."
        "In addition, .upsert method is more descriptive of what the method does.",
        UserWarning,
        stacklevel=2,
    )
    return self._apply(sub_interface, replace, write_none)

delete(external_id, space=DEFAULT_INSTANCE_SPACE)

Delete one or more sub interface.

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id of the sub interface to delete.

required
space str

The space where all the sub interface are located.

DEFAULT_INSTANCE_SPACE

Returns:

Type Description
InstancesDeleteResult

The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

Examples:

Delete sub_interface by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> client.sub_interface.delete("my_sub_interface")
Source code in examples/omni/_api/sub_interface.py
def delete(
    self, external_id: str | SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE
) -> dm.InstancesDeleteResult:
    """Delete one or more sub interface.

    Args:
        external_id: External id of the sub interface to delete.
        space: The space where all the sub interface are located.

    Returns:
        The instance(s), i.e., nodes and edges which has been deleted. Empty list if nothing was deleted.

    Examples:

        Delete sub_interface by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> client.sub_interface.delete("my_sub_interface")
    """
    warnings.warn(
        "The .delete method is deprecated and will be removed in v1.0. "
        "Please use the .delete method on the client instead. This means instead of "
        "`my_client.sub_interface.delete(my_ids)` please use `my_client.delete(my_ids)`."
        "The motivation is that all delete methods are the same, and having one delete method per API "
        " class encourages users to delete items in small batches, which is inefficient.",
        UserWarning,
        stacklevel=2,
    )
    return self._delete(external_id, space)

histogram(property, interval, query=None, search_property=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None)

Produces histograms for sub interfaces

Parameters:

Name Type Description Default
property SubInterfaceFields

The property to use as the value in the histogram.

required
interval float

The interval to use for the histogram bins.

required
query str | None

The query to search for in the text field.

None
search_property SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None

The text field to search in.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None

Returns:

Type Description
HistogramValue

Bucketed histogram results.

Source code in examples/omni/_api/sub_interface.py
def histogram(
    self,
    property: SubInterfaceFields,
    interval: float,
    query: str | None = None,
    search_property: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
) -> dm.aggregations.HistogramValue:
    """Produces histograms for sub interfaces

    Args:
        property: The property to use as the value in the histogram.
        interval: The interval to use for the histogram bins.
        query: The query to search for in the text field.
        search_property: The text field to search in.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

    Returns:
        Bucketed histogram results.

    """
    filter_ = _create_sub_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._histogram(
        property,
        interval,
        query,
        search_property,  # type: ignore[arg-type]
        limit,
        filter_,
    )

list(main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

List/filter sub interfaces

Parameters:

Name Type Description Default
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by SubInterfaceFields | Sequence[SubInterfaceFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
SubInterfaceList

List of requested sub interfaces

Examples:

List sub interfaces and limit to 5:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> sub_interfaces = client.sub_interface.list(limit=5)
Source code in examples/omni/_api/sub_interface.py
def list(
    self,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: SubInterfaceFields | Sequence[SubInterfaceFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> SubInterfaceList:
    """List/filter sub interfaces

    Args:
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        List of requested sub interfaces

    Examples:

        List sub interfaces and limit to 5:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> sub_interfaces = client.sub_interface.list(limit=5)

    """
    filter_ = _create_sub_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )

    return self._list(
        limit=limit,
        filter=filter_,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

query()

Start a query for sub interfaces.

Source code in examples/omni/_api/sub_interface.py
def query(self) -> SubInterfaceQuery:
    """Start a query for sub interfaces."""
    warnings.warn("The .query is in alpha and is subject to breaking changes without notice.")
    return SubInterfaceQuery(self._client)

retrieve(external_id, space=DEFAULT_INSTANCE_SPACE, as_child_class=None)

retrieve(external_id: str, space: str = DEFAULT_INSTANCE_SPACE, as_child_class: SequenceNotStr[Literal['Implementation1', 'Implementation1NonWriteable', 'Implementation2']] | None = None) -> SubInterface | None
retrieve(external_id: SequenceNotStr[str], space: str = DEFAULT_INSTANCE_SPACE, as_child_class: SequenceNotStr[Literal['Implementation1', 'Implementation1NonWriteable', 'Implementation2']] | None = None) -> SubInterfaceList

Retrieve one or more sub interfaces by id(s).

Parameters:

Name Type Description Default
external_id str | SequenceNotStr[str]

External id or list of external ids of the sub interfaces.

required
space str

The space where all the sub interfaces are located.

DEFAULT_INSTANCE_SPACE
as_child_class SequenceNotStr[Literal['Implementation1', 'Implementation1NonWriteable', 'Implementation2']] | None

If you want to retrieve the sub interfaces as a child class, you can specify the child class here. Note that if one node has properties in multiple child classes, you will get duplicate nodes in the result.

None

Returns:

Type Description
SubInterface | SubInterfaceList | None

The requested sub interfaces.

Examples:

Retrieve sub_interface by id:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> sub_interface = client.sub_interface.retrieve("my_sub_interface")
Source code in examples/omni/_api/sub_interface.py
def retrieve(
    self,
    external_id: str | SequenceNotStr[str],
    space: str = DEFAULT_INSTANCE_SPACE,
    as_child_class: (
        SequenceNotStr[Literal["Implementation1", "Implementation1NonWriteable", "Implementation2"]] | None
    ) = None,
) -> SubInterface | SubInterfaceList | None:
    """Retrieve one or more sub interfaces by id(s).

    Args:
        external_id: External id or list of external ids of the sub interfaces.
        space: The space where all the sub interfaces are located.
        as_child_class: If you want to retrieve the sub interfaces as a child class,
            you can specify the child class here. Note that if one node has properties in
            multiple child classes, you will get duplicate nodes in the result.

    Returns:
        The requested sub interfaces.

    Examples:

        Retrieve sub_interface by id:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> sub_interface = client.sub_interface.retrieve("my_sub_interface")

    """
    return self._retrieve(external_id, space, as_child_class=as_child_class)

search(query, properties=None, main_value=None, main_value_prefix=None, sub_value=None, sub_value_prefix=None, external_id_prefix=None, space=None, limit=DEFAULT_LIMIT_READ, filter=None, sort_by=None, direction='ascending', sort=None)

Search sub interfaces

Parameters:

Name Type Description Default
query str

The search query,

required
properties SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None

The property to search, if nothing is passed all text fields will be searched.

None
main_value str | list[str] | None

The main value to filter on.

None
main_value_prefix str | None

The prefix of the main value to filter on.

None
sub_value str | list[str] | None

The sub value to filter on.

None
sub_value_prefix str | None

The prefix of the sub value to filter on.

None
external_id_prefix str | None

The prefix of the external ID to filter on.

None
space str | list[str] | None

The space to filter on.

None
limit int

Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.

DEFAULT_LIMIT_READ
filter Filter | None

(Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.

None
sort_by SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None

The property to sort by.

None
direction Literal['ascending', 'descending']

The direction to sort by, either 'ascending' or 'descending'.

'ascending'
sort InstanceSort | list[InstanceSort] | None

(Advanced) If sort_by and direction are not sufficient, you can write your own sorting. This will override the sort_by and direction. This allowos you to sort by multiple fields and specify the direction for each field as well as how to handle null values.

None

Returns:

Type Description
SubInterfaceList

Search results sub interfaces matching the query.

Examples:

Search for 'my_sub_interface' in all text properties:

    >>> from omni import OmniClient
    >>> client = OmniClient()
    >>> sub_interfaces = client.sub_interface.search('my_sub_interface')
Source code in examples/omni/_api/sub_interface.py
def search(
    self,
    query: str,
    properties: SubInterfaceTextFields | SequenceNotStr[SubInterfaceTextFields] | None = None,
    main_value: str | list[str] | None = None,
    main_value_prefix: str | None = None,
    sub_value: str | list[str] | None = None,
    sub_value_prefix: str | None = None,
    external_id_prefix: str | None = None,
    space: str | list[str] | None = None,
    limit: int = DEFAULT_LIMIT_READ,
    filter: dm.Filter | None = None,
    sort_by: SubInterfaceFields | SequenceNotStr[SubInterfaceFields] | None = None,
    direction: Literal["ascending", "descending"] = "ascending",
    sort: InstanceSort | list[InstanceSort] | None = None,
) -> SubInterfaceList:
    """Search sub interfaces

    Args:
        query: The search query,
        properties: The property to search, if nothing is passed all text fields will be searched.
        main_value: The main value to filter on.
        main_value_prefix: The prefix of the main value to filter on.
        sub_value: The sub value to filter on.
        sub_value_prefix: The prefix of the sub value to filter on.
        external_id_prefix: The prefix of the external ID to filter on.
        space: The space to filter on.
        limit: Maximum number of sub interfaces to return. Defaults to 25. Set to -1, float("inf") or None to return all items.
        filter: (Advanced) If the filtering available in the above is not sufficient, you can write your own filtering which will be ANDed with the filter above.
        sort_by: The property to sort by.
        direction: The direction to sort by, either 'ascending' or 'descending'.
        sort: (Advanced) If sort_by and direction are not sufficient, you can write your own sorting.
            This will override the sort_by and direction. This allowos you to sort by multiple fields and
            specify the direction for each field as well as how to handle null values.

    Returns:
        Search results sub interfaces matching the query.

    Examples:

       Search for 'my_sub_interface' in all text properties:

            >>> from omni import OmniClient
            >>> client = OmniClient()
            >>> sub_interfaces = client.sub_interface.search('my_sub_interface')

    """
    filter_ = _create_sub_interface_filter(
        self._view_id,
        main_value,
        main_value_prefix,
        sub_value,
        sub_value_prefix,
        external_id_prefix,
        space,
        filter,
    )
    return self._search(
        query=query,
        properties=properties,
        filter_=filter_,
        limit=limit,
        sort_by=sort_by,  # type: ignore[arg-type]
        direction=direction,
        sort=sort,
    )

SubInterfaceQueryAPI

Bases: QueryAPI[T_DomainModelList]

Source code in examples/omni/_api/sub_interface_query.py
class SubInterfaceQueryAPI(QueryAPI[T_DomainModelList]):
    _view_id = dm.ViewId("pygen-models", "SubInterface", "1")

    def __init__(
        self,
        client: CogniteClient,
        builder: QueryBuilder[T_DomainModelList],
        filter_: dm.filters.Filter | None = None,
        limit: int = DEFAULT_QUERY_LIMIT,
    ):
        super().__init__(client, builder)
        from_ = self._builder.get_from()
        self._builder.append(
            NodeQueryStep(
                name=self._builder.create_name(from_),
                expression=dm.query.NodeResultSetExpression(
                    from_=from_,
                    filter=filter_,
                ),
                result_cls=SubInterface,
                max_retrieve_limit=limit,
            )
        )

    def query(
        self,
    ) -> T_DomainModelList:
        """Execute query and return the result.

        Returns:
            The list of the source nodes of the query.

        """
        return self._query()

query()

Execute query and return the result.

Returns:

Type Description
T_DomainModelList

The list of the source nodes of the query.

Source code in examples/omni/_api/sub_interface_query.py
def query(
    self,
) -> T_DomainModelList:
    """Execute query and return the result.

    Returns:
        The list of the source nodes of the query.

    """
    return self._query()