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/11/30 16:20:50 UTC
[GitHub] [superset] dneelapareddy opened a new issue #17598: Unable to access time_grain in custom SQL
dneelapareddy opened a new issue #17598:
URL: https://github.com/apache/superset/issues/17598
A clear and concise description of what the bug is.
#### How to reproduce the bug
1. Go to 'Create Chart'
2. Click on 'METRICS' and select 'Custom SQL' tab
### Expected results
Should be able to access time_grain value
#### Screenshots

--
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] dneelapareddy commented on issue #17598: Unable to access time_grain in custom SQL
Posted by GitBox <gi...@apache.org>.
dneelapareddy commented on issue #17598:
URL: https://github.com/apache/superset/issues/17598#issuecomment-986703953
@villebro I have enabled `ENABLE_TEMPLATE_PROCESSING` to `True`,
I am able to get the `'{{ current_username() }}'` from custom sql,

But Jinja template is unable to evaluate `'{{ to_dttm }}' - '{{ from_dttm }}' AS Duration`

I have even tried it in the SQL lab, but not working there too:

Is there anything else i need to enable to get this working?
--
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] dneelapareddy commented on issue #17598: Unable to access time_grain in custom SQL
Posted by GitBox <gi...@apache.org>.
dneelapareddy commented on issue #17598:
URL: https://github.com/apache/superset/issues/17598#issuecomment-982799047
Also trying to use jinja template:

But, the jinja expression is not getting evaluated
--
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] villebro commented on issue #17598: Unable to access time_grain in custom SQL
Posted by GitBox <gi...@apache.org>.
villebro commented on issue #17598:
URL: https://github.com/apache/superset/issues/17598#issuecomment-992469062
Which version are you on? I believe the template processor was until fairly recently only implemented in certain query controls, but should now be universally supported on the current master branch. See also this PR that added more temporal variables to the template processor context: #16680
--
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] villebro commented on issue #17598: Unable to access time_grain in custom SQL
Posted by GitBox <gi...@apache.org>.
villebro commented on issue #17598:
URL: https://github.com/apache/superset/issues/17598#issuecomment-983467302
@dneelapareddy have you set the `ENABLE_TEMPLATE_PROCESSING` config flag to `True`? See the docs for more info: https://superset.apache.org/docs/installation/sql-templating
--
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] dneelapareddy edited a comment on issue #17598: Unable to access time_grain in custom SQL
Posted by GitBox <gi...@apache.org>.
dneelapareddy edited a comment on issue #17598:
URL: https://github.com/apache/superset/issues/17598#issuecomment-982799047
Also trying to use jinja template in custom sql:
`SELECT TIME_FLOOR("__time", 'PT15M') AS "__timestamp",
'{{ from_dttm }}' - '{{ to_dttm }}' AS "DURATION"
FROM "druid"."tableAbc"
WHERE "__time" >= '2021-11-29 00:00:00.000000'
AND "__time" < '2021-11-30 00:00:00.000000'
GROUP BY TIME_FLOOR("__time", 'PT15M')
ORDER BY "DURATION" DESC
LIMIT 50000;`

But, the jinja expression is not getting evaluated
--
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