GitHub user dosubot[bot] added a comment to the discussion: superset k8s 
deployment via helm

<!-- Answer -->
The error is happening because your custom multi-tenant authentication code is 
trying to filter the Role model by username, but the Role model in Superset 
(and Flask AppBuilder) does not have a username property—only the User model 
does. This usually means that somewhere in your custom code (likely in 
/app/superset/multi_tenant.py), self.user_model is set to Role instead of User, 
or a query is being run against Role when it should be against User. 

To fix this, review your authentication logic and make sure any query filtering 
by username is performed on the User model, not Role. For reference, you can 
look at Superset’s standard authentication and security manager code in 
superset/security/manager.py for the correct patterns. This is a common pitfall 
in custom multi-tenant setups and is not part of standard Superset behavior. 
More details and examples are discussed 
[here](https://github.com/apache/superset/discussions/33877). 

If you need a code example or further guidance, let me know!


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/3dc505f4-40e0-475c-9dda-22bd5e0ca43c?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/3dc505f4-40e0-475c-9dda-22bd5e0ca43c?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/3dc505f4-40e0-475c-9dda-22bd5e0ca43c?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/3dc505f4-40e0-475c-9dda-22bd5e0ca43c?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/3dc505f4-40e0-475c-9dda-22bd5e0ca43c?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/3dc505f4-40e0-475c-9dda-22bd5e0ca43c?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/3dc505f4-40e0-475c-9dda-22bd5e0ca43c?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20error%20is%20happening%20because%20your%20custom%20multi-tenant%20authentication%20code%20is%20trying%20to%20filter%20the%20Role%20model%20by%20username%2C%20but%20the%20Role%20model%20in%20Superset%20%28and%20Flask%20AppBuilder%29%20does%20not%20have%20a%20username%20property%E2%80%94only%20the%20User%20model%20does.%20This%20usually%20means%20that%20somewhere%20in%20your%20custom%20code%20%28likely%20in%20/app/superset/multi_tenant.py%29%2C%20self.user_model%20is%20set%20to%20Role%20instead%20of%20User%2C%20or%20a%20query%20is%20being%20run%20against%20Role%20when%20it%20should%20be%20against%20User.%20%0A%0ATo%20fix%20this%2C%20review%20your%20authentication%20logic%20and%20make%20sure%20any%20query%20filtering%20by%20username%20is%20performe
 
d%20on%20the%20User%20model%2C%20not%20Role.%20For%20reference%2C%20you%20can%20look%20at%20Superset%E2%80%99s%20standard%20authentication%20and%20security%20manager%20code%20in%20superset/security/manager.py%20for%20the%20correct%20patterns.%20This%20is%20a%20common%20pitfall%20in%20custom%20multi-tenant%20setups%20and%20is%20not%20part%20of%20standard%20Superset%20behavior.%20More%20details%20and%20examples%20are%20discussed%20%5Bhere%5D%28https%3A//github.com/apache/superset/discussions/33877%29.%20%0A%0AIf%20you%20need%20a%20code%20example%20or%20further%20guidance%2C%20let%20me%20know%21)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/36687)

GitHub link: 
https://github.com/apache/superset/discussions/36687#discussioncomment-15275872

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to