{"record":{"id":"ee7fc6c4fda4b212","repo":"apache/superset","slug":"drill-to-detail-is-not-available-for-this-datasour","errorCode":null,"errorMessage":"Drill to detail is not available for this datasource type.","messagePattern":"Drill to detail is not available for this datasource type\\.","errorType":"validation","errorClass":"QueryObjectValidationError","httpStatus":400,"severity":"error","filePath":"superset/common/query_actions.py","lineNumber":260,"sourceCode":"    query_obj.from_dttm = None\n    query_obj.to_dttm = None\n    return query_obj\n\n\ndef _prepare_drill_detail_query(\n    query_context: QueryContext,\n    query_obj: QueryObject,\n) -> QueryObject:\n    # todo(yongjie): Remove this function,\n    #  when determining whether samples should be applied to the time filter.\n    datasource = _get_datasource(query_context, query_obj)\n    # Refuse for datasource types that don't model raw rows (e.g. semantic\n    # views). Mirrors the ``supports_samples`` gate on the ``/samples``\n    # endpoint so drill-detail is hard-blocked on the backend, not just\n    # hidden in the frontend menu. Defaults to ``True`` for any datasource\n    # class that doesn't explicitly opt out.\n    if not getattr(datasource, \"supports_drill_to_detail\", True):\n        raise QueryObjectValidationError(\n            _(\"Drill to detail is not available for this datasource type.\")\n        )\n    query_obj = copy.copy(query_obj)\n    query_obj.is_timeseries = False\n    query_obj.metrics = None\n    query_obj.post_processing = []\n    qry_obj_cols = []\n    for o in datasource.columns:\n        if isinstance(o, dict):\n            if column_name := o.get(\"column_name\"):\n                qry_obj_cols.append(column_name)\n        else:\n            qry_obj_cols.append(o.column_name)\n    query_obj.columns = qry_obj_cols\n    query_obj.orderby = [(query_obj.columns[0], True)]\n    return query_obj\n\n","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/common/query_actions.py#L242-L278","documentation":"In query_actions drill-to-detail preparation, Superset checks getattr(datasource, 'supports_drill_to_detail', True) and hard-blocks the query with QueryObjectValidationError for datasource classes that opt out (e.g. semantic-layer/semantic views that don't model raw rows). This mirrors the supports_samples gate so drill-detail cannot be forced via the API even if the frontend hides it.","triggerScenarios":"POSTing a query context with result type that triggers drill-to-detail (or the drill-detail endpoint) against a datasource whose class defines supports_drill_to_detail = False, e.g. a QUERY/semantic-layer datasource.","commonSituations":"Using the 'View results'/'Drill to detail' UI or API on a chart built on a semantic view; custom datasource plugins that forgot to set the flag; API clients replaying drill-detail payloads against unsupported datasource types.","solutions":["Use a datasource type that supports raw-row access (a physical dataset/table) for drill-to-detail.","If you maintain a custom datasource class and it does expose rows, set supports_drill_to_detail = True on it.","Remove/hide drill-to-detail UI affordances for charts on semantic datasources."],"exampleFix":"# before (client)\nresult_type = \"drill\"  # against semantic-layer datasource\n\n# after\nif not getattr(datasource, \"supports_drill_to_detail\", True):\n    result_type = \"results\"  # fall back to aggregated results","handlingStrategy":"validation","validationCode":"if not getattr(datasource, \"supports_drill_to_detail\", True):\n    raise ValueError(\"drill-to-detail unsupported for this datasource\")","typeGuard":"def supports_drill(ds) -> bool:\n    return bool(getattr(ds, \"supports_drill_to_detail\", True))","tryCatchPattern":"from superset.exceptions import QueryObjectValidationError\ntry:\n    run_drill_query(qc)\nexcept QueryObjectValidationError as e:\n    if \"Drill to detail\" in str(e):\n        fall_back_to_aggregated_results()","preventionTips":["Hide drill-detail affordances for semantic/query datasources","Set the flag explicitly on custom datasource classes"],"tags":["query","drill-to-detail","datasource","validation","backend"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}