class_docstr: Testings for Sql Lab
code: def test_sql_json_has_access(self):
      examples_db = get_example_database()
      examples_db_permission_view = (
          security_manager.add_permission_view_menu(
              "database_access", examples_db.perm
          )
      )
      astronaut = security_manager.add_role("ExampleDBAccess")
      security_manager.add_permission_role(
          astronaut, examples_db_permission_view
      )
      # Gamma user, with sqllab and db permission
      self.create_user_with_roles(
          "Gagarin", ["ExampleDBAccess", "Gamma", "sql_lab"]
      )
  
      data = self.run_sql(QUERY_1, "1", username="Gagarin")
      db.session.query(Query).delete()
      db.session.commit()
      self.assertLess(0, len(data["data"]))
  
imports: import json
  from datetime import datetime
  import pytest
  from celery.exceptions import SoftTimeLimitExceeded
  from parameterized import parameterized
  from unittest import mock
  import prison
  from freezegun import freeze_time
  from superset import db, security_manager
  from superset.connectors.sqla.models import SqlaTable
  from superset.db_engine_specs import BaseEngineSpec
  from superset.db_engine_specs.hive import HiveEngineSpec
  from superset.db_engine_specs.presto import PrestoEngineSpec
  from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
  from superset.exceptions import SupersetErrorException
  from superset.models.sql_lab import Query, SavedQuery
  from superset.result_set import SupersetResultSet
  from superset.sqllab.limiting_factor import LimitingFactor
  from superset.sql_lab import cancel_query, execute_sql_statements, apply_limit_if_exists
  from superset.sql_parse import CtasMethod
  from superset.utils.core import backend, datetime_to_epoch
  from superset.utils.database import get_example_database, get_main_database
  from .base_tests import SupersetTestCase
  from .conftest import CTAS_SCHEMA_NAME
  from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices, load_birth_names_data
  from tests.integration_tests.fixtures.users import create_gamma_sqllab_no_data
label_desc: Use image node_id 9 for calling the TestSqlLab obj's underlying member method code with example usage: obj.test_sql_json_has_access() without return types