question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
elisabetaocommented, Feb 7, 2020

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

1reaction
weixiaxucommented, Jun 26, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

DB/tables in metastore manager, but not in Hive query editor
Now in Hue, I can view/create databases & tables in the Metastore Manager, but in the query editors (Hive and/or Impala) there are...
Read more >
Impala Authorization
They can see the tables and their parent databases in the output of SHOW TABLES and SHOW DATABASES , USE the appropriate databases,...
Read more >
Impala Tutorials - Cloudera Manager
This section includes tutorial scenarios that demonstrate how to begin using Impala once the software is installed. It focuses on techniques for ...
Read more >
Apache Hive 3 tables - Cloudera Documentation
These tables are Hive managed tables. Alternatively, you can create an external table for non-transactional use. Because Hive control of the external table...
Read more >
CREATE EXTERNAL SCHEMA - Amazon Redshift
HIVE METASTORE indicates that the external database is defined in an Apache Hive metastore. If HIVE METASTORE, is specified, URI is required. POSTGRES...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found