robdiciuccio commented on a change in pull request #14287:
URL: https://github.com/apache/superset/pull/14287#discussion_r618620245
##########
File path: superset/db_engine_specs/base.py
##########
@@ -1024,7 +1024,7 @@ def estimate_query_cost(
if not cls.get_allow_cost_estimate(extra):
raise Exception("Database does not support cost estimation")
- user_name = g.user.username if g.user else None
+ user_name = g.user.username if g.user and hasattr(g.user, "username")
else None
Review comment:
I originally was checking `g.user.is_anonymous` in these use cases, but
opted for the explicit check for username, as this is the value that is being
fetched. There _may_ be use cases where username is not present in other states
down the road, so thought explicit `hasattr` would be more future-proof.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]