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, display_mode, entity_class_display_mode, superclass_subclass, entity, entity_group, entity_alternative, parameter_value_list, list_value, parameter_type, parameter_group, parameter_definition, parameter_value, metadata, entity_metadata, parameter_value_metadata, entity_location. 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. |
entity_class_byname |
tuple |
A tuple with the class name as single element if the class is 0-dimensional, or the 0-dimensional class names if it is multi-dimensional. |
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 |
display_mode
field |
type |
value |
|---|---|---|
name |
str |
The display mode name. |
description |
str, optional |
The display mode description. |
name |
entity_class_display_mode
field |
type |
value |
|---|---|---|
entity_class_name |
str |
The entity class name. |
display_mode_name |
int |
The display mode name. |
display_order |
int |
The display order. |
display_status |
str |
The display status; one of ‘visible’, ‘hidden’ or ‘greyed_out’. |
display_font_color |
str, optional |
The color of the font. |
display_background_color |
str, optional |
The color of the background. |
entity_class_name, display_mode_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 0-dimensional, or the 0-dimensional element names if it is multi-dimensional. |
description |
str, optional |
The entity description. |
lat |
float, optional |
The latitude of entity. |
lon |
float, optional |
The longitude of entity. |
alt |
float, optional |
The altitude of entity. |
shape_name |
str, optional |
The name of the entity’s shape. |
shape_blob |
str, optional |
The shape as GEOJSON string. |
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 0-dimensional, or the 0-dimensional element names if it 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’s database representation. |
type |
str, optional |
The value’s type. |
parsed_value |
ParameterValue, optional |
The value. |
index |
int, optional |
The value index. |
parameter_value_list_name, value_and_type |
parameter_value_list_name, index |
parameter_type
field |
type |
value |
|---|---|---|
entity_class_name |
str |
The entity class name. |
parameter_definition_name |
str |
The parameter name. |
rank |
int |
The rank of the type. |
type |
str |
The value type. |
entity_class_name, parameter_definition_name, type, rank |
parameter_group
field |
type |
value |
|---|---|---|
name |
str |
The parameter group name. |
color |
str |
Group’s color as HEX. |
priority |
int |
Group’s priority. |
name |
parameter_definition
field |
type |
value |
|---|---|---|
entity_class_name |
str |
The entity class name. |
name |
str |
The parameter name. |
parameter_group_name |
str, optional |
The name of the group of the parameter. |
parameter_type_list |
tuple, optional |
List of valid value types. |
default_value |
bytes, optional |
The default value’s database representation. |
default_type |
str, optional |
The default value’s type. |
parsed_value |
ParameterValue, optional |
The default value. |
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 0-dimensional, or the 0-dimensional element names if it is multi-dimensional. |
value |
bytes |
The value’s database representation. |
type |
str, optional |
The value’s type. Optional only when value is null. |
parsed_value |
ParameterValue, optional |
The value. |
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 0-dimensional, or the 0-dimensional element names if it 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 0-dimensional, or the 0-dimensional element names if it 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 |
entity_location
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 0-dimensional, or the 0-dimensional element names if it is multi-dimensional. |
lat |
float, optional |
Latitude. |
lon |
float, optional |
Longitude. |
alt |
float, optional |
Altitude. |
shape_name |
str, optional |
Name identifying the shape. |
shape_blob |
str, optional |
Shape as GEOJSON feature. |
entity_class_name, entity_byname |