I am connected to Hive data source and I am also able to query any tables available in Hive database, But Redash does not show the all available tables on left panel. It complains “Schema refresh failed.”
I tried to run the specific queries related to schema information like “Show schemas” or “Show tables in [Schemas]”. Even I am able to run these queries in beeline using hive user.
I am using 8.x version in docker.
Thanks
I got the same problem.
That’s because it takes too long to get the schema information.
The source code is as follows:
def _get_tables(self, schema):
schemas_query = "show schemas"
tables_query = "show tables 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 % (schema_name, table_name))))
if schema_name != 'default':
table_name = '{}.{}'.format(schema_name, table_name)
schema[table_name] = {'name': table_name, 'columns': columns}
return schema.values()
I had soved this kind problem.
I created a new data table to store the schema information. I get the schema information from hive at regular times every day and stored them into the table. Then I modified the source code of Redash so that Redash could get the schema information from the table(mysql or pg), and the problem was solved
2 Likes