class_docstr: This handler handles connection and execution of the Cloud Spanner statements.
class_docstr_tok: ["This","handler","handles","connection","and","execution","of","the","Cloud","Spanner","statements","."]
docstr: Check the connection to the Cloud Spanner database.
  
  Returns:
      StatusResponse: Connection success status and error message if an error occurs.
docstr_tok: ["Check","the","connection","to","the","Cloud","Spanner","database",".","Returns",":","StatusResponse",":","Connection","success","status","and","error","message","if","an","error","occurs","."]
code: def check_connection(self) -> StatusResponse:
      """Check the connection to the Cloud Spanner database.
  
      Returns:
          StatusResponse: Connection success status and error message if an error occurs.
      """
  
      response = StatusResponse(False)
  
      try:
          self.connect()
          response.success = True
      except Exception as e:
          logger.error(
              f'Error connecting to Cloud Spanner {self.connection_data["database_id"]}, {e}!'
          )
          response.error_message = str(e)
      finally:
          if response.success is True and self.is_connected:
              self.disconnect()
          if response.success is False and self.is_connected:
              self.is_connected = False
  
      return response
  
imports: import json
  from collections import OrderedDict
  from google.oauth2 import service_account
  from google.cloud import spanner_dbapi
  from google.cloud.spanner_dbapi import Connection
  from google.cloud.sqlalchemy_spanner import SpannerDialect
  import pandas
  from mindsdb_sql import parse_sql
  from mindsdb_sql.parser.ast.base import ASTNode
  from mindsdb_sql.parser.ast import CreateTable, Function
  from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender
  from mindsdb.integrations.libs.base import DatabaseHandler
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
  from mindsdb.integrations.libs.response import RESPONSE_TYPE
  from mindsdb.integrations.libs.response import HandlerResponse
  from mindsdb.integrations.libs.response import HandlerStatusResponse
  from mindsdb.utilities import log
label_desc: Use image node_id 5 for calling the CloudSpannerHandler obj's underlying member method code with example usage: obj.check_connection() and returns: response