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

 ##########
 File path: superset/common/query_context.py
 ##########
 @@ -109,17 +114,17 @@ 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]:
 
 Review comment:
   `df.to_dict` returns a list of dictionaries? Not doubting you, but want to 
make sure this is actually correct, because it doesn't seem obvious to me at all

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to