hue: Metastore Manager and Hive Editor assist do not display DB tables for non-default databases unless ALL DB Ranger Hive policy access

Hi,

Metastore Manager and Hive Editor assist do not display DB tables for non-default databases unless Ranger Hive policy is set to ALL DB access. If access is granted to a single or multiple DBs (but not ALL - *) Hue does not display the tables list, however running: use DB; show tables; in the Hive Query Editor and we are able to properly have the tables in the results. Running queries against the DBs and tables works fine, as well. We enabled debug but there’s no additional info that could help trace the problem.

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Hi,

To overcome this, I have replaced the use of thrift GetTables based call from get_tables_meta in https://github.com/cloudera/hue/blob/master/apps/beeswax/src/beeswax/server/dbms.py with :

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)
    else:
      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)
      self.close(handle_tbls)
      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)
      self.close(handle_vws)
      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)
        self.close(handle_mvws)
        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

Hope this helps.

Thanks

Hi Elisabeta,

Unfortunately HDP+Hue is not a supported combination as of now. We do have an internal JIRA filed against hive/hue ranger integration which has not being worked on yet. We will keep you update once it gets resolved.

Sorry for the inconvenience!

Weixia