WeiZhong94 commented on a change in pull request #8623: [FLINK-12719][python] 
Add the Python catalog API
URL: https://github.com/apache/flink/pull/8623#discussion_r292433495
 
 

 ##########
 File path: flink-python/pyflink/table/table_environment.py
 ##########
 @@ -58,6 +59,29 @@ def from_table_source(self, table_source):
         """
         return 
Table(self._j_tenv.fromTableSource(table_source._j_table_source))
 
+    def register_catalog(self, catalog_name, catalog):
+        """
+        Registers a :class:`Catalog` under a unique name.
+        All tables registered in the :class:`Catalog` can be accessed.
+
+        :param catalog_name: The name under which the catalog will be 
registered.
+        :param catalog: The catalog to register.
+        """
+        self._j_tenv.registerCatalog(catalog_name, catalog._j_catalog)
+
+    def get_catalog(self, catalog_name):
+        """
+        Gets a registered :class:`Catalog` by name.
+
+        :param catalog_name: The name to look up the :class:`Catalog`.
+        :return:The requested catalog, None if there is no registered catalog 
with given name.
+        """
+        catalog = self._j_tenv.getCatalog(catalog_name)
+        if catalog.isPresent():
+            return Catalog(catalog.get())
 
 Review comment:
   How about return the actual type of the catalog? I mean if the java catalog 
object is a HiveCatalog object, we should wrap it with a python HiveCatalog 
class.

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


With regards,
Apache Git Services

Reply via email to