async connect() {
    if (this.client) {
      return;
    }
    const { connection } = this;

    const myConfig = {
      host: connection.host,
      port: connection.port ? connection.port : 3306,
      user: connection.username,
      password: connection.password,
      database: connection.database,
      insecureAuth: connection.mysqlInsecureAuth,
      timezone: 'Z',
      supportBigNumbers: true,
      ssl: connection.mysqlSsl,
      preQueryStatements: connection.preQueryStatements,
      flags: '+INTERACTIVE',
      dateStrings: true,
    };

    // TODO cache key/cert values
    if (connection.mysqlKey && connection.mysqlCert) {
      myConfig.ssl = {
        key: loadData(connection.mysqlKey),
        cert: loadData(connection.mysqlCert),
      };
      if (connection.mysqlCA) {
        myConfig.ssl['ca'] = loadData(connection.mysqlCA);
      }
    }

    this.client = mysql.createConnection(myConfig);

    this.client.on('error', (err) => {
      appLog.error(err);
    });

    await new Promise((resolve, reject) => {
      this.client.connect(async (err) => {
        if (err) {
          return reject(err);
        }
        resolve();
      });
    });

    // Run pre query statements
    // Statements split by JS because MySQL multipleStatements is turned off
    if (myConfig.preQueryStatements) {
      // sqlLimiter may return empty statements so they should be stripped out
      const statements = sqlLimiter
        .getStatements(connection.preQueryStatements)
        .map((s) => sqlLimiter.removeTerminator(s))
        .filter((s) => s && s.trim() !== '');

      for (const statement of statements) {
        await new Promise((resolve, reject) => {
          this.client.query(statement, (err) => {
            if (err) {
              return reject(err);
            }
            return resolve();
          });
        });
      }
    }
  }
Establish db client connection if not already connected