Bug description

While running Apache superset version 5 with a custom superset_config.py , I encountered the error

AttributeError:module 'superset_config' has no attribute 'MyCustomclass'

But that class is clearly defined in superset_config.py

Screenshots/recordings

No response

Superset version

5.0.0

Python version

3.11

Node version

18 or greater

Browser

Chrome

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

This error usually happens because Superset only imports uppercase attributes from superset_config.py into its main config module, so classes like MyCustomclass (not all uppercase) won’t be accessible as attributes of the superset_config module itself. This is by design in recent Superset versions, including 5.0.0, and is handled in the config loader logic source.

To use a custom IndexView, define your class at the top level of superset_config.py, then reference it using its full module path as a string in the relevant config variable (e.g., FAB_INDEX_VIEW = 'superset_config.MyCustomclass'). Here’s an example pattern:

from flask_appbuilder import IndexView

class MyCustomclass(IndexView):
    # your overrides here

FAB_INDEX_VIEW = f"{MyCustomclass.__module__}.{MyCustomclass.__name__}"

supporting example

Make sure superset_config.py is in your PYTHONPATH or set the SUPERSET_CONFIG_PATH environment variable to its location, and restart Superset after changes. If you’re running in Docker Compose, place your config at /app/docker/pythonpath_dev/superset_config_docker.py source.

If you still get the AttributeError, double-check for typos, ensure the class is defined at the top level (not inside a function or conditional), and review logs for import errors. Only uppercase variables are imported into the main config, but classes can still be referenced by their module path as shown above.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

Comment From: paulsonkevgit

I already used this and FAB_INDEX_VIEW = f"{MyCustomclass.module}.{MyCustomclass.name}"

AND STILL THE ISSUE persisits

Comment From: dosubot[bot]

This issue persists because, as of Superset 5.0.0, the FAB_INDEX_VIEW setting in superset_config.py is ignored—Superset always uses its built-in SupersetIndexView and does not look for a custom class via FAB_INDEX_VIEW. The AttributeError is a side effect of this: Superset never tries to import your MyCustomclass, so it isn't available as an attribute, and the config is effectively ignored. There is currently no supported way to override the IndexView through superset_config.py or FAB_INDEX_VIEW in recent Superset versions. Customizing the IndexView would require deeper changes to Superset's initialization code, which isn't officially documented or supported at this time.

References:
- Superset config loading logic
- Superset initialization always sets SupersetIndexView

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

Comment From: rusackas

Maybe a little more info on your intended use case, or some actionable repro steps/configs can help us out here. Otherwise, it sounds like the bot is correct, but let us know if you think otherwise.