class_docstr: Testings for Sql Lab
code: def test_sql_json(self):
      examples_db = get_example_database()
      engine_name = examples_db.db_engine_spec.engine_name
  
      self.login("admin")
  
      data = self.run_sql("SELECT * FROM birth_names LIMIT 10", "1")
      self.assertLess(0, len(data["data"]))
  
      data = self.run_sql("SELECT * FROM nonexistent_table", "2")
      if backend() == "presto":
          assert (
              data["errors"][0]["error_type"]
              == SupersetErrorType.TABLE_DOES_NOT_EXIST_ERROR
          )
          assert data["errors"][0]["level"] == ErrorLevel.ERROR
          assert data["errors"][0]["extra"] == {
              "engine_name": "Presto",
              "issue_codes": [
                  {
                      "code": 1003,
                      "message": "Issue 1003 - There is a syntax error in the SQL query. Perhaps there was a misspelling or a typo.",
                  },
                  {
                      "code": 1005,
                      "message": "Issue 1005 - The table was deleted or renamed in the database.",
                  },
              ],
          }
      else:
          assert (
              data["errors"][0]["error_type"]
              == SupersetErrorType.GENERIC_DB_ENGINE_ERROR
          )
          assert data["errors"][0]["level"] == ErrorLevel.ERROR
          assert data["errors"][0]["extra"] == {
              "issue_codes": [
                  {
                      "code": 1002,
                      "message": "Issue 1002 - The database returned an unexpected error.",
                  }
              ],
              "engine_name": engine_name,
          }
  
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 3 for calling the TestSqlLab obj's underlying member method code with example usage: obj.test_sql_json() without return types