{"record":{"id":"f737fc40a4c0bbb4","repo":"getredash/redash","slug":"queries-of-type-can-not-be-processed-by-redash-f737fc","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/sparql_endpoint.py","lineNumber":127,"sourceCode":"    @classmethod\n    def enabled(cls):\n        return enabled\n\n    @classmethod\n    def type(cls):\n        return \"sparql_endpoint\"\n\n    def remove_comments(self, string):\n        return string[string.index(\"*/\") + 2 :].strip()\n\n    def run_query(self, query, user):\n        \"\"\"send a query to a sparql endpoint\"\"\"\n        logger.info(\"about to execute query (user='{}'): {}\".format(user, query))\n        query_text = self.remove_comments(query)\n        query = SparqlQuery(query_text)\n        query_type = query.get_query_type()\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            endpoint = self.configuration.get(\"SPARQL_BASE_URI\")\n            r = requests.get(\n                endpoint,\n                params=dict(query=query_text),\n                headers=dict(Accept=\"application/json\"),\n            )\n            data = self._transform_sparql_results(r.text)\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\"] + \": \"","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/sparql_endpoint.py#L109-L145","documentation":"Raised by SparqlEndpoint.run_query (redash/query_runner/sparql_endpoint.py:127) as ValueError when the parsed SPARQL query type is not SELECT (and not None). Redash can only tabulate SELECT result sets, so ASK, CONSTRUCT, DESCRIBE, and update queries (INSERT/DELETE) are rejected before the request is sent.","triggerScenarios":"Executing an ASK/CONSTRUCT/DESCRIBE query, or a SPARQL UPDATE (INSERT DATA / DELETE WHERE), against the SPARQL endpoint data source; a query whose leading keyword after comment stripping is anything but SELECT.","commonSituations":"Users pasting full graph-update scripts into Redash; CONSTRUCT queries intended for RDF extraction; commented-out prefixes confusing the naive type detection so a non-SELECT statement is inferred.","solutions":["Rewrite the query as SELECT (e.g. convert ASK to SELECT 1 AS result WHERE {...}, project CONSTRUCT triples via SELECT ?s ?p ?o)","Run SPARQL updates outside Redash with a dedicated tool or HTTP client","Strip leading comments so the type detector sees the real first keyword"],"exampleFix":"# before\nASK { ?s a foaf:Person }\n# after\nSELECT ?s WHERE { ?s a foaf:Person } LIMIT 100","handlingStrategy":"validation","validationCode":"qtype = SparqlQuery(remove_comments(query)).get_query_type()\nif qtype not in ('SELECT', None):\n    return None, 'Only SELECT queries are supported, got {}'.format(qtype)","typeGuard":"def is_supported_sparql(q: str) -> bool:\n    t = SparqlQuery(q).get_query_type()\n    return t in ('SELECT', None)","tryCatchPattern":"try:\n    run_query(query, user)\nexcept ValueError as e:\n    return error_response(400, str(e))","preventionTips":["Normalize all saved SPARQL queries to SELECT form","Convert ASK to SELECT with a boolean column; run updates outside Redash","Strip comments before type detection when pre-processing user input"],"tags":["sparql","redash","unsupported-query","validation"],"backgroundTag":"unsupported-query-type","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}