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 2022/08/16 14:07:00 UTC

[GitHub] [superset] dpgaspar commented on a diff in pull request #20903: feat: add header_data into emails

dpgaspar commented on code in PR #20903:
URL: https://github.com/apache/superset/pull/20903#discussion_r946792675


##########
superset/config.py:
##########
@@ -1066,6 +1066,12 @@ def SQL_QUERY_MUTATOR(  # pylint: disable=invalid-name,unused-argument
     return sql
 
 
+def NOTIFICATION_EMAIL_HEADER_MUTATOR(  # pylint: disable=invalid-name,unused-argument
+    msg: Dict[str, Any], **kwargs: Any
+) -> Dict[str, Any]:
+    return msg

Review Comment:
   Not related, but there seems to be a slight discrepancy on callable config keys for example:
   
   For example `DATASET_HEALTH_CHECK` default is `None` and is declared like this:
   ```
   DATASET_HEALTH_CHECK: Optional[Callable[["SqlaTable"], str]] = None
   ```
   Any thoughts @eschutho @AAfghahi 



##########
superset/config.py:
##########
@@ -1066,6 +1066,12 @@ def SQL_QUERY_MUTATOR(  # pylint: disable=invalid-name,unused-argument
     return sql
 
 
+def NOTIFICATION_EMAIL_HEADER_MUTATOR(  # pylint: disable=invalid-name,unused-argument
+    msg: Dict[str, Any], **kwargs: Any

Review Comment:
   Can you add more info to the docs, with an example use case?
   msg is actually a `MIMEMultipart` has the return type also. A bit undecided about `**kwargs` maybe we could make `header_data` a `Dict` named parameter, instead of making it so generic, but still account for `**kwargs` for future changes?



##########
superset/reports/notifications/base.py:
##########
@@ -32,6 +32,7 @@ class NotificationContent:
     description: Optional[str] = ""
     url: Optional[str] = None  # url to chart/dashboard for this screenshot
     embedded_data: Optional[pd.DataFrame] = None
+    header_data: Optional[Dict[Any, Any]] = field(default_factory=lambda: {})

Review Comment:
   nit: does `Optional` make sense here?
   
   also can we flesh out the `Dict[Any, Any]` with a dataclass or `TypedDict`. If not it should be `Dict[str, Any]`



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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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