Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Upcoming (TBD)
Bug Fixes
--------
* Show the username in the Docker prompt.
* Show the username in the prompt if a default user was used.


v2.29.6 (2026/10/15)
Expand Down
2 changes: 1 addition & 1 deletion mycli/packages/execution/sql_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def connect(
# Update them after the connection is made to ensure that it was a
# successful connection.
self.dbname = db
self.user = user
self.user = user or (conn.user.decode(conn.encoding) if isinstance(conn.user, bytes) else conn.user)
self.password = password
self.host = host
self.port = port
Expand Down
16 changes: 16 additions & 0 deletions mycli_test/pytests/test_sql_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,22 @@ def fake_reset_connection_id(self) -> None:
assert executor.server_info.version == 80036


@pytest.mark.parametrize('requested_user', [None, ''])
@pytest.mark.parametrize('resolved_user', ['andr\u00e9', b'andr\xe9'])
def test_connect_records_default_username(monkeypatch: pytest.MonkeyPatch, requested_user: str | None, resolved_user: str | bytes) -> None:
executor = make_executor_for_connect_tests()
executor.user = requested_user
executor.ssl = None
conn = Mock(user=resolved_user, encoding='latin1', server_version='5.7.0')
monkeypatch.setattr(sql_execute.pymysql, 'connect', Mock(return_value=conn))
monkeypatch.setattr(SQLExecute, 'reset_connection_id', Mock())
monkeypatch.setattr(SQLExecute, '_probe_doris_version', Mock(return_value=None))

executor.connect()

assert executor.user == 'andr\u00e9'


def test_connect_sets_expired_password_flag(monkeypatch) -> None:
executor = make_executor_for_connect_tests()
executor.ssl = None
Expand Down
Loading