NathanQuinn commented on issue #4755: Pass granularity from backend to frontend 
as ISO duration
URL: 
https://github.com/apache/incubator-superset/pull/4755#issuecomment-379950829
 
 
   @betodealmeida @mistercrunch 
   
   I exported a postgres backed set of charts and dashboards to another 
postgres instance with this change included. It seems to work when viewing the 
actual chart, but when a time grain is persisted on a chart used in a dashboard 
I'm getting an error as such:
   
   ```
   Traceback (most recent call last):
     File "/home/superset/superset/viz.py", line 362, in get_df_payload
       df = self.get_df(query_obj)
     File "/home/superset/superset/viz.py", line 160, in get_df
       self.results = self.datasource.query(query_obj)
     File "/home/superset/superset/connectors/sqla/models.py", line 705, in 
query
       sql = self.get_query_str(query_obj)
     File "/home/superset/superset/connectors/sqla/models.py", line 419, in 
get_query_str
       qry = self.get_sqla_query(**query_obj)
     File "/home/superset/superset/connectors/sqla/models.py", line 545, in 
get_sqla_query
       timestamp = dttm_col.get_timestamp_expression(time_grain)
     File "/home/superset/superset/connectors/sqla/models.py", line 134, in 
get_timestamp_expression
       expr = grain.function.format(col=expr)
   AttributeError: 'str' object has no attribute 'function'
   ``` 
   
   
   I was able to backfill values stored on slices.params.time_grain_sqla, to 
the ISO durations from 
[here](https://github.com/apache/incubator-superset/blob/426c34ee8643929cdda5a462c6d04289e73cd68b/superset/db_engine_specs.py#L289-L307)
 and this resolved the issue.  Did I miss a migration someplace or should one 
be added for this?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to