trinodb / trino-python-client

Python client for Trino
Apache License 2.0
327 stars 163 forks source link

Perform prepared statements on client-side #365

Closed mdesmet closed 1 year ago

mdesmet commented 1 year ago

Description

Non-technical explanation

Release notes

( ) This is not user-visible or docs only and no release notes are required. ( ) Release notes are required, please propose a release note for me. ( ) Release notes are required, with the following suggested text:

* Fix some things. ({issue}`issuenumber`)
martint commented 1 year ago

Please provide more details about the purpose and motivation for this change.

mdesmet commented 1 year ago

Please provide more details about the purpose and motivation for this change.

This is just a PoC for reducing the amount of http calls involved in prepared statement handling.

This PR was to demonstrate that this approach conceals invalid SQL as HTTP errors.

trino.exceptions.HttpError: error 400: b"Invalid X-Trino-Prepared-Statement header: line 2:22: mismatched input 'FRMO'. Expecting: ',', 'EXCEPT', 'FETCH', 'FROM', 'GROUP', 'HAVING', 'INTERSECT', 'LIMIT', 'OFFSET', 'ORDER', 'UNION', 'WHERE', 'WINDOW', <EOF>"