{"record":{"id":"ebb6c9f73886b608","repo":"getredash/redash","slug":"queries-of-type-can-not-be-processed-by-redash","errorCode":null,"errorMessage":"Queries of type {} can not be processed by redash.","messagePattern":"Queries of type (.+?) can not be processed by redash\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"redash/query_runner/corporate_memory.py","lineNumber":158,"sourceCode":"\n    @classmethod\n    def enabled(cls):\n        return enabled\n\n    @classmethod\n    def type(cls):\n        return \"corporate_memory\"\n\n    def run_query(self, query, user):\n        \"\"\"send a sparql query to corporate memory\"\"\"\n        query_text = query\n        logger.info(\"about to execute query (user='{}'): {}\".format(user, query_text))\n        query = SparqlQuery(query_text)\n        query_type = query.get_query_type()\n        # type of None means, there is an error in the query\n        # so execution is at least tried on endpoint\n        if query_type not in [\"SELECT\", None]:\n            raise ValueError(\"Queries of type {} can not be processed by redash.\".format(query_type))\n\n        self._setup_environment()\n        try:\n            data = self._transform_sparql_results(query.get_results())\n        except Exception as error:\n            logger.info(\"Error: {}\".format(error))\n            try:\n                # try to load Problem Details for HTTP API JSON\n                details = json.loads(error.response.text)\n                error = \"\"\n                if \"title\" in details:\n                    error += details[\"title\"] + \": \"\n                if \"detail\" in details:\n                    error += details[\"detail\"]\n                    return None, error\n            except Exception:\n                pass\n","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/corporate_memory.py#L140-L176","documentation":"CorporateMemoryRunner only accepts SPARQL SELECT queries (or queries whose type can't be determined, which are attempted anyway). SparqlQuery.get_query_type returns ASK/CONSTRUCT/DESCRIBE for other forms, and those are rejected before execution.","triggerScenarios":"Sending a SPARQL query of type ASK, CONSTRUCT, DESCRIBE, or any other non-SELECT form to a Corporate Memory data source.","commonSituations":"Reusing SPARQL from tools that default to CONSTRUCT for graph extraction, or expecting Redash to tabulate non-SELECT results.","solutions":["Rewrite the query as a SELECT with the projections you want","Convert CONSTRUCT patterns to SELECT ?s ?p ?o form","Express boolean checks as SELECT (COUNT(*) AS ?n) or SELECT (bound(?x) AS ?result)"],"exampleFix":"# before\nASK { <http://ex/x> ?p ?o }\n\n# after\nSELECT (COUNT(*) AS ?triples) WHERE { <http://ex/x> ?p ?o }","handlingStrategy":"validation","validationCode":"if not query_text.lstrip().upper().startswith('SELECT'):\n    raise ValueError('rewrite as a SELECT projection before sending to Redash')","typeGuard":"def is_select_sparql(q: str) -> bool:\n    return q.lstrip().upper().startswith('SELECT')","tryCatchPattern":"try:\n    data, err = runner.run_query(q, u)\nexcept ValueError as e:\n    if 'can not be processed' in str(e):\n        q = to_select_projection(q); retry","preventionTips":["Standardize on SELECT projections for BI consumption of SPARQL","Lint SPARQL in CI before it reaches Redash","Convert CONSTRUCT graphs to SELECT ?s ?p ?o patterns"],"tags":["redash","sparql","corporate-memory","query-type"],"backgroundTag":"unsupported-query-type","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}