Home | History | Annotate | Download | only in tko
      1 import common
      2 import MySQLdb as driver
      3 import db
      4 from autotest_lib.client.common_lib.cros import retry
      5 
      6 class db_mysql(db.db_sql):
      7     @retry.retry(db._get_error_class("OperationalError"), timeout_min=2,
      8                  delay_sec=0.5)
      9     def connect(self, host, database, user, password, port):
     10         connection_args = {
     11             'host': host,
     12             'user': user,
     13             'db': database,
     14             'passwd': password,
     15         }
     16         if port:
     17             connection_args['port'] = int(port)
     18         return driver.connect(**connection_args)
     19