text: import datetime
  import pymysql as sql
  
  
  class MySQL:
      host= 'localhost'
      user = 'root'
      passwd = ''
      database = 'mlir_test'
  
      connect = None
  
      def __init__(self):
          self.connect = sql.connect(host = self.host,
                                     user = self.user,
                                     passwd = self.passwd,
                                     db = self.database,
                                     charset = 'utf8')
  
      def insert(self):
          # time = datetime.datetime.now()
          cmd = 'insert into test_cases(type, name, branch, status) values (%s, %s, %s, %s)'
          values = [
              ("add", "add_xxxx_xxx_0", "master", "0"),
              ("add", "add_xxxx_xxx_1", "master", "0"),
          ]
  
          cursor = self.connect.cursor()
          try:
              cursor.executemany(cmd, values)
              self.connect.commit()
          except Exception as e:
              self.connect.rollback()
              print(e)
          cursor.close()
  
      def search(self):
          # cmd = 'select * from test_cases where name like "%1"'
          cmd = 'select * from test_cases where type="add"'
  
          cursor = self.connect.cursor()
          try:
              cursor.execute(cmd)
              result = cursor.fetchall()
              print(result)
          except Exception as e:
              print(e)
          cursor.close()
  
  sql = MySQL()
  sql.insert()
  sql.search()
  