You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The logic of my script does not require me to return any results with fetchall(). I would like THROW_ERROR to just throw an error on execution.
To provide some help in diagnosing this issue, I noticed that when _execute_simple_query is called in cursor.py, the instance type of self._message (row 479) is RowDescription and notErrorResponse as it should be. I did some debugging and here is the self._message.
@alecsaunders Thanks for reporting. This is a similar issue of #255. Please read the explanation in #255.
Here are protocol messages that are sending(=>) and receiving(<=) during sql executions:
=> Query: SELECT THROW_ERROR('test error');
<= RowDescription: cursor.execute() returned at here
<= ErrorResponse
In vertica-python version 0.9.1, the logic of cursor.execute() makes the function stop reading remaining protocol messages if it receives a RowDescription message. For your specific problem, we can add error handling after receiving RowDescription messages. But in general, ErrorResponse messages can occur anytime in the protocol cycle of a query, only running cursor.fetchall() can you iterate through all remaining protocol messages and catch ErrorResponse.
The Vertica Error-Handling Function
THROW_ERROR
does not in fact throw an error on execution when using vertica_python using python3.Python Version: 3.7.2
Vertica-python version: 0.9.1
When I execute the sql containing the THROW_ERROR function python does NOT throw an error.
It is only when
fetchall()
orfetchone()
is called that an error is thrown.I have tested this issue by simply calling the function (as shown above) and when using the function inside a case statement:
The logic of my script does not require me to return any results with
fetchall()
. I would likeTHROW_ERROR
to just throw an error on execution.To provide some help in diagnosing this issue, I noticed that when
_execute_simple_query
is called incursor.py
, the instance type ofself._message
(row 479) isRowDescription
and notErrorResponse
as it should be. I did some debugging and here is theself._message
.The text was updated successfully, but these errors were encountered: