villebro commented on issue #9125: Time Grain for BigQuery type: DATE & 
DATETIME is not available
URL: 
https://github.com/apache/incubator-superset/issues/9125#issuecomment-585409090
 
 
   @ranugoldan as a quick fix/check, would you mind adding the following to 
your `superset_config.py` file and see if it solves your problem:
   ```python
   TIME_GRAIN_ADDON_FUNCTIONS = {
       'bigquery': {
           "PT1S": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), SECOND)",
           "PT1M": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), MINUTE)",
           "PT1H": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), HOUR)",
           "P1D": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), DAY)",
           "P1W": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), WEEK)",
           "P1M": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), MONTH)",
           "P0.25Y": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), QUARTER)",
           "P1Y": "TIMESTAMP_TRUNC(CAST({col} AS TIMESTAMP), YEAR)",
       }
   }
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to