dosubot[bot] commented on issue #32541:
URL: https://github.com/apache/superset/issues/32541#issuecomment-2706740153

   <!-- Greeting -->
   Hey @lowrykun! 👋 I'm here to help you with any bugs, questions, or 
contributions you have for Superset. Let's tackle this issue together!
   
   <!-- Answer -->
   The error message "Custom SQL fields cannot contain sub-queries" you're 
encountering seems to be related to how Superset handles SQL parsing and 
validation, particularly with column aliases that contain spaces. In Superset 
4.1.1, the `validate_adhoc_subquery` function is responsible for checking if 
SQL contains sub-queries, and it raises an error if sub-queries are not allowed 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/models/helpers.py)</sup>.
   
   The issue with spaces in column aliases might be causing the SQL parser to 
misinterpret the query structure, leading to this error. While there isn't a 
direct workaround documented for handling spaces in aliases, using snake_case 
or other naming conventions without spaces seems to avoid the issue, as you've 
discovered.
   
   Additionally, the `SQLStatement` class in the `superset/sql/parse.py` file 
is involved in parsing SQL statements and could be affected by spaces in 
aliases 
<sup>[[2]](https://github.com/apache/superset/blob/master/superset/sql/parse.py)</sup>.
 You might want to consider using underscores or other characters instead of 
spaces in your column aliases to prevent this parsing issue.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/147db41b-993a-4e05-97a5-adae9261ef86?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/147db41b-993a-4e05-97a5-adae9261ef86?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/147db41b-993a-4e05-97a5-adae9261ef86?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/147db41b-993a-4e05-97a5-adae9261ef86?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/147db41b-993a-4e05-97a5-adae9261ef86?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/147db41b-993a-4e05-97a5-adae9261ef86?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/147db41b-993a-4e05-97a5-adae9261ef86?feedback_type=other)</sup>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to