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 2020/08/08 00:34:36 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #1216: [Python] create table support

rdblue commented on a change in pull request #1216:
URL: https://github.com/apache/iceberg/pull/1216#discussion_r467337774



##########
File path: python/iceberg/core/base_metastore_tables.py
##########
@@ -16,28 +16,51 @@
 # under the License.
 
 from iceberg.api import Tables
-from iceberg.exceptions import NoSuchTableException
+from iceberg.exceptions import AlreadyExistsException, CommitFailedException, NoSuchTableException
 
 from .base_table import BaseTable
+from .table_metadata import TableMetadata
 
 
 class BaseMetastoreTables(Tables):
+    DOT = '.'
 
     def __init__(self, conf):
         self.conf = conf
 
     def new_table_ops(self, conf, database, table):
         raise RuntimeError("Abstract Implementation")
 
-    def load(self, database, table):
+    def load(self, table_identifier):
+        parts = table_identifier.rsplit(BaseMetastoreTables.DOT, 1)
+        if len(parts) > 1:
+            database = parts[0]
+            table = parts[1]
+        else:
+            database = "default"
+            table = parts[0]
         ops = self.new_table_ops(self.conf, database, table)
         if ops.current() is None:
             raise NoSuchTableException("Table does not exist: {}.{}".format(database, table))
 
         return BaseTable(ops, "{}.{}".format(database, table))
 
-    def create(self, schema, spec, table_identifier=None, database=None, table=None):
-        raise RuntimeError("Not Yet Implemented")
+    def create(self, schema, table_identifier=None, spec=None, properties=None):
+        database, table = table_identifier.rsplit(BaseMetastoreTables.DOT, 1)

Review comment:
       In `load`, the number of items returned is checked. Should that be done here as well?




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



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