Skip to content

Enhance the Prestodb python client to handle semicolon at the end of query #128

Description

@ArinMathew

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions