bito-code-review[bot] commented on PR #42705:
URL: https://github.com/apache/superset/pull/42705#issuecomment-5166550830
<!-- Bito Reply -->
The flagged issue is correct. The `impersonate_user` method modifies the URL
to include a `session_name` parameter but fails to clear the existing
`url.username`, which can cause connection failures in MotherDuck by passing
the username as an invalid connection argument.
To resolve this, you should set the username to `None` on the URL object
before returning it. Here is the corrected implementation for the
`impersonate_user` method:
```python
separator = "&" if "?" in url.database else "?"
url =
url.set(database=f"{url.database}{separator}session_name={session_name}")
url = url.set(username=None)
return url, engine_kwargs
```
There are no other comments on this PR to address.
**superset/db_engine_specs/duckdb.py**
```
separator = "&" if "?" in url.database else "?"
url =
url.set(database=f"{url.database}{separator}session_name={session_name}")
url = url.set(username=None)
return url, engine_kwargs
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]