pyodbc
pyodbc copied to clipboard
pyodbc dead kernel when fetching rows
- Python: 64 bit (i think)
- pyodbc: 4.0.0
- OS: windows
- DB: honeywell PHD
- driver: PHD Driver x64
So I am pretty new to python and pyodbc, apologies in advance if I don't know the right question to ask.
Basically I am trying to connect to our production historian (PHD), a Honeywell product. I already had the PHD Driver installed on my computer. I can use pyodbc to connect to the server and retrieve most data, but some fail.
Observed Issue: connstring = str('Driver={PHD Server x64}; Server=xxxx) conn = pyodbc.connect(connstring, autocommit=True) cursor = conn.cursor() query = "select value from PHD_DATA where tagno = '36964' and start_timestamp = 'Now-::1'" conn.add_output_converter(pyodbc.SQL_BINARY, handlefloats) cursor = conn.cursor() cursor.execute(query).fetchall()
When running this code my Jupyter notebook kernel thinks for about 3s and then I get a "Dead Kernel" error. No errors on the screen. If I substitute tagno = '39012' then all values return data normally. These two tags are different in that 39012 is a float type, 36964 is an integer type. Using the same syntax I can return any data of float or unicode types, but no integer types. The VALUE column I'm selecting has a "Variable 65534" data type.
If I run all the above code without doing any fetch command (i.e. just cursor.execute(query)) the code executes fine. Even when i set tagno = 36964 i can execute the query, and even return cursor.description = (('VALUE', bytearray, None, 32500, 32500, 255, True),). I can return other columns from this tagno, i.e. tagname, timestamp, data type etc, just not the Value column.
On the other float type tags, when it returns Value i get a byte string of length 4096. The first 4 bytes are the float itself which is why I have the output converter. (FWIW the same issue occurs with and without the converter). The rest of the returned value is a mix of bytes like \x00\x00 and some regular text, there is a bunch of python related text in there, a small part is copied below: b'!\xda\x1bCB C\n 0 0 2 3\n 1 0 4 1\n 2 10 20 30\n\n Get value at specified row/column pair\n\n >>> df.iat[1, 2]\n 1\n\n Set value at specified row/column pair\n\n >>> df.iat[1, 2] = 10\n >>> df.iat[1, 2]\n 10\n\n Get value within a series\n\n >>> df.loc[0].iat[1]\n 2\n\x00 Examples\n ----{\xd3\x9f\x15\n\x11\x00\x80 >>> df = pd.DataFrame([('falcon', 'bird', 389.0, 2),\n
I have another Honeywell program that uses a .NET interface to the same server and so I know there is data associated with this tag.
I have run an odbc trace when executing the above code for the good tag 39012 (SQL - successful value.log) and the bad tag 36964 (SQL.log). On the bad tag I can see the log just stops on the SQLGetData call, there is no response from the server. This section is identical to the good tag trace. SQL.LOG SQL- successful value.LOG
I haven't been able to find any documentation on the Honeywell PHD Driver, could this be the problem?? Any ideas?
Does this work from a standard cpython interpreter?, your kernel crashed, it means you got a low level exception inside jupyter.