You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "lelelethu (via GitHub)" <gi...@apache.org> on 2023/12/21 03:25:59 UTC
Re: [I] I want to specify custom time grain [superset]
lelelethu commented on issue #15037:
URL: https://github.com/apache/superset/issues/15037#issuecomment-1865423323
> Actually, this is already possible via the `TIME_GRAIN_ADDONS` and `TIME_GRAIN_ADDON_EXPRESSIONS` variables [in `config.py`](https://github.com/apache/superset/blob/master/superset/config.py#L542-L565), thanks to @villebro!
When i using that but not working.
This my code in config.py:
TIME_GRAIN_ADDONS = {
'PT2S': '2 second',
"PT6H": "6 hours",
"PT15M": "15 minutes",
}
TIME_GRAIN_ADDON_EXPRESSIONS = {
'postgresql': {
'PT2S': 'toDateTime(intDiv(toUInt32(toDateTime({col})), 2)*2)',
'PT6H': "date_trunc('day', {col}) + date_trunc('hour', {col})::int / 6 * interval '6 h'",
'PT15M': "date_trunc('hour', {col}) + date_part('minute', {col})::int / 15 * interval '15 min'",
}
}
What am I wrong?
--
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