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/09/05 18:26:05 UTC

[GitHub] [incubator-superset] villebro commented on a change in pull request #8138: [typing] add typing for superset/connectors and superset/common

villebro commented on a change in pull request #8138: [typing] add typing for superset/connectors and superset/common
URL: https://github.com/apache/incubator-superset/pull/8138#discussion_r321411207
 
 

 ##########
 File path: superset/common/query_context.py
 ##########
 @@ -109,36 +114,36 @@ def get_query_result(self, query_object):
             "df": df,
         }
 
-    def df_metrics_to_num(self, df, query_object):
+    def df_metrics_to_num(self, df: pd.DataFrame, query_object: QueryObject) -> None:
         """Converting metrics to numeric when pandas.read_sql cannot"""
         metrics = [metric for metric in query_object.metrics]
         for col, dtype in df.dtypes.items():
             if dtype.type == np.object_ and col in metrics:
                 df[col] = pd.to_numeric(df[col], errors="coerce")
 
-    def get_data(self, df):
+    def get_data(self, df: pd.DataFrame) -> List[Dict]:
         return df.to_dict(orient="records")
 
-    def get_single_payload(self, query_obj: QueryObject):
+    def get_single_payload(self, query_obj: QueryObject) -> Dict:
         """Returns a payload of metadata and data"""
         payload = self.get_df_payload(query_obj)
         df = payload.get("df")
         status = payload.get("status")
         if status != utils.QueryStatus.FAILED:
-            if df is not None and df.empty:
 
 Review comment:
   Whoa this made me dizzy 😄 

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