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/11/28 21:11:52 UTC

[GitHub] mahendra commented on a change in pull request #5294: [SIP-3] Scheduled email reports for Slices / Dashboards

mahendra commented on a change in pull request #5294: [SIP-3] Scheduled email reports for Slices / Dashboards
URL: https://github.com/apache/incubator-superset/pull/5294#discussion_r237262153
 
 

 ##########
 File path: superset/models/schedules.py
 ##########
 @@ -0,0 +1,93 @@
+# pylint: disable=C,R,W
+"""Models for scheduled execution of jobs"""
+
+import enum
+
+from flask_appbuilder import Model
+from sqlalchemy import (
+    Boolean, Column, Enum, ForeignKey, Integer, String, Text,
+)
+from sqlalchemy.ext.declarative import declared_attr
+from sqlalchemy.orm import relationship
+
+from superset import security_manager
+from superset.models.helpers import AuditMixinNullable, ImportMixin
+
+
+metadata = Model.metadata  # pylint: disable=no-member
+
+
+class ScheduleType(enum.Enum):
+    slice = 'slice'
+    dashboard = 'dashboard'
+
+
+class EmailDeliveryType(enum.Enum):
+    attachment = 'Attachment'
+    inline = 'Inline'
+
+
+class SliceEmailReportFormat(enum.Enum):
+    visualization = 'Visualization'
+    data = 'Raw data'
+
+
+class EmailSchedule(object):
+
+    """Schedules for emailing slices / dashboards"""
+
+    __tablename__ = 'email_schedules'
+
+    id = Column(Integer, primary_key=True)
+    active = Column(Boolean, default=True, index=True)
+    crontab = Column(String(50))
+
+    @declared_attr
+    def user_id(self):
+        return Column(Integer, ForeignKey('ab_user.id'))
+
+    @declared_attr
+    def user(self):
+        return relationship(
+            security_manager.user_model,
+            backref=self.__tablename__,
+            foreign_keys=[self.user_id],
+        )
+
+    recipients = Column(Text)
 
 Review comment:
   Agree. We can add this as a future feature. In the admin interface, we can provide a setting - "Schedule emails restricted to registered users"

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