system.historian.storeMetadata
This function is used in Python Scripting.
Description​
Store a list of metadata to the specified historian. This function applies to the Core Historian and Internal Historian, and is not supported by SQL Historian.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax #1​
system.historian.storeMetadata(paths, timestamps, properties)
Parameters​
| Type | Parameter | Description |
|---|---|---|
| List | paths | A list of historical paths. |
| List | timestamps | A list of timestamps. |
| Dictionary | properties | A dictionary of desired properties to be stored as historical metadata, entered as defined key-value pairs corresponding to any relevant tag properties. |
Returns​
List - A list of QualityCode objects. The quality code will indicate success or failure.
Scope​
Gateway, Vision Client, Perspective Session
Syntax #2​
system.historian.storeMetadata(metadata)
Parameters​
| Type | Parameter | Description |
|---|---|---|
| List | metadata | A list of metadata java objects in the historian system that include the value, quality, timestamp, and source. |
Returns​
List - A list of QualityCode objects. The quality code will indicate success or failure.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Code Snippet 1: Syntax #1
# Store a single property to a specified historical tag path and log an info level formatted message.
paths = ["histprov:Historian:/sys:gw1:/prov:default:/tag:remote_200"]
curr = system.date.now()
timestamps = [curr]
properties = { "tooltip": "changing with perspective"}
results = system.historian.storeMetadata(paths, timestamps, properties)
system.util.getLogger('HistorianTest: storeMetadata').info(str(results))
Code Snippet 2: Syntax #1
# Store a list of properties to a specified historical tag path.
result = system.historian.storeMetadata(
paths=["histprov:CoreHistorian:/sys:gateway:/prov:default:/tag:Folder/MyTag"],
timestamps=[system.date.now()],
properties={
"engUnit": "degF",
"engLow": 0.0,
"engHigh": 500.0,
"documentation": "Main reactor temperature sensor",
"calibrationDate": "2024-01-15"
}
)