You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/06 02:19:37 UTC

[GitHub] [iceberg] kbendick commented on a diff in pull request #4706: Python: Support iceberg base catalog in python library (#3245)

kbendick commented on code in PR #4706:
URL: https://github.com/apache/iceberg/pull/4706#discussion_r866443695


##########
python/src/iceberg/catalog/base.py:
##########
@@ -0,0 +1,198 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+from abc import ABC, abstractmethod
+from typing import Optional
+
+from iceberg.schema import Schema
+from iceberg.table.base import PartitionSpec, Table
+
+
+class Catalog(ABC):
+    """
+    Base Catalog for table operations like - create, drop, load, list and others.
+
+    Attributes:
+        name(str): Name of the catalog
+        properties(dict): Catalog properties
+    """
+
+    def __init__(self, name: str, properties: dict):
+        self._name = name
+        self._properties = properties
+
+    @property
+    def name(self) -> str:
+        return self._name
+
+    @property
+    def properties(self) -> dict:
+        return self._properties
+
+    @abstractmethod
+    def list_tables(self) -> list:
+        """
+        List tables in the catalog.
+
+        :return: list of table names in the catalog.
+        """
+
+    @abstractmethod
+    def create_table(
+        self,
+        name: str,
+        schema: Schema,
+        partition_spec: PartitionSpec,

Review Comment:
   In Java, we use a dedicated Unpartitioned spec.
   
   But I agree that this should be optional and then the builder (or this function… either way) should default to Unpartitioned if this is None (implicitly using the Unpartitioned spec).



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org