diff --git a/CHANGES.md b/CHANGES.md index 8f6c4bf6..ea5b8a53 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,24 @@ list](https://github.com/trinodb/trino-python-client/tags), the [README](https://github.com/trinodb/trino-python-client/blob/master/README.md) and the [PyPI page](https://pypi.org/project/trino/). + +## Release 0.334.0 + +* Allow authentication over insecure channel. + ([#530](https://github.com/trinodb/trino-python-client/pull/530)) +* Add support for `with` statement with `Cursor` class. + ([#537](https://github.com/trinodb/trino-python-client/pull/537)) +* Fix `KeyError` when accessing missing `error_location` in `TrinoQueryError`. + ([#535](https://github.com/trinodb/trino-python-client/pull/535)). +* Add support for `SET AUTHORIZATION` and `RESET AUTHORIZATION` statements. + ([#551](https://github.com/trinodb/trino-python-client/pull/551)) +* Use default TLS port when URI scheme is `https`. + ([#549](https://github.com/trinodb/trino-python-client/pull/549)) +* Fix redirect URI not getting printed during OAuth authentication when using terminals that buffer output. + ([#548](https://github.com/trinodb/trino-python-client/pull/548)) +* Use TLS verification mode set on the connection when retrieving spooled results. + ([#546](https://github.com/trinodb/trino-python-client/pull/546)) + ## Release 0.333.0 * Improve handling of query results containing `null` values for diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index a9225cd8..909823ee 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -135,7 +135,7 @@ def assert_headers(headers): assert headers[constants.HEADER_SESSION] == "" assert headers[constants.HEADER_TRANSACTION] is None assert headers[constants.HEADER_TIMEZONE] == timezone - assert headers[constants.HEADER_CLIENT_CAPABILITIES] == "PARAMETRIC_DATETIME,SESSION_AUTHORIZATION" + assert headers[constants.HEADER_CLIENT_CAPABILITIES] == constants.CLIENT_CAPABILITIES assert headers[accept_encoding_header] == accept_encoding_value assert headers[client_info_header] == client_info_value assert headers[constants.HEADER_ROLE] == ( diff --git a/trino/client.py b/trino/client.py index 5ee5ed0b..7cc1f0f2 100644 --- a/trino/client.py +++ b/trino/client.py @@ -522,7 +522,8 @@ def http_headers(self) -> CaseInsensitiveDict[str]: headers[constants.HEADER_ENCODING] = self._client_session.encoding else: raise ValueError("Invalid type for encoding: expected str or list") - headers[constants.HEADER_CLIENT_CAPABILITIES] = 'PARAMETRIC_DATETIME,SESSION_AUTHORIZATION' + headers[constants.HEADER_CLIENT_CAPABILITIES] = constants.CLIENT_CAPABILITIES + headers["user-agent"] = f"{constants.CLIENT_NAME}/{__version__}" if len(self._client_session.roles.values()): headers[constants.HEADER_ROLE] = ",".join( diff --git a/trino/constants.py b/trino/constants.py index 20714e9f..46b6e9ec 100644 --- a/trino/constants.py +++ b/trino/constants.py @@ -57,6 +57,9 @@ HEADER_SET_CATALOG = "X-Trino-Set-Catalog" HEADER_CLIENT_CAPABILITIES = "X-Trino-Client-Capabilities" +CLIENT_CAPABILITY_PARAMETRIC_DATETIME = "PARAMETRIC_DATETIME" +CLIENT_CAPABILITY_SESSION_AUTHORIZATION = "SESSION_AUTHORIZATION" +CLIENT_CAPABILITIES = ','.join([CLIENT_CAPABILITY_PARAMETRIC_DATETIME, CLIENT_CAPABILITY_SESSION_AUTHORIZATION]) HEADER_AUTHORIZATION_USER = "X-Trino-Authorization-User" HEADER_SET_AUTHORIZATION_USER = "X-Trino-Set-Authorization-User"