[SQL Lab] Cache function names query (#9019)

This commit is contained in:
Erik Ritter 2020-01-24 16:45:41 -08:00 committed by GitHub
parent f079b6dad0
commit 922eec2db2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -29,7 +29,7 @@ from sqlalchemy.engine.url import make_url
from sqlalchemy.sql.expression import ColumnClause, Select
from werkzeug.utils import secure_filename
from superset import app, conf
from superset import app, cache, conf
from superset.db_engine_specs.base import BaseEngineSpec
from superset.db_engine_specs.presto import PrestoEngineSpec
from superset.utils import core as utils
@ -428,6 +428,7 @@ class HiveEngineSpec(PrestoEngineSpec):
cursor.execute(query, **kwargs)
@classmethod
@cache.memoize()
def get_function_names(cls, database: "Database") -> List[str]:
"""
Get a list of function names that are able to be called on the database.

View File

@ -32,7 +32,7 @@ from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.engine.result import RowProxy
from sqlalchemy.sql.expression import ColumnClause, Select
from superset import app, is_feature_enabled, security_manager
from superset import app, cache, is_feature_enabled, security_manager
from superset.db_engine_specs.base import BaseEngineSpec
from superset.exceptions import SupersetTemplateException
from superset.models.sql_types.presto_sql_types import type_map as presto_type_map
@ -947,6 +947,7 @@ class PrestoEngineSpec(BaseEngineSpec):
return df.to_dict()[field_to_return][0]
@classmethod
@cache.memoize()
def get_function_names(cls, database: "Database") -> List[str]:
"""
Get a list of function names that are able to be called on the database.