pan3793 commented on code in PR #7190:
URL: https://github.com/apache/kyuubi/pull/7190#discussion_r2366990261


##########
python/pyhive/sqlalchemy_presto.py:
##########
@@ -204,12 +204,44 @@ def get_indexes(self, connection, table_name, 
schema=None, **kw):
         else:
             return []
 
+    def _get_default_schema_name(self, connection):
+        #'SELECT CURRENT_SCHEMA()'
+        return super()._get_default_schema_name(connection)
+
     def get_table_names(self, connection, schema=None, **kw):
         query = 'SHOW TABLES'
+        # N.B. This is incorrect, if no schema is provided, the 
current/default schema should be used
+        #  with a call to an overridden 
self._get_default_schema_name(connection), but I could not
+        #  see how to implement that as there is no CURRENT_SCHEMA function
+        #  default_schema = self._get_default_schema_name(connection)
+
         if schema:
             query += ' FROM ' + 
self.identifier_preparer.quote_identifier(schema)
         return [row.Table for row in connection.execute(text(query))]
 
+    def get_view_names(self, connection, schema=None, **kw):
+        if schema:
+            view_name_query = """
+                SELECT table_name
+                FROM information_schema.views
+                WHERE table_schema = :schema
+            """
+            query = text(view_name_query).bindparams(
+                bindparam("schema", type_=types.Unicode)
+            )
+        else:
+            # N.B. This is incorrect, if no schema is provided, the 
current/default schema should be used
+            #  with a call to self._get_default_schema_name(connection), but I 
could not see how to implement that
+            #  default_schema = self._get_default_schema_name(connection)

Review Comment:
   ```suggestion
               # N.B. This is incorrect, if no schema is provided, the 
current/default schema should
               #   be used with a call to 
self._get_default_schema_name(connection), but I could not
               #   see how to implement that
               #   default_schema = self._get_default_schema_name(connection)
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to