trinodb / trino-python-client

Python client for Trino
Apache License 2.0
309 stars 151 forks source link

Encode roles as in JDBC driver #311

Closed mdesmet closed 1 year ago

mdesmet commented 1 year ago

Description

In the jdbc driver custom roles are enclosed in ROLE{rolename} automatically. This was not yet implemented in the Trino python client, causing confusion.

This PR adds this enclosing automatically, while checking if the enclosing is not already provided to ensure backwards compatiblity.

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:

* Enclose custom roles passed in Connection into Trino protocol specific formatting (ROLE{rolename})
mdesmet commented 1 year ago

Thank you for doing this, maybe we should also have an example with an old approach in README?

Well, the old approach is not anymore relevant after this PR. Our docs were already compliant, see https://github.com/trinodb/trino-python-client/blob/master/README.md#roles