turbodbc
turbodbc copied to clipboard
Expose building blocks of error messages in exceptions
lets say i have something like below
def connect():
try:
connection = turbodbc.connect(dsn='turbodbc', parameter_sets_to_buffer=100000, rows_to_buffer=100000, use_async_io=True)
connection.autocommit = True
except turbodbc.exceptions.Error, e:
sys.exit(e)
else:
return connection
This could output something like this:
ODBC error
state: HY000
native error code: -1
message: [unixODBC][EXASOL][EXASolution driver]Operation timed out
Is there a native way of getting message?
Hi again :-). First of all, it seems like you are using a current version of turbodbc (autocommit
tells me that). Please make sure to use the matching style of specifying performance options (http://turbodbc.readthedocs.io/en/latest/pages/advanced_usage.html#performance-compatibility-and-behavior-options). The way you do it is marked as deprecated and will be removed in version 2.0.0 that is released soon.
That being said, I have difficulties understanding your question. Could you print the entire stacktrace you see, because I don't know which operation is the one timing out. Also, I don't understand what you mean by "a native way of getting message". Could you please clarify?
Thank you! i want to insert the error messages into a database and i was thereby wondering if it was possible to parse only the method or is this something that needs to be handled using string parsing or etc.
Sorry for the confusion, i'm new to python.
Thank you in advance
I think I start to get what you would like to do :-). So when an error occurs, you want to store some meaningful part of the exception in the database, i.e., without "ODBC error" and any formatting turbodbc does. Is that what you are trying to do?
Currently, only the formatted error message is available, I am afraid. Making the building blocks like the error message or the status codes available could be a feature, though.
This exactly what i would like to do :+1: