NeatSession#
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#
Presents issues and insights found during the session operations.result#
Holds the result of the last executed operation in the session.Physical Data Model#
Reading Physical Data Models#
Read physical data model from various sources into NeatSession store.
Available methods:
neat.physical_data_model.read.yamlneat.physical_data_model.read.jsonneat.physical_data_model.read.excelneat.physical_data_model.read.cdf
yaml #
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 #
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 #
Read physical data model from Excel file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
io |
Any
|
The file path or buffer to read from. |
required |
cdf #
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.yamlneat.physical_data_model.write.jsonneat.physical_data_model.write.excelneat.physical_data_model.write.cdf
yaml #
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 #
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 #
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 #
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
additivemode, 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
rebuildmode, 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 asadditiveand will not delete any containers or remove properties, indexes, or constraints. To fully rebuild the data model, including containers, set drop_data to True.