codeant-ai-for-open-source[bot] commented on code in PR #44653:
URL: https://github.com/apache/superset/pull/44653#discussion_r4121470729
##########
superset/models/core.py:
##########
@@ -662,11 +706,7 @@ def _get_sqla_engine( # pylint: disable=too-many-locals
# noqa: C901
)
engine_kwargs["connect_args"] = connect_args
- effective_username = self.get_effective_user(sqlalchemy_url)
- if effective_username and
is_feature_enabled("IMPERSONATE_WITH_EMAIL_PREFIX"):
- user = security_manager.find_user(username=effective_username)
- if user and user.email:
- effective_username = user.email.split("@")[0]
+ effective_username = self.get_impersonation_username(sqlalchemy_url)
Review Comment:
**Suggestion:** `_get_sqla_engine` now resolves the current user for every
database connection, even when impersonation is disabled, causing unrelated
connections to fail on metadata lookup errors.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Logic error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=6138c0ebdd6a4350aead1f158ecd93ab&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=6138c0ebdd6a4350aead1f158ecd93ab&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/models/core.py
**Line:** 709:709
**Comment:**
*Logic Error: `_get_sqla_engine` now resolves the current user for
every database connection, even when impersonation is disabled, causing
unrelated connections to fail on metadata lookup errors.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44653&comment_hash=1c113d08d7e8162a5e7dad5282881803fa563b8cf6d6774e393ea062695271b5&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44653&comment_hash=1c113d08d7e8162a5e7dad5282881803fa563b8cf6d6774e393ea062695271b5&reaction=dislike'>๐</a>
--
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]