Replies: 8 comments 6 replies
-
@snickerjp As our resident Oracle specialist, what do you think? 😄 |
Beta Was this translation helpful? Give feedback.
-
@lscapim "I would like you to show me the location of the error." Certainly, I agree with you. |
Beta Was this translation helpful? Give feedback.
-
How can I make it so that I can output the same error messages as in SQL*Plus? Redash uses the Python library "cx_Oracle" to connect to Oracle Database. It is not possible to output the same error message as sqlplus using cx_Oracle. The error message from cx_Oracle contains the Oracle Database error number and error message. On the other hand, the error message from sqlplus contains the message corresponding to the Oracle Database error code. The Python module "python-oracledb" was the same. If there is a better way, please let me know. I hope this helps. The following was used as a reference |
Beta Was this translation helpful? Give feedback.
-
In the course of my investigation, I made some modifications to the Python code. diff --git a/redash/query_runner/oracle.py b/redash/query_runner/oracle.py
--- a/redash/query_runner/oracle.py
+++ b/redash/query_runner/oracle.py
@@ -176,7 +176,8 @@ class Oracle(BaseSQLQueryRunner):
json_data = json_dumps(data)
connection.commit()
except cx_Oracle.DatabaseError as err:
- error = "Query failed. {}.".format(str(err))
+ err_args, = err.args
+ error = "Query failed. {}.".format(str(err)) + "| Error Offset num: {}.".format(str(err_args.offset))
json_data = None
except (KeyboardInterrupt, JobTimeoutException):
connection.cancel() However, perhaps this is not enough. |
Beta Was this translation helpful? Give feedback.
-
With that offset number, I'm guessing that's the number of (unicode?) characters into the query text? Although it's not exactly at the helpfulness of something like "line 52, column 10", it still sounds like an improvement over the existing situation. Did you want to make a PR for that change? 😄 |
Beta Was this translation helpful? Give feedback.
-
@justinclift It's exactly the same situation you mentioned. We need to have the line and column returned with error, similar to the example that showed and SQLPlus: "line 52, column 10" |
Beta Was this translation helpful? Give feedback.
-
@snickerjp With that offset number that it returns... that might actually be useful "enough" for our purposes if we're clever. @eradman If a data source tells us which character # in our query is the error point, do you reckon we could (accurately) work our the line and column numbers from that? I'm thinking it's probably not too hard to write a function for calculating that (front end?) if such a function doesn't already exist. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Thanks to @snickerjp for creating the PR to add the line and column location in the error message output (#6373). It's been merged now. Next, we need to figure out the release process for creating Redash builds people can use in production. 😄 |
Beta Was this translation helpful? Give feedback.
-
Hi,


When we run a query in Redash, with errors, the error message does not show the line, as in the example:
Can we find a why to solve this?
When we have a big query this can be a big problem for us.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions