|
|
@@ -115,8 +115,17 @@ class HiveServer2Dbms(object):
|
|
|
return self.client.get_table(database, table_name)
|
|
|
|
|
|
|
|
|
- def get_tables(self, database='default', table_names='.*'):
|
|
|
- return self.client.get_tables(database, table_names)
|
|
|
+ def get_tables(self, database='default', table_names='*'):
|
|
|
+ hql = "SHOW TABLES IN %s '%s'" % (database, table_names) # self.client.get_tables(database, table_names) is too slow
|
|
|
+ query = hql_query(hql)
|
|
|
+ handle = self.execute_and_wait(query, timeout_sec=15.0)
|
|
|
+
|
|
|
+ if handle:
|
|
|
+ result = self.fetch(handle, rows=5000)
|
|
|
+ self.close(handle)
|
|
|
+ return [name for table in result.rows() for name in table]
|
|
|
+ else:
|
|
|
+ return []
|
|
|
|
|
|
|
|
|
def get_databases(self):
|
|
|
@@ -239,7 +248,7 @@ class HiveServer2Dbms(object):
|
|
|
|
|
|
def invalidate_tables(self, database, tables):
|
|
|
for table in tables:
|
|
|
- hql = "INVALIDATE METADATA %s.%s" % (database, table,)
|
|
|
+ hql = "INVALIDATE METADATA %s.%s" % (database, table,)
|
|
|
query = hql_query(hql, database, query_type=QUERY_TYPES[1])
|
|
|
|
|
|
handle = self.execute_and_wait(query, timeout_sec=10.0)
|