mirror of
https://github.com/apache/superset.git
synced 2024-09-06 22:07:34 -04:00
fix: add default value to log param in sql_json (#8851)
* fix: add default params to log * fix: add optional typing * fix: linting
This commit is contained in:
parent
2d42272e60
commit
930353286f
@ -2444,7 +2444,7 @@ class Superset(BaseSupersetView):
|
||||
rendered_query: str,
|
||||
query: Query,
|
||||
expand_data: bool,
|
||||
log_params: Dict[str, Any],
|
||||
log_params: Optional[Dict[str, Any]] = None,
|
||||
) -> str:
|
||||
"""
|
||||
Send SQL JSON query to celery workers
|
||||
@ -2495,7 +2495,7 @@ class Superset(BaseSupersetView):
|
||||
rendered_query: str,
|
||||
query: Query,
|
||||
expand_data: bool,
|
||||
log_params: Dict[str, Any],
|
||||
log_params: Optional[Dict[str, Any]] = None,
|
||||
) -> str:
|
||||
"""
|
||||
Execute SQL query (sql json)
|
||||
@ -2541,11 +2541,13 @@ class Superset(BaseSupersetView):
|
||||
@event_logger.log_this
|
||||
def sql_json(self):
|
||||
log_params = {
|
||||
"USER_AGENT": cast(Optional[str], request.headers.get("USER_AGENT"))
|
||||
"user_agent": cast(Optional[str], request.headers.get("USER_AGENT"))
|
||||
}
|
||||
return self.sql_json_exec(request.json, log_params)
|
||||
|
||||
def sql_json_exec(self, query_params: dict, log_params: dict):
|
||||
def sql_json_exec(
|
||||
self, query_params: dict, log_params: Optional[Dict[str, Any]] = None
|
||||
):
|
||||
"""Runs arbitrary sql and returns data as json"""
|
||||
# Collect Values
|
||||
database_id: int = cast(int, query_params.get("database_id"))
|
||||
|
Loading…
Reference in New Issue
Block a user