Support Questions
Find answers, ask questions, and share your expertise

Hue does not list Hive databases for most users


Hue does not list Hive databases for most users

Expert Contributor


I am using Hue 3.9 and HDP 2.3 with Ambari 2.1.1. The problem is that Hue does not list databases (for most users) using "Query Editor" -> "Hive". The tab "Data Browsers" -> "Metastore Tables" works correctly. Users 'hue', 'hive' and 'admin' can list the databases, but if I log in as any different user, there is option to choose database but if I expand the list, I cant see any database (loading icon not appears as well).

Using 'hdfs groups username" user 'hive' belongs to 'hadoop' group, user 'hue' to 'hue' and user 'admin' has no group so its not the problem with groups permissions or something - all users have different groups and list databases. In Hue all users belongs to groups 'default' and 'hadoop'.

I use ranger hive policies to grant access, and I have added all users to the same policy (accessing all databases).

HDFS permissions to databases and parent folders are 777.

hive.server2.enable.doAs is set to false and Hiveserver2 Authentication is set to NONE.

Under beeline everything works perfect.

What can be the problem that any other users except 'hive', 'hue' and 'admin' cannot list databases?


Re: Hue does not list Hive databases for most users

Configure Hue as a proxy user for users and groups it needs to impersonate by adding the following two properties in core-site.xml. To allow 'hue' to impersonate everyone, set the value to wildcard.


Re: Hue does not list Hive databases for most users

Expert Contributor

Thanks for the answer. I had already added those properties. Any other solutions?


Re: Hue does not list Hive databases for most users

Can you tail the hiveserver2.log while attempting to list databases in HUE, and provide the output here?


Re: Hue does not list Hive databases for most users

Expert Contributor

Sorry for not responding. I configured Hiveserver2 to authenticate using LDAP/AD and I am facing similar problem now - " user1 is not allowed to impersonate user2:0:-1'], statusCode=3)".

In core-site.xml I have added:


I have configure user1 as a bind user for Hue (ldap_username=... ldap_password=... in hue.ini).

I double checked that both users are able to log in to beeline.

@EDIT - as user "user1" it works well.

Below the error (Please use "Open in new tab" option to zoom in the first figure):



Re: Hue does not list Hive databases for most users

Cloudera Employee

This article and the script update for is what worked properly for me. 




def get_tables_meta(self, database='default', table_names='*', table_types=None):
    database = database.lower() # Impala is case sensitive

    if self.server_name == 'beeswax':
      identifier = self.to_matching_wildcard(table_names)
      identifier = None
    #tables = self.client.get_tables_meta(database, identifier, table_types)
    #Switch back to show tables/views since GetTables does not return all tables/views in DB for non-default databases unless ALL DB Ranger Hive policy access 
    query_tbls = "show tables IN "+str(database)
    query = hql_query(query_tbls)
    timeout = SERVER_CONN_TIMEOUT.get()
    handle_tbls = self.execute_and_wait(query, timeout_sec=timeout)
    if handle_tbls:
      result = self.fetch(handle_tbls, rows=5000)
      tbls = [[table_name[0],'Table'] for table_name in result.rows()]

    query_vws = "show views IN "+str(database)
    query = hql_query(query_vws)
    handle_vws = self.execute_and_wait(query, timeout_sec=timeout)
    if handle_vws:
      result = self.fetch(handle_vws, rows=5000)
      vws = [[view_name[0],'View'] for view_name in result.rows()]
    query_mvws = "show materialized views IN "+str(database)
    query = hql_query(query_mvws)
    handle_mvws = self.execute_and_wait(query, timeout_sec=timeout)
    if handle_mvws:
        result = self.fetch(handle_mvws, rows=5000)
        mvws = [[mview_name[0],'Materialized view'] for mview_name in result.rows() if str(mview_name[0])  and  str(mview_name[0]) != "# MV Name" ]

    tables = tbls + vws + mvws
    hive_objects = [{'comment': None, 'type':table[1], 'name':table[0]} for table in tables]

    if len(hive_objects) <= APPLY_NATURAL_SORT_MAX.get():
      hive_objects = apply_natural_sort(hive_objects, key='name')

    #if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
    #  tables = apply_natural_sort(tables, key='name')
    #return tables
    return hive_objects
Don't have an account?