docstr: 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'
docstr_tok: ["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","'"]
code: 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,
          ),
          200,
      )
  
imports: import logging
  from typing import Any, cast, Optional
  from urllib import parse
  import simplejson
  import sqlparse
  from flask import request, Response
  from flask_appbuilder import permission_name
  from flask_appbuilder.api import expose, protect, rison, safe
  from flask_appbuilder.models.sqla.interface import SQLAInterface
  from marshmallow import ValidationError
  from superset import app, is_feature_enabled
  from superset.commands.sql_lab.estimate import QueryEstimationCommand
  from superset.commands.sql_lab.execute import CommandResult, ExecuteSqlCommand
  from superset.commands.sql_lab.export import SqlResultExportCommand
  from superset.commands.sql_lab.results import SqlExecutionResultsCommand
  from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP
  from superset.daos.database import DatabaseDAO
  from superset.daos.query import QueryDAO
  from superset.extensions import event_logger
  from superset.jinja_context import get_template_processor
  from superset.models.sql_lab import Query
  from superset.sql_lab import get_sql_results
  from superset.sqllab.command_status import SqlJsonExecutionStatus
  from superset.sqllab.exceptions import QueryIsForbiddenToAccessException, SqlLabException
  from superset.sqllab.execution_context_convertor import ExecutionContextConvertor
  from superset.sqllab.query_render import SqlQueryRenderImpl
  from superset.sqllab.schemas import EstimateQueryCostSchema, ExecutePayloadSchema, FormatQueryPayloadSchema, QueryExecutionResponseSchema, sql_lab_get_results_schema, SQLLabBootstrapSchema
  from superset.sqllab.sql_json_executer import ASynchronousSqlJsonExecutor, SqlJsonExecutor, SynchronousSqlJsonExecutor
  from superset.sqllab.sqllab_execution_context import SqlJsonExecutionContext
  from superset.sqllab.utils import bootstrap_sqllab_data
  from superset.sqllab.validators import CanAccessQueryValidatorImpl
  from superset.superset_typing import FlaskResponse
  from superset.utils import core
  from superset.views.base import CsvResponse, generate_download_headers, json_success
  from superset.views.base_api import BaseSupersetApi, requires_json, statsd_metrics
label_desc: Use image node_id 1 for calling the SqlLabRestApi obj's underlying member method code with example usage: obj.get() and returns: json_success