From 52cc7648300d2844f57b5c29c6430f329e3a198b Mon Sep 17 00:00:00 2001 From: songflows Date: Sun, 9 Feb 2020 22:58:12 +0300 Subject: [PATCH] except Permission denied db exception 'ProgrammingError: permission denied for relation table_name' if one of db tables have no access. --- explorer/schema.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/explorer/schema.py b/explorer/schema.py index e2c96dac..60300950 100644 --- a/explorer/schema.py +++ b/explorer/schema.py @@ -73,14 +73,18 @@ def build_schema_info(connection_alias): if not _include_table(table_name): continue td = [] - table_description = connection.introspection.get_table_description(cursor, table_name) - for row in table_description: - column_name = row[0] - try: - field_type = connection.introspection.get_field_type(row[1], row) - except KeyError as e: - field_type = 'Unknown' - td.append((column_name, field_type)) + try: + table_description = connection.introspection.get_table_description(cursor, table_name) + for row in table_description: + column_name = row[0] + try: + field_type = connection.introspection.get_field_type(row[1], row) + except KeyError as e: + field_type = 'Unknown' + td.append((column_name, field_type)) + except Exception as e: + # td.append(('Permission denied', 'Unknown')) + continue ret.append((table_name, td)) return ret