presto-python-client
presto-python-client copied to clipboard
Enhance the Prestodb python client to handle semicolon at the end of query
When we try a query like Select * from customer LIMIT 1;
it returns error. It would have been better if we can handle from python client to process queries with and without semicolon so that it will not through any error.
Please find the error log attached below
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <prestodb.client.PrestoRequest object at 0x10d3b3d30>
http_response = <Response [200]>
def process(self, http_response):
# type: (requests.Response) -> PrestoStatus
if not http_response.ok:
self.raise_response_error(http_response)
http_response.encoding = "utf-8"
response = http_response.json()
logger.debug("HTTP {}: {}".format(http_response.status_code, response))
if "error" in response:
> raise self._process_error(response["error"], response.get("id"))
E prestodb.exceptions.PrestoUserError: PrestoUserError(type=USER_ERROR, name=SYNTAX_ERROR, message="line 1:31: mismatched input ';'. Expecting: <EOF>", query_id=20230428_083155_00223_3c582)
../venv/lib/python3.10/site-packages/prestodb/client.py:417: PrestoUserError