function query(queryObject, connection) {
  const client = createClient(connection);

  const stream = client.query(queryObject);

  let columnnames = [];
  const rows = [];

  return new Promise((resolve, reject) => {
    stream.on('metadata', columns => {
      columnnames = columns.map(({ name }) => name);
    });

    stream.on('data', row => rows.push(row));

    stream.on('error', err => reject(err));

    stream.on('end', () => resolve({ columnnames, rows }));
  });
}
The following function will execute a query against the
data source.  The function should return a tuple which contains
two elements.  The first is an array of strings which is the column names
The second is a two dimensional array which represents the rows to be displayed
@param {String|Object} queryObject query parameters
@param {Object} connection connection parameters
@returns {Promise} that resolves to { columnnames, rows }