ArtemSannikov commented on issue #23125:
URL: https://github.com/apache/superset/issues/23125#issuecomment-2370586595

   > Hii Problem : I have created and executed an Stored Procedure on Sql-Lab 
and it run successfully , through with I created the dataset and when I go on 
the chart screen I got an error like this : **Virtual dataset query cannot 
consist of multiple statements**
   > 
   > My Stored Procedure is Multi-statement in which column is dynamically 
generated.
   > 
   > ```
   > SET SESSION group_concat_max_len=1000000;
   > select group_concat(distinct concat('case when pfmap.size 
=''',pf.DESCRIPTION,''' then pfmap.result end as ',"'",pf.DESCRIPTION,"'")) 
into @sql
   > from product_feature_appl pfa
   > inner join product_feature pf on pf.PRODUCT_FEATURE_ID = 
pfa.PRODUCT_FEATURE_ID and pf.PRODUCT_FEATURE_TYPE_ID='SIZE' and 
pfa.PRODUCT_FEATURE_APPL_TYPE_ID='STANDARD_FEATURE' and pfa.THRU_DATE is null
   > inner join product p on pfa.PRODUCT_ID = p.PRODUCT_ID
   > where exists (select order_id from order_item where 
product_id=p.product_id and created_stamp between now()-interval 6 month and 
now())
   > ;
   > SET @sql = CONCAT('select 
pfmap.vir_prod_id,pfmap.vir_prod_name,pfmap.var_prod_id,pfmap.var_prod_name,pfmap.COLOR,pfmap.facility_id,pfmap.ATP,pfmap.min_stock,pfmap.INBOUND,
 ',@sql,
   > "from
   > ..........
   > ) as pfmap where pfmap.result is not null order by pfmap.facility_id");
   > PREPARE stmt FROM @sql;
   > EXECUTE stmt;
   > -- DEALLOCATE PREPARE stmt;
   > ```
   > 
   > ![Screenshot from 2023-02-20 
16-01-25](https://user-images.githubusercontent.com/72196393/220082936-f46c465f-5dab-44b7-9eee-cb57b3d66c89.png)
   > 
   > Dependency : Using 2.0.0-dev and 2.0.1 Both have the same result
   > 
   > Question :
   > 
   > * Is Multi-Statement Stored Procedure Query is not supported in superset 
for making chart .
   > * Is I am Missing something regards to that .
   >   @rusackas
   
   How did you solve your problem?


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