class_docstr: Contais some helpful set of methods and attributes for tests execution.
class_docstr_tok: ["Contais","some","helpful","set","of","methods","and","attributes","for","tests","execution","."]
docstr: Run mysql docker container
  Perform connection to mindsdb database
  Execute sql request
  ----------------------
  It is very problematic (or even impossible)
  to provide sql statement as it is in 'docker run command',
  that's why this action is splitted on three steps:
      Save sql statement into temporary dir in .sql file
      Run docker container with volume points to this temp dir,
      Provide .sql file as input parameter for 'mysql' command
docstr_tok: ["Run","mysql","docker","container","Perform","connection","to","mindsdb","database","Execute","sql","request","--","--","--","--","--","--","--","--","--","--","--","It","is","very","problematic","(","or","even","impossible",")","to","provide","sql","statement","as","it","is","in","'docker","run","command","'",",","that","'s","why","this","action","is","splitted","on","three","steps",":","Save","sql","statement","into","temporary","dir","in",".sql","file","Run","docker","container","with","volume","points","to","this","temp","dir",",","Provide",".sql","file","as","input","parameter","for","'mysql","'","command"]
code: def query(self, _query, encoding="utf-8"):
      """Run mysql docker container
      Perform connection to mindsdb database
      Execute sql request
      ----------------------
      It is very problematic (or even impossible)
      to provide sql statement as it is in 'docker run command',
      that's why this action is splitted on three steps:
          Save sql statement into temporary dir in .sql file
          Run docker container with volume points to this temp dir,
          Provide .sql file as input parameter for 'mysql' command"""
      with tempfile.TemporaryDirectory() as tmpdirname:
          with open(f"{tmpdirname}/test.sql", "w") as f:
              f.write(_query)
          cmd = f"{self.launch_query_tmpl} < /temp/test.sql"
          cmd = 'sh -c "' + cmd + '"'
          res = self.docker_client.containers.run(
              self.mysql_image,
              command=cmd,
              remove=True,
              volumes={
                  str(tmpdirname): {"bind": "/temp", "mode": "ro"}
              },
              environment={
                  "MYSQL_PWD": self.config["auth"]["password"]
              },
          )
      return self.to_dicts(res.decode(encoding))
  
imports: import os
  import time
  import tempfile
  import json
  from pathlib import Path
  import docker
  import pandas
  import requests
  import pytest
  from .conftest import docker_inet_ip, TEMP_DIR
label_desc: Use image node_id 2 for calling the BaseStuff obj's underlying member method code with example usage: obj.query(_query, encoding) and returns: self