Vitor-Avila commented on issue #33591:
URL: https://github.com/apache/superset/issues/33591#issuecomment-2913311729

   @sadpandajoe @michael-s-molina this is a consequence of changes to the 
dataset edit dialog. Now, once you change the SQL query powering your dataset, 
the columns are automatically synced for the dataset, and since `product_line 
in ({{ "'" + "', '".join(filter_values('product_line')) + "'" }})` results in 
`product_line in ()`, the query returns no results so you don't have any 
columns.
   
   A solution is to build the SQL query with `if/else` to make sure results are 
always returned. For example:
   
   ``` sql 
   WITH calculation as (
        SELECT count(*), country
        FROM "Vehicle Sales"
        WHERE 1=1
        {% if filter_values('product_line') %}
                and product_line in {{ filter_values('product_line')|where_in }}
        {% else %} -- this is only optional if you want to have a default value 
in the Charts builder/without a native filter applied
                and product_line = 'Classic Cars'
        {% endif %}
        GROUP BY country
   )
   SELECT * FROM calculation
   ```


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