Naming
cognite.pygen.config.NamingConfig
dataclass
The configuration of the naming used by pygen.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field
|
FieldNaming
|
The naming convention for the generated fields used in the data classes. |
FieldNaming()
|
data_class
|
DataClassNaming
|
The naming convention for the generated data classes. |
DataClassNaming()
|
api_class
|
APIClassNaming
|
The naming convention for the generated API classes. |
APIClassNaming()
|
multi_api_class
|
MultiAPIClassNaming
|
The naming convention for the generated multi API classes (Used when generating an SDK for multiple data models). |
MultiAPIClassNaming()
|
Source code in cognite/pygen/config/naming.py
cognite.pygen.config.FieldNaming
dataclass
Naming convention for fields.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Naming
|
Naming convention for data class fields. Data class fields are the attributes of the data classes and are generated from the properties of the view. |
Naming(snake, unchanged)
|
variable
|
Naming
|
Naming convention for data class field variables. This is used, for example, in the internals implementation of the API class. |
Naming(snake, singular)
|
edge_api_class
|
Naming
|
Naming convention for edge API class names. The edge API class name will be suffixed with "API". |
Naming(pascal, unchanged)
|
api_class_attribute
|
Naming
|
Naming convention for edge API class attributes. |
Naming(snake, unchanged)
|
Source code in cognite/pygen/config/naming.py
cognite.pygen.config.DataClassNaming
dataclass
Naming convention for data classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Naming
|
Naming convention for data class names. Pygen will create two data classes one for reading and one for writing. The writing class will be suffixed with "Apply". In addition, pygen will also create a list class, suffixed with "List". |
Naming(pascal, unchanged)
|
file
|
Naming
|
Naming convention for data class file. This will be prefixed with an underscore. |
Naming(snake, unchanged)
|
variable
|
Naming
|
Naming convention for data class variable. This is used, for example, in as the parameter name in the apply method of the API class. |
Naming(snake, singular)
|
variable_list
|
Naming
|
Naming convention for data class variable list. This is used, for example, in the internals implementation of the API class. |
Naming(snake, plural)
|
Examples:
If we have a data model with two views, with name "My view" and "My other view", we will generate two API classes, with name as singular pascal case. The generated data classes will be available:
Source code in cognite/pygen/config/naming.py
cognite.pygen.config.APIClassNaming
dataclass
Naming convention for API classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Naming
|
Naming convention for API class names. The api class name will be suffixed with "API". |
Naming(pascal, unchanged)
|
file_name
|
Naming
|
Naming convention for the file name of the API class. |
Naming(snake, unchanged)
|
client_attribute
|
Naming
|
Naming convention for the client attribute. |
Naming(snake, unchanged)
|
variable
|
Naming
|
Naming convention for the API class variable. |
Naming(snake, singular)
|
Examples:
If we have a data model with two views, "MyView" and "MyOtherView", we will generate two API classes, with client attribute as plural snake case, and name as pascal case plural. The generated client will then get the following attributes:
from cognite import pygen
my_client = pygen.generate_sdk_notebook(...)
# my_client.[client_attribute].list()/.retrieve()/.apply/.delete()
my_client.my_views.list()
# and
my_client.my_other_views.list()
Source code in cognite/pygen/config/naming.py
cognite.pygen.config.MultiAPIClassNaming
dataclass
Naming convention for a set of API classes created from a data model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_attribute
|
Naming
|
Naming convention for the client attribute. |
Naming(snake, unchanged)
|
name
|
Naming
|
Naming convention for the API class names. The api class name will be suffixed with "APIs". |
Naming(pascal, singular)
|
Examples:
If we have a data model with two views, "MyView" and "MyOtherView", we will generate two API classes, with client attribute as plural snake case, and name as pascal case plural. The generated client will then get the following attributes:
from cognite import pygen
my_client = pygen.generate_sdk_notebook(...)
# my_client.[client_attribute].list()/.retrieve()/.apply/.delete()
my_client.my_views.list()
# and
my_client.my_other_views.list()
Source code in cognite/pygen/config/naming.py
cognite.pygen.config.Naming
dataclass
cognite.pygen.config.Case
Bases: Enum
Available case conventions.
For example, if we have the name `work order, we have the following options:
- pascal ➔ "WorkOrder"
- snake ➔ "work_order"
- camel ➔ "workOrder"
Attributes:
Name | Type | Description |
---|---|---|
pascal |
Pascal case. |
|
snake |
Snake case. |
|
camel |
Camel case. |
Source code in cognite/pygen/config/naming.py
cognite.pygen.config.Number
Bases: Enum
Available number conventions. The number convention is used to determine if a name should be singular or plural.
For example, if we have the name "asset", we have the following options:
- plural ➔ "assets"
- singular ➔ "asset"
- unchanged ➔ "asset"
Attributes:
Name | Type | Description |
---|---|---|
plural |
The name should be pluralized. |
|
singular |
The name should be singularized. |
|
unchanged |
The name should remain unchanged. |