I’m trying the ODBC driver with pyodbc and I’ve found out that whenever the query I run is invalid for whatever reason (wrong table name, invalid query format, etc) I get a segmentation fault.
I’m guessing that the driver isn’t able to handle errors returned by Dremio. Valid queries run fine and return values.
I’ve tried this on Mac OS and in an Ubuntu docker container.
Example queries:
“select now()” -> runs fine
"select nowasdf()" -> segmentation fault
"select * from existing_source.existing_table" -> runs fine
"select * from existing_source.not_existing_table" -> segmentation fault
"invalid query" -> segmentation fault
Code:
import pyodbc
host = 'myhost
port = 31010
user = 'myuser’
password = ‘mypass’
I’ve tried using isql and all of the invalid queries return “[ISQL]ERROR: Could not SQLPrepare”. This is with the verbose flag. I’m not sure if that is how it is supposed to work of if it supposed to return more detailed errors like “Table not found”. Valid queries run fine.
I’ve attached the logs created after running the python script.
We haven’t fully identified the root cause, but it seems specific to pyodbc 4.0. If you have the opportunity, can you give pyodbc 3.x a chance? in our testing with it, error handling looked fine.
Laurent thank you for your help. I’ve tried pyodbc 3.1.1 and it works correctly in my Macbook but it still does not work on the Ubuntu container. It still throws a segmentation fault. I have also tried pyodbc 2.1.11 in the Ubuntu container and it doesn’t work either.