0 points read - openHistorian python

Hello, I am trying out the open historian python library, the connection is successful but I’m not receiving any data points from the PMUs. Can someone please help me out? Attached is the code and it’s output.

def readTest():
# Create historian connection (the root API object)
historian = historianConnection(“”)
instance: Optional[historianInstance] = None

    print("Connecting to openHistorian...")

    if not historian.IsConnected or len(historian.InstanceNames) == 0:
        print("No openHistorian instances detected!")
        # Get first historian instance
        initialInstance = historian.InstanceNames[0]

        print(f"Opening \"{initialInstance}\" database instance...")
        instance = historian.OpenInstance(initialInstance)
        # Get a reference to the openHistorian metadata cache
        metadata = historian.Metadata

        # Lookup measurements that represent frequency values
        records = metadata.GetMeasurementsBySignalType(SignalType.FREQ, instance.Name)
        recordCount = len(records)

        print(f"Queried {recordCount:,} metadata records associated with \"{instance.Name}\" database instance.")

        if recordCount > 0:
            pointIDList = metadataCache.ToPointIDList(records)

            # Execute a test read for data archived ten seconds ago
            endTime = datetime.utcnow().replace(microsecond=0, second=0) - timedelta(minutes = 5)
            startTime = endTime - timedelta(minutes = 5)

            print(f"Starting read for {len(pointIDList):,} points from {startTime} to {endTime}...\r\n")

            TestRead(instance, historian.Metadata, startTime, endTime, pointIDList)
except Exception as ex:
    print(f"Failed to connect: {ex}")
    if instance is not None:

    if historian.IsConnected:
        print("Disconnecting from openHistorian")


def TestRead(instance: historianInstance, metadata: metadataCache, startTime: datetime, endTime: datetime, pointIDList: List[np.uint64]):
timeFilter = timestampSeekFilter.CreateFromRange(startTime, endTime)
pointFilter = pointIDMatchFilter.CreateFromList(pointIDList)

opStart = time()
reader = instance.Read(timeFilter, pointFilter)
count = 0

key = historianKey()
value = historianValue()

while reader.Read(key, value):
    count += 1
    print(f"    Point {key.ToString(metadata)} = {value.ToString()}")

print(f"\r\nRead complete for {count:,} points in {(time() - opStart):.2f} seconds.\r\n")

if name == “main”:


Hi David,

Looks like it’s making a connection OK, which is good. From the code / output looks you are trying to query a single Frequency value.

Any chance that there is no data in the time range you selected for that value?

Have you tried the built-in web trending tool to verify you see data in that same range? See:


Thanks Ritchie. There’s data available. I’m new to the python library. Please how do I query all data points for all devices instead of a single value?

Kind Regards

I was finally able to get some data. It seems my point ID list is not correct. I manually appended a correct one. I do not know why the point ID list is wrong though

1 Like