Skip to content

Commit

Permalink
fix some notes-to-self + pre-commit update
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonvt committed Sep 14, 2024
1 parent 3d6c419 commit 1c9fc77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
rev: v0.6.5
hooks:
- id: ruff
args:
Expand Down
6 changes: 3 additions & 3 deletions cognite/client/_api/data_modeling/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,13 @@ def apply(
>>> my_date = datetime(2020, 3, 14, 15, 9, 26, 535000, tzinfo=timezone.utc)
>>> data_model_timestamp = datetime_to_ms_iso_timestamp(my_date) # "2020-03-14T15:09:26.535+00:00"
Create a typed node. Any property that you want to look up by a different attribute name, e.g. you want
Create a typed node apply. Any property that you want to look up by a different attribute name, e.g. you want
`my_node.birth_year` to return the data for property `birthYear`, must use the PropertyOptions as shown below.
We strongly suggest you use snake_cased attribute names, as is done here:
>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes.data_modeling import TypedNodeApply, PropertyOptions
>>> class Person(TypedNodeApply):
>>> class PersonApply(TypedNodeApply):
... birth_year = PropertyOptions(identifier="birthYear")
...
... def __init__(self, space: str, external_id, name: str, birth_year: int):
Expand All @@ -946,7 +946,7 @@ def apply(
... def get_source(self):
... return ViewId("sp_model_space", "Person", "v1")
...
>>> person = Person("sp_date_space", "my_person", "John Doe", 1980)
>>> person = PersonApply("sp_date_space", "my_person", "John Doe", 1980)
>>> res = client.data_modeling.instances.apply(nodes=person)
"""
other_parameters = {
Expand Down

0 comments on commit 1c9fc77

Please sign in to comment.