getredash/redash · error

Resource only available for the Databricks query runner.

Error message

Resource only available for the Databricks query runner.

What it means

Raised by _get_databricks_data_source in redash/handlers/databricks.py when the requested data source exists and is accessible but its type is not 'databricks'. The Databricks-specific endpoints (listing databases/tables/schemas) only work against Databricks query runners.

Source

Thrown at redash/handlers/databricks.py:22

from redash import models, redis_connection
from redash.handlers.base import BaseResource, get_object_or_404
from redash.permissions import require_access, view_only
from redash.serializers import serialize_job
from redash.tasks.databricks import (
    get_database_tables_with_columns,
    get_databricks_databases,
    get_databricks_table_columns,
    get_databricks_tables,
)
from redash.utils import json_loads


def _get_databricks_data_source(data_source_id, user, org):
    data_source = get_object_or_404(models.DataSource.get_by_id_and_org, data_source_id, org)
    require_access(data_source, user, view_only)

    if not data_source.type == "databricks":
        abort(400, message="Resource only available for the Databricks query runner.")

    return data_source


def _databases_key(data_source_id):
    return "databricks:databases:{}".format(data_source_id)


def _tables_key(data_source_id, database_name):
    return "databricks:database_tables:{}:{}".format(data_source_id, database_name)


def _get_databases_from_cache(data_source_id):
    cache = redis_connection.get(_databases_key(data_source_id))
    return json_loads(cache) if cache else None


def _get_tables_from_cache(data_source_id, database_name):

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Use the data source id whose type is 'databricks' (verify via GET /api/data_sources).
  2. If you need databases/tables for other runner types, use their own schema endpoints (e.g. /api/data_sources/<id>/schema).
  3. Re-create or reconfigure the data source as a Databricks type if that was intended.

Example fix

# before
resp = client.get(f'/api/data_sources/{pg_ds_id}/databricks/databases')

# after
resp = client.get(f'/api/data_sources/{databricks_ds_id}/databricks/databases')
Defensive patterns

Strategy: type-guard

Validate before calling

ds = client.get(f'/api/data_sources/{ds_id}')
assert ds['type'] == 'databricks', f"expected databricks, got {ds['type']}"

Type guard

def is_databricks(ds: dict) -> bool:
    return ds.get('type') == 'databricks'

Prevention

When it happens

Trigger: Calling /api/data_sources/<id>/databricks/databases (or the tables endpoint) with the id of a PostgreSQL, Athena, or any non-Databricks data source.

Common situations: Copying an integration example but pointing at the wrong data source id; migrating a data source from another runner to Databricks and hitting the old id before re-creating it; UI scripts enumerating all data sources and calling Databricks endpoints on each.

Related errors


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