

It seems that ODBC doesn't work at all with iHistorian, which makes the package 'pyodbc' not suitable for this as well. I also tried to use the package ' adodbapi', but I was not able to make it work. | timestamp | value | quality | tagname | In order to extract the data the following should suffice (I included 'prettytable' in order to get a decent print of the data): import PyADOĬonn = nnect(None,host='IHISTORIAN_SERVER_NAME',user='USERNAME',password='PASSWORD',provider='iHOLEDB.iHistorian.1')Ĭurs.execute("SELECT timestamp, value, quality, tagname FROM ihrawdata WHERE samplingmode=rawbytime AND timestamp>='0 13:58' AND timestamp<='0 14:30' AND (tagname=SOMETAG OR tagname=OTHERTAG)") For python 3 usage also update all print statements from 'print blabla' to 'print(blabla).

There are some errors in the code, fix this in the 'PyADO.py' file by replacing all the '' symbols for 'not equal' with '!='. The module is not available on PyPi, so just download it, extract it and put it in the 'site-packages' folder (or your current working directory). I used the python package ' PyADO' in order to connect to the OLE DB API (got this from GitHub Gist, also requires the packages 'win32com' and 'pythoncom'). Check whether the API is correctly installed with the 'Historian Interactive SQL' program included with iHistorian. In the manual you can find the available tables and some examples on SQL code.

You can use the OLE DB API included with the proficy iHistorian, see the manual of iHistorian.
