Fix schema loading query for Hive query runner

This commit is contained in:
laughingman7743 2016-10-22 10:06:18 +09:00
parent 7ee41d41b5
commit 6a42daffe2

View File

@ -78,11 +78,11 @@ class Hive(BaseSQLQueryRunner):
tables_query = "show tables in %s"
columns_query = "show columns in %s"
columns_query = "show columns in %s.%s"
for schema_name in filter(lambda a: len(a) > 0, map(lambda a: str(a['database_name']), self._run_query_internal(schemas_query))):
for table_name in filter(lambda a: len(a) > 0, map(lambda a: str(a['tab_name']), self._run_query_internal(tables_query % schema_name))):
columns = filter(lambda a: len(a) > 0, map(lambda a: str(a['field']), self._run_query_internal(columns_query % table_name)))
columns = filter(lambda a: len(a) > 0, map(lambda a: str(a['field']), self._run_query_internal(columns_query % (schema_name, table_name))))
if schema_name != 'default':
table_name = '{}.{}'.format(schema_name, table_name)