You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/09/09 11:06:04 UTC

[GitHub] [superset] anthony6401 opened a new issue #16650: Jinja template is not working when async query is enabled

anthony6401 opened a new issue #16650:
URL: https://github.com/apache/superset/issues/16650


   Following up from #16412
   
   I tried using jinja template with global async queries(GAQ) enabled in version 1.3.0. I got the same error as stated in here (#14786). 
   
   In recent release (v1.3.1rc1), the issue was addressed and it should be fixed. However, I tried to install the new release and enable jinja template as well as GAQ to simulate the previous error. It doesn't throw any error, but now it shows wrong values.
   
   ### Expected results
   GAQ should work with jinja templating and shows correct values.
   
   ### Actual results
   As you can see from the screenshot, the chart returns `0`. However, if you look at the bottom data, it returns `4625` (which is the correct one) instead of `0`. 
   
   #### Screenshots
   ![image](https://user-images.githubusercontent.com/65406233/132672699-827d31cd-3a38-44b1-8f1b-895b6b57da12.png)
   
   Looking at the logs it seems the first query (for the chart) pass through the jinja template, but has no context/variable that should be appended, hence it put the value `None`.
   
   ```
   superset_app             | 172.21.0.1 - - [09/Sep/2021 10:47:39] "GET /api/v1/async_event/?last_id=1631183590197-0 HTTP/1.1" 200 -
   superset_app             | 2021-09-09 10:47:39,394:INFO:werkzeug:172.21.0.1 - - [09/Sep/2021 10:47:39] "GET /api/v1/async_event/?last_id=1631183590197-0 HTTP/1.1" 200 -
   superset_app             | 2021-09-09 10:47:39,443:DEBUG:superset.sql_parse:Parsing with sqlparse statement: SELECT *
   superset_app             | FROM "Flights"
   superset_app             | WHERE "AIRLINE" = 'None'
   superset_app             | 2021-09-09 10:47:39,456:INFO:superset.common.utils:Cache key: 165593a0806194e5c6b40923f7e946b2
   superset_app             | 2021-09-09 10:47:39,456:DEBUG:superset.stats_logger:[stats_logger] (incr) loading_from_cache
   superset_app             | 2021-09-09 10:47:39,456:DEBUG:superset.stats_logger:[stats_logger] (incr) loaded_from_cache
   superset_app             | 2021-09-09 10:47:39,456:INFO:superset.common.utils:Serving from cache
   superset_app             | 2021-09-09 10:47:39,461:DEBUG:superset.stats_logger:[stats_logger] (incr) ChartRestApi.data_from_cache.success
   superset_app             | 2021-09-09 10:47:39,461:DEBUG:superset.stats_logger:[stats_logger] (timing) ChartRestApi.data_from_cache.time | 45.62420000002021
   superset_app             | 172.21.0.1 - - [09/Sep/2021 10:47:39] "GET /api/v1/chart/data/qc-3420381c3553925b0c069dc140aaca1a HTTP/1.1" 200 -
   superset_app             | 2021-09-09 10:47:39,467:INFO:werkzeug:172.21.0.1 - - [09/Sep/2021 10:47:39] "GET /api/v1/chart/data/qc-3420381c3553925b0c069dc140aaca1a HTTP/1.1" 200 -
   superset_app             | 2021-09-09 10:47:39,592:DEBUG:superset.sql_parse:Parsing with sqlparse statement: SELECT *
   superset_app             | FROM "Flights"
   superset_app             | WHERE "AIRLINE" = 'UA'
   ```
   
   Just for reference, I used this query for this test.
   ```
   SELECT *
   FROM "Flights"
   WHERE "AIRLINE" = '{{ url_param('test') }}'
   ```
   
   #### How to reproduce the bug
   
   1. Enable GAQ.
   2. Use `url_param` function in jinja template.
   3. Run any dataset with jinja templating.
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: `1.3.1rc1`
   - python version: `3.7.9`
   - node.js version: `14`
   
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kekwan commented on issue #16650: Jinja template is not working when async query is enabled

Posted by GitBox <gi...@apache.org>.
kekwan commented on issue #16650:
URL: https://github.com/apache/superset/issues/16650#issuecomment-1049093154


   @zhaoyongjie I am also encountering this 422 Error. Is your response also `{"message":"Error loading data from cache"}`? It seems to be related to the chart data cache.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on issue #16650: Jinja template is not working when async query is enabled

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on issue #16650:
URL: https://github.com/apache/superset/issues/16650#issuecomment-1049446525


   > @zhaoyongjie I am also encountering this 422 Error. Is your response also `{"message":"Error loading data from cache"}`? It seems to be related to the chart data cache.
   > 
   > ![image](https://user-images.githubusercontent.com/19199254/155385640-b7f5206d-cbe5-4dca-98c8-89fd29c989a7.png)
   
   I am working on this. this is because the cache-key was incorrect calculation when it applied url_param.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kekwan edited a comment on issue #16650: Jinja template is not working when async query is enabled

Posted by GitBox <gi...@apache.org>.
kekwan edited a comment on issue #16650:
URL: https://github.com/apache/superset/issues/16650#issuecomment-1049093154


   @zhaoyongjie I am also encountering this 422 Error. Is your response also `{"message":"Error loading data from cache"}`? It seems to be related to the chart data cache.
   
   ![image](https://user-images.githubusercontent.com/19199254/155385640-b7f5206d-cbe5-4dca-98c8-89fd29c989a7.png)
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kekwan commented on issue #16650: Jinja template is not working when async query is enabled

Posted by GitBox <gi...@apache.org>.
kekwan commented on issue #16650:
URL: https://github.com/apache/superset/issues/16650#issuecomment-1047326442


   +1. Noticing same behaviour.
   
   The second time the chart is reloaded, the url_param gets passed in properly. 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on issue #16650: Jinja template is not working when async query is enabled

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on issue #16650:
URL: https://github.com/apache/superset/issues/16650#issuecomment-1048523307


   Validated on latest master.
   
   ![image](https://user-images.githubusercontent.com/2016594/155279927-a166a2fa-4cf3-40b4-ae2e-4bd8dbe651e9.png)
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie closed issue #16650: Jinja template is not working when async query is enabled

Posted by GitBox <gi...@apache.org>.
zhaoyongjie closed issue #16650:
URL: https://github.com/apache/superset/issues/16650


   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org