getredash/redash · error · ValueError
Queries of type {} can not be processed by redash.
Error message
Queries of type {} can not be processed by redash. What it means
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.
Source
Thrown at redash/query_runner/corporate_memory.py:158
@classmethod
def enabled(cls):
return enabled
@classmethod
def type(cls):
return "corporate_memory"
def run_query(self, query, user):
"""send a sparql query to corporate memory"""
query_text = query
logger.info("about to execute query (user='{}'): {}".format(user, query_text))
query = SparqlQuery(query_text)
query_type = query.get_query_type()
# type of None means, there is an error in the query
# so execution is at least tried on endpoint
if query_type not in ["SELECT", None]:
raise ValueError("Queries of type {} can not be processed by redash.".format(query_type))
self._setup_environment()
try:
data = self._transform_sparql_results(query.get_results())
except Exception as error:
logger.info("Error: {}".format(error))
try:
# try to load Problem Details for HTTP API JSON
details = json.loads(error.response.text)
error = ""
if "title" in details:
error += details["title"] + ": "
if "detail" in details:
error += details["detail"]
return None, error
except Exception:
pass
View on GitHub (pinned to ca79fe988d)
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)
Example fix
# before
ASK { <http://ex/x> ?p ?o }
# after
SELECT (COUNT(*) AS ?triples) WHERE { <http://ex/x> ?p ?o } Defensive patterns
Strategy: validation
Validate before calling
if not query_text.lstrip().upper().startswith('SELECT'):
raise ValueError('rewrite as a SELECT projection before sending to Redash') Type guard
def is_select_sparql(q: str) -> bool:
return q.lstrip().upper().startswith('SELECT') Try / catch
try:
data, err = runner.run_query(q, u)
except ValueError as e:
if 'can not be processed' in str(e):
q = to_select_projection(q); retry Prevention
- 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
When it happens
Trigger: Sending a SPARQL query of type ASK, CONSTRUCT, DESCRIBE, or any other non-SELECT form to a Corporate Memory data source.
Common situations: Reusing SPARQL from tools that default to CONSTRUCT for graph extraction, or expecting Redash to tabulate non-SELECT results.
Related errors
- Queries of type {} can not be processed by redash.
- Invalid JWT token
- Error during query execution. Reason: {error}
- Failed running query [%s].
- Username and Password required
AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28).
Data as JSON: /api/errors/ebb6c9f73886b608.
Report an issue: GitHub.