[database] new, select star API migration (#9054)

This commit is contained in:
Daniel Vaz Gaspar
2020-02-14 14:30:49 +00:00
committed by GitHub
parent 1aab4c072c
commit f993bdc7ef
7 changed files with 266 additions and 25 deletions

View File

@@ -93,6 +93,14 @@ class BaseSupersetModelRestApi(ModelRestApi):
}
""" # pylint: disable=pointless-string-statement
def __init__(self):
super().__init__()
self.stats_logger = None
def create_blueprint(self, appbuilder, *args, **kwargs):
self.stats_logger = self.appbuilder.get_app.config["STATS_LOGGER"]
return super().create_blueprint(appbuilder, *args, **kwargs)
def _init_properties(self):
model_id = self.datamodel.get_pk_name()
if self.list_columns is None and not self.list_model_schema:
@@ -114,6 +122,9 @@ class BaseSupersetModelRestApi(ModelRestApi):
)
return filters
def incr_stats(self, action: str, func_name: str) -> None:
self.stats_logger.incr(f"{self.__class__.__name__}.{func_name}.{action}")
@expose("/related/<column_name>", methods=["GET"])
@protect()
@safe