trinodb / trino-python-client

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

add Trino Python Client version to user agent #411

Closed aksakalli closed 9 months ago

aksakalli commented 9 months ago

Description

Trino introduces some breaking changes for old client versions but there is no way to find out the client version of our users to warn them before upgrading to a newer version since the python client is using the default user agent from requests that results python-requests/2.31.0. However, the JDBC driver sets a more descriptive user agent header value such as Trino JDBC Driver/371 that helps us to identify users with outdated client versions.

This PR aims to specify the user agent to pass the current driver version to the coordinator to be logged later in query created and completed events as io.trino.spi.eventlistener.QueryContext.userAgent.

Non-technical explanation

This change will allow us to spot outdated clients accessing our Trino cluster.

Release notes

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

* Add Trino Python Client version to User-Agent header. ({issue}`411`)