django-sql-explorer icon indicating copy to clipboard operation
django-sql-explorer copied to clipboard

schema browser and schema in playground page

Open procino opened this issue 5 years ago • 2 comments

[Dear] support, I have a connection to postgresql DB with different schemas and not just the public.

playground

When I go in playground page and press on "show schema" I see only tables within schema public. How I can see tables of other schemas? Is there a specific parameter that I have to set in setting.py?

Thank you in advance. Giuseppe P.

procino avatar Feb 10 '20 08:02 procino

Hi, is there a solution? Did someone solve the problem?

Thank you in advance. Giuseppe P.

procino avatar Sep 11 '20 08:09 procino

@procino What permissions over the database does the user which makes the connection from django have? Is it a user with access to what you want to see in explorer?

Perhaps it'd be worth looking at the settings docs, specifically EXPLORER_DEFAULT_CONNECTION and EXPLORER_CONNECTIONS

marksweb avatar Dec 07 '20 23:12 marksweb

@marksweb This calls the default introspection code in Django so I imagine is related to db connection setup. I feel like we can close this for now.

    def table_names(self, cursor=None, include_views=False):
        """
        Return a list of names of all tables that exist in the database.
        Sort the returned table list by Python's default sorting. Do NOT use
        the database's ORDER BY here to avoid subtle differences in sorting
        order between databases.
        """
        def get_names(cursor):
            return sorted(ti.name for ti in self.get_table_list(cursor)
                          if include_views or ti.type == 't')
        if cursor is None:
            with self.connection.cursor() as cursor:
                return get_names(cursor)
        return get_names(cursor)

lawson89 avatar Dec 16 '22 15:12 lawson89