def METHOD_NAME(self, query: str) -> Response:
    """
    Receive SQL query and runs it
    :param query: The SQL query to run in PostgreSQL
    :return: returns the records from the current recordset
    """
    need_to_close = self.is_connected is False
    connection = self.connect()
    with connection.cursor() as cur:
        try:
            cur.execute(query)
            if ExecStatus(cur.pgresult.status) == ExecStatus.COMMAND_OK:
                response = Response(RESPONSE_TYPE.OK)
            else:
                result = cur.fetchall()
                response = Response(
                    RESPONSE_TYPE.TABLE,
                    DataFrame(
                        result,
                        columns=[x.name for x in cur.description]
                    )
                )
            connection.commit()
        except Exception as e:
            log.logger.error(f'Error running query: {query} on {self.database}!')
            response = Response(
                RESPONSE_TYPE.ERROR,
                error_code=0,
                error_message=str(e)
            )
            connection.rollback()
    if need_to_close is True:
        self.disconnect()
    return response