Skip to content

NeatSession#

neat = NeatSession(client: CogniteClient, config: Optional[NeatConfig] = None)

Initialize a Neat session.

Parameters:

Name Type Description Default
client CogniteClient | ClientConfig

The Cognite client or client configuration to use for the session.

required
config Literal[legacy - additive, legacy - rebuild, deep - additive, deep - rebuild] | NeatConfig

The configuration profile to use for the session. Defaults to "legacy-additive". This means Neat will perform additive modeling and apply only validations that were part of the legacy Neat version.

'legacy-additive'

issues#

neat.issues
Presents issues and insights found during the session operations.

result#

neat.result
Holds the result of the last executed operation in the session.

Physical Data Model#

neat.physical_data_model

Reading Physical Data Models#

Read physical data model from various sources into NeatSession store.

Available methods:

  • neat.physical_data_model.read.yaml
  • neat.physical_data_model.read.json
  • neat.physical_data_model.read.excel
  • neat.physical_data_model.read.cdf

yaml #

yaml(io: Any, format: Literal['neat', 'toolkit'] = 'neat') -> None

Read physical data model from YAML file(s)

Parameters:

Name Type Description Default
io Any

The file or directory path or buffer to read from.

required
format Literal['neat', 'toolkit']

The format of the input file(s). - "neat": Neat's DMS table format. - "toolkit": Cognite DMS API format which is the format used by Cognite Toolkit.

'neat'

json #

json(io: Any, format: Literal['neat', 'toolkit'] = 'neat') -> None

Read physical data model from JSON file(s)

Parameters:

Name Type Description Default
io Any

The file or directory path or buffer to read from.

required
format Literal['neat', 'toolkit']

The format of the input file(s). - "neat": Neat's DMS table format. - "toolkit": Cognite DMS API format which is the format used by Cognite Toolkit.

'neat'

excel #

excel(io: Any) -> None

Read physical data model from Excel file

Parameters:

Name Type Description Default
io Any

The file path or buffer to read from.

required

cdf #

cdf(space: str, external_id: str, version: str) -> None

Read physical data model from CDF

Parameters:

Name Type Description Default
space str

The schema space of the data model.

required
external_id str

The external id of the data model.

required
version str

The version of the data model.

required

Writing Physical Data Models#

Write physical data model to various sources from NeatSession store.

Available methods:

  • neat.physical_data_model.write.yaml
  • neat.physical_data_model.write.json
  • neat.physical_data_model.write.excel
  • neat.physical_data_model.write.cdf

yaml #

yaml(io: Any, format: Literal['neat', 'toolkit'] = 'neat') -> None

Write physical data model to YAML file

Parameters:

Name Type Description Default
io Any

The file path or buffer to write to.

required
format Literal['neat', 'toolkit']

The format of the output file - "neat": Neat's DMS table format. - "toolkit": Cognite DMS API format which is the format used by Cognite Toolkit.

'neat'

json #

json(io: Any, format: Literal['neat', 'toolkit'] = 'neat') -> None

Write physical data model to JSON file

Parameters:

Name Type Description Default
io Any

The file path or buffer to write to.

required
format Literal['neat', 'toolkit']

The format of the output file - "neat": Neat's DMS table format. - "toolkit": Cognite DMS API format which is the format used by Cognite Toolkit.

'neat'

excel #

excel(io: Any, skip_other_spaces: bool = True) -> None

Write physical data model to Excel file

Parameters:

Name Type Description Default
io Any

The file path or buffer to write to.

required
skip_other_spaces bool

If true, only properties in the same space as the data model will be written.

True

cdf #

cdf(dry_run: bool = True, rollback: bool = False, drop_data: bool = False) -> None

Write physical data model with views, containers, and spaces that are in the same space as the data model to CDF.

Parameters:

Name Type Description Default
dry_run bool

If true, the changes will not be applied to CDF. Instead, Neat will report what changes would have been made.

True
rollback bool

If true, all changes will be rolled back if any error occurs.

False
drop_data bool

Only applicable if the session mode is 'rebuild'. If

False

Impact of governance profile

This method depends on the session governance profile for data modeling set when creating the NeatSession:

  • In additive mode, only new or updates to data models/views/containers will be applied. You cannot remove views from data models, properties from views or containers, or indexes or constraints from containers.

  • In rebuild mode, the data model in CDF will be made to exactly match the data model in Neat. If there are any breaking changes, Neat will delete and recreate the relevant data model/view/container. However, if drop_data is set to False, Neat will treat containers as additive and will not delete any containers or remove properties, indexes, or constraints. To fully rebuild the data model, including containers, set drop_data to True.