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/04/01 06:19:14 UTC

[GitHub] [superset] riceliu opened a new issue #13908: How to config PT2S time grain for mysql database engine

riceliu opened a new issue #13908:
URL: https://github.com/apache/superset/issues/13908


   Time unit of my dataset in mysql is to second, so that I need to configure time grain like every 2 second , 3 second , 5 second , 10 second and so on.
   
   I found that it is configurable to do that at config.py, but I don't know how to config PT2S for mysql engine
   
   Flowing PT1S config was copyed form default config,  is there someone know how to change to PT2S, PT3S, PT5S ... ?
   
   TIME_GRAIN_ADDON_FUNCTIONS = {
        'mysql': {
            "PT1S": "DATE_ADD(DATE({col}), "
           "INTERVAL (HOUR({col})*60*60 + MINUTE({col})*60"
           " +  SECOND({col})) SECOND)",
        }
    }


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

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] junlincc commented on issue #13908: How to config PT2S time grain for mysql database engine

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


   thanks @iercan 🙏 i converted #13619 to discussion 


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

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] junlincc closed issue #13908: How to config PT2S time grain for mysql database engine

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


   


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

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] iercan commented on issue #13908: How to config PT2S time grain for mysql database engine

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


   answered your question here #13619 
   
   > @riceliu try this
   > 
   > ```
   > TIME_GRAIN_ADDONS: Dict[str, str] = {
   >         'PT2S': '2 second',
   >         'PT5S': '5 second',
   >         'PT10S': '10 second',
   >         'PT30S': '30 second'
   >         }
   > 
   > TIME_GRAIN_ADDON_EXPRESSIONS: Dict[str, Dict[str, str]] = {
   >         'mysql': {
   >             'PT2S': '''FROM_UNIXTIME(UNIX_TIMESTAMP({col})-MOD(UNIX_TIMESTAMP({col}), 2))''',
   >             'PT5S': '''FROM_UNIXTIME(UNIX_TIMESTAMP({col})-MOD(UNIX_TIMESTAMP({col}), 5))''',
   >             'PT10S': '''FROM_UNIXTIME(UNIX_TIMESTAMP({col})-MOD(UNIX_TIMESTAMP({col}), 10))''',
   >             'PT30S': '''FROM_UNIXTIME(UNIX_TIMESTAMP({col})-MOD(UNIX_TIMESTAMP({col}), 30))'''
   >             }
   >         }
   > ```


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

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