async function runQuery(query, connection) {
  const {
    contactPoints,
    keyspace,
    localDataCenter,
    maxRows,
    username,
    password,
  } = connection;
  const caConfig = {
    contactPoints: contactPoints.split(',').map((cp) => cp.trim()),
    // Unfamiliar with cassandra - docs mention datacenter1 and this works as a default so leaving it in
    // If someone familiar with cassandra can expand on this please do
    localDataCenter: localDataCenter || 'datacenter1',
    keyspace,
  };

  if (connection.username && connection.password) {
    caConfig['authProvider'] = new cassandra.auth.PlainTextAuthProvider(
      username,
      password
    );
  }

  const client = new cassandra.Client(caConfig);

  try {
    const result = await client.execute(query, [], { fetchSize: maxRows });
    shutdownClient(client);
    const incomplete = result.rows && result.rows.length === maxRows;
    return { rows: result.rows, incomplete };
  } catch (error) {
    shutdownClient(client);
    throw error;
  }
}
Run query for connection
Should return { rows, incomplete }
@param {string} query
@param {object} connection