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 2018/07/24 21:05:02 UTC
[GitHub] graceguo-supercat closed pull request #5471: [migration] Fix
migration 3dda56f1c
graceguo-supercat closed pull request #5471: [migration] Fix migration 3dda56f1c
URL: https://github.com/apache/incubator-superset/pull/5471
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/migrations/versions/3dda56f1c4c6_migrate_num_period_compare_and_period_.py b/superset/migrations/versions/3dda56f1c4c6_migrate_num_period_compare_and_period_.py
index fef8bb81a1..475252fbf2 100644
--- a/superset/migrations/versions/3dda56f1c4c6_migrate_num_period_compare_and_period_.py
+++ b/superset/migrations/versions/3dda56f1c4c6_migrate_num_period_compare_and_period_.py
@@ -16,7 +16,7 @@
from alembic import op
import isodate
from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy import Column, Integer, Text
+from sqlalchemy import Column, Integer, String, Text
from superset import db
from superset.utils import parse_human_timedelta
@@ -32,6 +32,7 @@ class Slice(Base):
__tablename__ = 'slices'
id = Column(Integer, primary_key=True)
+ datasource_type = Column(String(200))
params = Column(Text)
@@ -50,6 +51,12 @@ class Slice(Base):
'hour': 'PT1H',
'day': 'P1D',
'week': 'P1W',
+ 'week_ending_saturday': 'P1W',
+ 'week_start_sunday': 'P1W',
+ 'week_start_monday': 'P1W',
+ 'week_starting_sunday': 'P1W',
+ 'P1W/1970-01-03T00:00:00Z': 'P1W',
+ '1969-12-28T00:00:00Z/P1W': 'P1W',
'month': 'P1M',
'quarter': 'P0.25Y',
'year': 'P1Y',
@@ -131,10 +138,11 @@ def upgrade():
continue
num_period_compare = int(params.get('num_period_compare'))
- granularity = params.get('granularity') or params.get('time_grain_sqla')
- period_ratio_type = params.get('period_ratio_type', 'growth')
-
+ granularity = (params.get('granularity') if chart.datasource_type == 'druid'
+ else params.get('time_grain_sqla'))
time_compare = compute_time_compare(granularity, num_period_compare)
+
+ period_ratio_type = params.get('period_ratio_type') or 'growth'
comparison_type = comparison_type_map[period_ratio_type.lower()]
params['time_compare'] = [time_compare]
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org