Skip to main content
Version: V3 (Ignition 8.3)

tamaki.mes.backup.compare.ResultRow

Description

ResultRow is a class representing a single change detected during a backup comparison: an entity or field that was added, removed, or updated. The comparison functions in this package return lists of ResultRow instances. Each row stores the affected field, its oldValue and newValue, a changeType label, and optionally the entityType and a keyDict of the entity's identifying key fields.

Constructor

tamaki.mes.backup.compare.ResultRow(field, oldValue, newValue, changeType, entityType=None, keyDict=None)
ParameterTypeNullableDescription
fieldStringTrueThe name of the field that changed. None for whole-entity changes.
oldValueObjectTrueThe previous value.
newValueObjectTrueThe new value.
changeTypeStringFalseA label describing the change: one of field add, field remove, field update, entity add, entity remove, entity type add, or entity type remove.
entityTypeStringTrueThe entity type (for example locations). Stored as a string; None if not provided.
keyDictDictTrueThe key fields and values identifying the entity (for example {"path": "Site/A"}).

Attributes

The constructor stores each argument as an attribute of the same name: entityType, keyDict, field, oldValue, newValue, and changeType.

Methods

getRowDict()

Returns a dictionary representation suitable for building a dataset row. The base dictionary contains entityType, field, oldValue, newValue, and changeType. If keyDict is set, its entries are merged in (and override any base key of the same name).

Code Examples

row = tamaki.mes.backup.compare.ResultRow(
field="description",
oldValue="Old",
newValue="New",
changeType="field update",
entityType="locations",
keyDict={"path": "Site/A"}
)
print(row.getRowDict())
# {'entityType': 'locations', 'field': 'description', 'oldValue': 'Old',
# 'newValue': 'New', 'changeType': 'field update', 'path': 'Site/A'}