betodealmeida commented on issue #26646:
URL: https://github.com/apache/superset/issues/26646#issuecomment-1899300277

   Yeah, I agree that automatically splitting the CTE from the query is a 
better UX.
   
   In general, I think it would be good if Superset had an understanding of the 
virtual dataset when exploring it. For example, if I have a virtual dataset 
like this:
   
   ```sql
   SELECT country, COUNT(*)
   FROM t
   GROUP BY 1
   ```
   
   It would be nice when creating a chart Superset parsed the query and 
understood that there are metrics and dimensions in it already. Maybe there's a 
mode that would automatically populate the UI so that `COUNT(*)` shows as a 
metric, and `country` shows as a selected dimension. Today, Superset would try 
to build another aggregation on top of this aggregation, which maybe is what 
the user want, but in my experience going from SQL to viz you really want to 
explore the unaggregated query, and be able to modify it in the UI.
   
   Using a parser to move the CTE around when exploring the virtual dataset 
sounds like a good first step in that direction.
   
   To me, the bigger problem of requiring a `pre_sql` is that it would make it 
cumbersome to go directly from SQL Lab to visualization, requiring the user to 
manually split their query.


-- 
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