michael-s-molina commented on code in PR #24983:
URL: https://github.com/apache/superset/pull/24983#discussion_r1295027085
##########
superset/sqllab/api.py:
##########
@@ -83,8 +85,55 @@ class SqlLabRestApi(BaseSupersetApi):
EstimateQueryCostSchema,
ExecutePayloadSchema,
QueryExecutionResponseSchema,
+ SQLLabBootstrapSchema,
)
+ @expose("/", methods=("GET",))
+ @protect()
+ @safe
+ @statsd_metrics
+ @event_logger.log_this_with_context(
+ action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.get",
+ log_to_statsd=False,
+ )
+ def get(self) -> Response:
+ """Get the bootstrap data for SqlLab
+ ---
+ get:
+ summary: Get the bootstrap data for SqlLab page
+ description: >-
+ Assembles SQLLab bootstrap data(active_tab, databases, queries,
tab_state_ids
+ ) in a single endpoint. The data can be assembled from the current
user's id.
+ responses:
+ 200:
+ description: Returns the initial bootstrap data for SqlLab
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SQLLabBootstrapSchema'
+ 400:
+ $ref: '#/components/responses/400'
+ 401:
+ $ref: '#/components/responses/401'
+ 403:
+ $ref: '#/components/responses/403'
+ 500:
+ $ref: '#/components/responses/500'
+ """
+ user_id = utils.get_user_id()
+ # TODO: Replace with a command class once fully migrated to SPA
+ result = bootstrap_sqllab_data(user_id)
+
+ return json_success(
+ json.dumps(
+ {"result": result},
+ default=utils.json_iso_dttm_ser,
+ ignore_nan=True,
+ encoding=None,
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]