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 2019/03/19 22:01:29 UTC

[GitHub] [incubator-superset] michellethomas commented on a change in pull request #6523: Improving Filter Box

michellethomas commented on a change in pull request #6523: Improving Filter Box
URL: https://github.com/apache/incubator-superset/pull/6523#discussion_r267115801
 
 

 ##########
 File path: superset/migrations/versions/fb13d49b72f9_better_filters.py
 ##########
 @@ -0,0 +1,84 @@
+"""better_filters
+
+Revision ID: fb13d49b72f9
+Revises: 6c7537a6004a
+Create Date: 2018-12-11 22:03:21.612516
+
+"""
+import json
+import logging
+
+from alembic import op
+from sqlalchemy import Column, Integer, String, Text
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+# revision identifiers, used by Alembic.
+revision = 'fb13d49b72f9'
+down_revision = 'de021a1ca60d'
+
+Base = declarative_base()
+
+
+class Slice(Base):
+    __tablename__ = 'slices'
+
+    id = Column(Integer, primary_key=True)
+    params = Column(Text)
+    viz_type = Column(String(250))
+    slice_name = Column(String(250))
+
+
+def upgrade():
+    bind = op.get_bind()
+    session = db.Session(bind=bind)
+
+    filter_box_slices = session.query(Slice).filter_by(viz_type='filter_box')
+    for slc in filter_box_slices.all():
+        try:
+            params = json.loads(slc.params)
+            logging.info(f'Upgrading {slc.slice_name}')
+            cols = params.get('groupby')
+            metrics = params.get('metrics')
 
 Review comment:
   @mistercrunch it looks like the param for filter_box was `metric` so this isn't migrating any of the filter box metrics correctly, they are getting set to `null` cc: @graceguo-supercat 

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org