def query(self, sql, parameters=None):
        """A generator to issue a query on the server, mogrifying the
        parameters against the sql statement. Results are returned as a
        :py:class:`queries.Results` object which can act as an iterator and
        has multiple ways to access the result data.

        :param str sql: The SQL statement
        :param dict parameters: A dictionary of query parameters
        :rtype: queries.Results
        :raises: queries.DataError
        :raises: queries.DatabaseError
        :raises: queries.IntegrityError
        :raises: queries.InternalError
        :raises: queries.InterfaceError
        :raises: queries.NotSupportedError
        :raises: queries.OperationalError
        :raises: queries.ProgrammingError

        """
        try:
            self._cursor.execute(sql, parameters)
        except psycopg2.Error as err:
            self._incr_exceptions()
            raise err
        finally:
            self._incr_executions()
        return results.Results(self._cursor)