getredash/redash · error · Exception

Query does not have results yet.

Error message

Query does not have results yet.

What it means

get_query_result() raises this when query.latest_query_data is None — the referenced query has never been executed successfully, so there are no cached results to return. The Python helper serves stored results, it does not execute the query for you.

Source

Thrown at redash/query_runner/python.py:281

        Parameters:
        :query_id integer: ID of existing query
        """
        user = self._get_current_user()

        try:
            query = models.Query.query.filter(
                models.Query.id == query_id,
                models.Query.org_id == user.org_id,
            ).one()
        except models.NoResultFound:
            raise Exception("Query id %s does not exist." % query_id)

        if query.data_source is None or not has_access(query.data_source, user, view_only):
            raise Exception("You do not have access to query id %s." % query_id)

        if query.latest_query_data is None:
            raise Exception("Query does not have results yet.")

        if query.latest_query_data.data is None:
            raise Exception("Query does not have results yet.")

        if query.latest_query_data.data_source is None or not has_access(
            query.latest_query_data.data_source, user, view_only
        ):
            raise Exception("You do not have access to query id %s." % query_id)

        return query.latest_query_data.data

    def dataframe_to_result(self, result, df):
        converted_result = pandas_to_result(df)

        result["rows"] = converted_result["rows"]
        for column in converted_result["columns"]:
            self.add_result_column(result, column["name"], column["friendly_name"], column["type"])

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Open the referenced query in Redash and execute it once ('Execute') so latest_query_data is populated
  2. Schedule the referenced query if you need results to always exist
  3. Re-run the Python query after the underlying query completes
Defensive patterns

Strategy: validation

Validate before calling

q = load_query(qid, org)
assert q.latest_query_data is not None, 'execute the source query at least once first'

Try / catch

try:
    get_query_result(qid)
except Exception as e:
    if 'does not have results yet' in str(e):
        trigger_execution(qid); wait_for_result(qid); get_query_result(qid)

Prevention

When it happens

Trigger: Calling get_query_result(id) on a freshly created query that has never run, or on a query whose previous results were deleted (e.g. after data retention cleanup or an execution error left no result).

Common situations: Creating a new query and immediately using its id in a Python query; scheduled queries disabled so results never materialized; all results purged by cleanup.

Related errors


AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28). Data as JSON: /api/errors/0ee064787a203fd4. Report an issue: GitHub.