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/08/20 20:05:00 UTC

[GitHub] [incubator-superset] michellethomas commented on a change in pull request #8058: Add docstrings and typing to db_engine_specs and sql_parse

michellethomas commented on a change in pull request #8058: Add docstrings and typing to db_engine_specs and sql_parse
URL: https://github.com/apache/incubator-superset/pull/8058#discussion_r315878475
 
 

 ##########
 File path: superset/sql_parse.py
 ##########
 @@ -105,36 +105,39 @@ def __get_full_name(tlist: TokenList) -> Optional[str]:
         return None
 
     @staticmethod
-    def __is_identifier(token: Token):
+    def __is_identifier(token: Token) -> bool:
         return isinstance(token, (IdentifierList, Identifier))
 
-    def __process_tokenlist(self, tlist: TokenList):
+    def __process_tokenlist(self, token_list: TokenList):
+        """
+        Add table names to table set
+
+        :param token_list: TokenList to be processed
+        """
         # exclude subselects
-        if "(" not in str(tlist):
-            table_name = self.__get_full_name(tlist)
+        if "(" not in str(token_list):
+            table_name = self.__get_full_name(token_list)
             if table_name and not table_name.startswith(CTE_PREFIX):
                 self._table_names.add(table_name)
             return
 
         # store aliases
-        if tlist.has_alias():
-            self._alias_names.add(tlist.get_alias())
+        if token_list.has_alias():
+            self._alias_names.add(token_list.get_alias())
 
         # some aliases are not parsed properly
-        if tlist.tokens[0].ttype == Name:
-            self._alias_names.add(tlist.tokens[0].value)
-        self.__extract_from_token(tlist)
+        if token_list.tokens[0].ttype == Name:
+            self._alias_names.add(token_list.tokens[0].value)
+        self.__extract_from_token(token_list)
 
 Review comment:
   It looks like __extract_from_token expects a param of type `Token` but token_list is a `TokenList` is the difference important to note?

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