class_docstr: This handler handles connection and execution of the MySQL statements.
class_docstr_tok: ["This","handler","handles","connection","and","execution","of","the","MySQL","statements","."]
docstr: Unpacks the config from the connection_data.
  
  The connection_data must include either the old style of dictionary
  attriutes (host, optional port, user, password, database) OR have
  a url connection string with username and password optionally supplied
  in the dictionary itself.
  
  Arguments:
  - conection_data is the dictionary parsed from the JSON payload
  
  Exceptions thrown:
  - ValueError if data validation rules fail with a description as the sole
  argument
  
  Returns a dictionary with the relevant config info:
  - host
  - port
  - user
  - password
  - database
docstr_tok: ["Unpacks","the","config","from","the","connection_data",".","The","connection_data","must","include","either","the","old","style","of","dictionary","attriutes","(","host",",","optional","port",",","user",",","password",",","database",")","OR","have","a","url","connection","string","with","username","and","password","optionally","supplied","in","the","dictionary","itself",".","Arguments",":","-","conection_data","is","the","dictionary","parsed","from","the","JSON","payload","Exceptions","thrown",":","-","ValueError","if","data","validation","rules","fail","with","a","description","as","the","sole","argument","Returns","a","dictionary","with","the","relevant","config","info",":","-","host","-","port","-","user","-","password","-","database"]
code: def _unpack_config(self):
      """
      Unpacks the config from the connection_data.
  
      The connection_data must include either the old style of dictionary
      attriutes (host, optional port, user, password, database) OR have
      a url connection string with username and password optionally supplied
      in the dictionary itself.
  
      Arguments:
      - conection_data is the dictionary parsed from the JSON payload
  
      Exceptions thrown:
      - ValueError if data validation rules fail with a description as the sole
      argument
  
      Returns a dictionary with the relevant config info:
      - host
      - port
      - user
      - password
      - database
      """
      url = self.connection_data.get("url")
      if url:
          urlfields = urlparse(url)
          if urlfields.scheme != "mysql":
              raise ValueError(
                  "If using a URL to connect to MySQL, the URL needs to start with 'mysql://'"
              )
          if urlfields.username and self.connection_data.get("user"):
              raise ValueError(
                  "Cannot specify a user in both the URL and elsewhere"
              )
          if urlfields.username and self.connection_data.get(
              "password"
          ):
              raise ValueError(
                  "Cannot specify a password in both the URL and elsewhere"
              )
          if not urlfields.host:
              raise ValueError(
                  "Connection URL does not include hostname"
              )
          if not urlfields.path:
              raise ValueError(
                  "Connection URL does not include database"
              )
          config = {
              "host": urlfields.host,
              "port": urlfields.port or 3306,
              "user": urlfields.username
              or self.connection_data.get("user"),
              "password": urlfields.password
              or self.connection_data.get("password"),
              "database": urlfields.path,
          }
  
      else:
          config = {
              "host": self.connection_data.get("host"),
              "port": self.connection_data.get("port") or 3306,
              "user": self.connection_data.get("user"),
              "password": self.connection_data.get("password"),
              "database": self.connection_data.get("database"),
          }
  
          if not config.get("host"):
              raise ValueError("Must supply a host")
          if not config.get("database"):
              raise ValueError("Must supply a database name")
  
      if not config.get("user"):
          raise ValueError("Must supply a user")
      if not config.get("password"):
          raise ValueError("Must supply a password for connections")
      return config
  
imports: from collections import OrderedDict
  import pandas
  import mysql.connector
  from urllib.parse import urlparse
  from sqlalchemy import create_engine
  from mindsdb_sql import parse_sql
  from mindsdb_sql.render.sqlalchemy_render import SqlalchemyRender
  from mindsdb_sql.parser.ast.base import ASTNode
  from mindsdb.utilities import log
  from mindsdb.integrations.libs.base import DatabaseHandler
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
  from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE
label_desc: Use image node_id 3 for calling the MySQLHandler obj's underlying member method code with example usage: obj._unpack_config() and returns: config