spinedb_api.mapped_items

Module Contents

Classes

CommitItem

A dictionary that represents a db item.

EntityClassItem

A dictionary that represents a db item.

EntityItem

A dictionary that represents a db item.

EntityGroupItem

A dictionary that represents a db item.

EntityAlternativeItem

A dictionary that represents a db item.

ParsedValueBase

A dictionary that represents a db item.

ParameterItemBase

A dictionary that represents a db item.

ParameterDefinitionItem

A dictionary that represents a db item.

ParameterValueItem

A dictionary that represents a db item.

ParameterValueListItem

A dictionary that represents a db item.

ListValueItem

A dictionary that represents a db item.

AlternativeItem

A dictionary that represents a db item.

ScenarioItem

A dictionary that represents a db item.

ScenarioAlternativeItem

A dictionary that represents a db item.

MetadataItem

A dictionary that represents a db item.

EntityMetadataItem

A dictionary that represents a db item.

ParameterValueMetadataItem

A dictionary that represents a db item.

SuperclassSubclassItem

A dictionary that represents a db item.

class spinedb_api.mapped_items.CommitItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

commit(commit_id)[source]

Sets this item as committed with the given commit id.

class spinedb_api.mapped_items.EntityClassItem(*args, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

polish()[source]

Polishes this item once all it’s references have been resolved. Returns any error.

The base implementation sets defaults but subclasses can do more work if needed.

Returns:

error description if any.

Return type:

str or None

merge(other)[source]

Merges this item with another and returns the merged item together with any errors. Used for updating items.

Parameters:

other (dict) – the item to merge into this.

Returns:

merged item. str: error description if any.

Return type:

dict

commit(_commit_id)[source]

Sets this item as committed with the given commit id.

class spinedb_api.mapped_items.EntityItem(*args, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

classmethod unique_values_for_item(item, skip_keys=())[source]

Overridden to also yield unique values for the superclass.

resolve_internal_fields(skip_keys=())[source]

Overriden to translate byname into element name list.

polish()[source]

Polishes this item once all it’s references have been resolved. Returns any error.

The base implementation sets defaults but subclasses can do more work if needed.

Returns:

error description if any.

Return type:

str or None

class spinedb_api.mapped_items.EntityGroupItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

commit(_commit_id)[source]

Sets this item as committed with the given commit id.

class spinedb_api.mapped_items.EntityAlternativeItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.ParsedValueBase(*args, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

update(other)[source]

Overridden to update the item status and also to invalidate references that become obsolete.

class spinedb_api.mapped_items.ParameterItemBase(*args, **kwargs)[source]

Bases: ParsedValueBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

classmethod ref_types()[source]

Returns a set of item types that this class refers.

Returns:

set(str)

polish()[source]

Polishes this item once all it’s references have been resolved. Returns any error.

The base implementation sets defaults but subclasses can do more work if needed.

Returns:

error description if any.

Return type:

str or None

class spinedb_api.mapped_items.ParameterDefinitionItem(*args, **kwargs)[source]

Bases: ParameterItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

merge(other)[source]

Merges this item with another and returns the merged item together with any errors. Used for updating items.

Parameters:

other (dict) – the item to merge into this.

Returns:

merged item. str: error description if any.

Return type:

dict

class spinedb_api.mapped_items.ParameterValueItem(*args, **kwargs)[source]

Bases: ParameterItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.ParameterValueListItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.ListValueItem(*args, **kwargs)[source]

Bases: ParsedValueBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.AlternativeItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.ScenarioItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.ScenarioAlternativeItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.MetadataItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.EntityMetadataItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.ParameterValueMetadataItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

class spinedb_api.mapped_items.SuperclassSubclassItem(db_map, item_type, **kwargs)[source]

Bases: spinedb_api.db_mapping_base.MappedItemBase

A dictionary that represents a db item.

Parameters:

db_map (DatabaseMappingBase) – the DB where this item belongs.

check_mutability()[source]

Called before adding, updating, or removing this item. Returns any errors that prevent that.

Returns:

error description if any.

Return type:

str or None

commit(_commit_id)[source]

Sets this item as committed with the given commit id.