'Extending Apache Superset and adding a link

I have a superset fork I managed to get it up and running using docker compose. Now I'm trying to do one simple thing: add a new link to the existing SQL Lab menu.

enter image description here

What I'm trying to do is use appbuilder.add_link under the init_views method of the SupersetAppInitializer class (app.py):

class SupersetAppInitializer:

    # ...

    def init_views(self) -> None:

        # ...
       
        appbuilder.add_link(
            __("Saved Queries"),
            href="/savedqueryview/list/",
            icon="fa-save",
            category="SQL Lab",
        )
        # This is a new link
        appbuilder.add_link(
            __("Test"),
            href="/savedqueryview/list/",
            icon="fa-save",
            category="SQL Lab",
        )

I copied the existing 'Saved Queries' link and added a 'Test' link (using the same href). It doesn't seem to be working.

What do I need to make it work?



Solution 1:[1]

I could reproduce the issue by editing the changes to the app menu in vim.

The way Apache superset builds the menu is by requesting data from the backend.

When editing superset/app.py in vim, changes to it are not properly updated to file mounts in the running container.

You could configure your editor to perform edits in place. Another option is to restart the container services to rebind the file mounts.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1