DB mapping schema
The DB mapping schema is a close cousin of the Spine DB schema with some extra flexibility, like the ability to specify references by name rather than by numerical id.
The schema defines the following item types: alternative
, scenario
, scenario_alternative
, entity_class
, superclass_subclass
, entity
, entity_group
, entity_alternative
, parameter_value_list
, list_value
, parameter_definition
, parameter_value
, metadata
, entity_metadata
, parameter_value_metadata
. As you can see, these follow the names of some of the tables in the Spine DB schema.
The following subsections provide all the details you need to know about the different item types, namely, their fields, values, and unique keys.
alternative
field |
type |
value |
---|---|---|
name |
str |
The alternative name. |
description |
str, optional |
The alternative description. |
name |
scenario
field |
type |
value |
---|---|---|
name |
str |
The scenario name. |
description |
str, optional |
The scenario description. |
active |
bool, optional |
Not in use at the moment. |
name |
scenario_alternative
field |
type |
value |
---|---|---|
scenario_name |
str |
The scenario name. |
alternative_name |
str |
The alternative name. |
rank |
int |
The rank - higher has precedence. |
scenario_name, alternative_name |
scenario_name, rank |
entity_class
field |
type |
value |
---|---|---|
name |
str |
The class name. |
dimension_name_list |
tuple, optional |
The dimension names for a multi-dimensional class. |
description |
str, optional |
The class description. |
display_icon |
int, optional |
An integer representing an icon within your application. |
display_order |
int, optional |
Not in use at the moment. |
hidden |
int, optional |
Not in use at the moment. |
active_by_default |
bool, optional |
Default activity for the entity alternatives of the class. |
name |
superclass_subclass
field |
type |
value |
---|---|---|
superclass_name |
str |
The superclass name. |
subclass_name |
str |
The subclass name. |
subclass_name |
entity
field |
type |
value |
---|---|---|
entity_class_name |
str |
The entity class name. |
name |
str |
The entity name. |
element_name_list |
tuple |
The element names if the entity is multi-dimensional. |
entity_byname |
tuple |
A tuple with the entity name as single element if the entity is zero-dimensional,or the element names if it is multi-dimensional. |
description |
str, optional |
The entity description. |
entity_class_name, name |
entity_class_name, entity_byname |
entity_group
field |
type |
value |
---|---|---|
entity_class_name |
str |
The entity class name. |
group_name |
str |
The group entity name. |
member_name |
str |
The member entity name. |
entity_class_name, group_name, member_name |
entity_alternative
field |
type |
value |
---|---|---|
entity_class_name |
str |
The entity class name. |
entity_byname |
tuple |
A tuple with the entity name as single element if the entity is zero-dimensional, or the element names if the entity is multi-dimensional. |
alternative_name |
str |
The alternative name. |
active |
bool, optional |
Whether the entity is active in the alternative - defaults to True. |
entity_class_name, entity_byname, alternative_name |
parameter_value_list
field |
type |
value |
---|---|---|
name |
str |
The parameter value list name. |
name |
list_value
field |
type |
value |
---|---|---|
parameter_value_list_name |
str |
The parameter value list name. |
value |
bytes |
The value. |
type |
str, optional |
The value type. |
index |
int, optional |
The value index. |
parameter_value_list_name, value_and_type |
parameter_value_list_name, index |
parameter_definition
field |
type |
value |
---|---|---|
entity_class_name |
str |
The entity class name. |
name |
str |
The parameter name. |
default_value |
bytes, optional |
The default value. |
default_type |
str, optional |
The default value type. |
parameter_value_list_name |
str, optional |
The parameter value list name if any. |
description |
str, optional |
The parameter description. |
entity_class_name, name |
parameter_value
field |
type |
value |
---|---|---|
entity_class_name |
str |
The entity class name. |
parameter_definition_name |
str |
The parameter name. |
entity_byname |
tuple |
A tuple with the entity name as single element if the entity is zero-dimensional, or the element names if the entity is multi-dimensional. |
value |
bytes |
The value. |
type |
str, optional |
The value type. |
alternative_name |
str, optional |
The alternative name - defaults to ‘Base’. |
entity_class_name, parameter_definition_name, entity_byname, alternative_name |
metadata
field |
type |
value |
---|---|---|
name |
str |
The metadata entry name. |
value |
str |
The metadata entry value. |
name, value |
entity_metadata
field |
type |
value |
---|---|---|
entity_class_name |
str |
The entity class name. |
entity_byname |
tuple |
A tuple with the entity name as single element if the entity is zero-dimensional, or the element names if the entity is multi-dimensional. |
metadata_name |
str |
The metadata entry name. |
metadata_value |
str |
The metadata entry value. |
entity_class_name, entity_byname, metadata_name, metadata_value |
parameter_value_metadata
field |
type |
value |
---|---|---|
entity_class_name |
str |
The entity class name. |
parameter_definition_name |
str |
The parameter name. |
entity_byname |
tuple |
A tuple with the entity name as single element if the entity is zero-dimensional, or the element names if the entity is multi-dimensional. |
alternative_name |
str |
The alternative name. |
metadata_name |
str |
The metadata entry name. |
metadata_value |
str |
The metadata entry value. |
entity_class_name, parameter_definition_name, entity_byname, alternative_name, metadata_name, metadata_value |