diff --git a/sql/engines/mysql.py b/sql/engines/mysql.py index 3c71080a96..a25422fb09 100644 --- a/sql/engines/mysql.py +++ b/sql/engines/mysql.py @@ -198,8 +198,6 @@ def get_all_databases(self): db_list = [ row[0] for row in result.rows if row[0] not in self.forbidden_databases ] - db_list = filter_db_list(db_list, self.instance.show_db_name_regex, True) - db_list = filter_db_list(db_list, self.instance.denied_db_name_regex, False) result.rows = db_list return result diff --git a/sql/instance.py b/sql/instance.py index 54486be745..a9b9332e2e 100644 --- a/sql/instance.py +++ b/sql/instance.py @@ -14,6 +14,7 @@ from common.utils.convert import Convert from sql.engines import get_engine from sql.plugins.schemasync import SchemaSync +from sql.utils.sql_utils import filter_db_list from .models import Instance, ParamTemplate, ParamHistory @@ -332,6 +333,12 @@ def instance_resource(request): tb_name = query_engine.escape_string(tb_name) if resource_type == "database": resource = query_engine.get_all_databases() + resource = filter_db_list( + resource, query_engine.instance.show_db_name_regex, True + ) + resource = filter_db_list( + resource, query_engine.instance.denied_db_name_regex, False + ) elif resource_type == "schema" and db_name: resource = query_engine.get_all_schemas(db_name=db_name) elif resource_type == "table" and db_name: