trino-python-client icon indicating copy to clipboard operation
trino-python-client copied to clipboard

Client send empty session when user do not set session

Open starry225 opened this issue 1 year ago • 1 comments

Expected behavior

client only send session when session is set by users

Actual behavior

client send empty session if no session is set by users image

in client, it doesn't check if session exists

  • if self._client_session.properties: headers[constants.HEADER_SESSION] = ",".join( # name must not contain = "{}={}".format(name, urllib.parse.quote(str(value))) for name, value in self._client_session.properties.items() )

Steps To Reproduce

can be reproduced by init a connection and send a request. or add a unit test in test_client

def test_request_session_properties_headers(mock_get_and_post):
    get, post = mock_get_and_post

    req = TrinoRequest(
        host="coordinator",
        port=8080,
        client_session=ClientSession(
            user="test_user",
        )
    )

    def assert_headers(headers):
        assert constants.HEADER_SESSION not in headers

Log output

No response

Operating System

amazon linux 2

Trino Python client version

0.328.0

Trino Server version

449

Python version

3.7.16

Are you willing to submit PR?

  • [X] Yes I am willing to submit a PR!

starry225 avatar Jun 13 '24 05:06 starry225

Why is this a problem?

Feel free to send a PR to omit the header altogether if you want.

hashhar avatar Jun 26 '24 06:06 hashhar

Closing since this is not considered an issue.

hashhar avatar Sep 03 '24 06:09 hashhar