kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject kudu git commit: [python] - Add Table id method
Date Tue, 01 Nov 2016 19:35:54 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 4ed84b956 -> fa1a48feb


[python] - Add Table id method

This patch adds the id method to the Table class so that the
id of a table can be retrieved. This patch includes an updated
test.

Change-Id: I8a33ad50ed7d5a2738bab1726b07b075ac60f0c7
Reviewed-on: http://gerrit.cloudera.org:8080/4889
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <todd@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/fa1a48fe
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/fa1a48fe
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/fa1a48fe

Branch: refs/heads/master
Commit: fa1a48febbdfd619a5d74008fe387764384a0dac
Parents: 4ed84b9
Author: Jordan Birdsell <jordantbirdsell@gmail.com>
Authored: Mon Oct 31 06:56:24 2016 -0400
Committer: Todd Lipcon <todd@apache.org>
Committed: Tue Nov 1 19:32:52 2016 +0000

----------------------------------------------------------------------
 python/kudu/client.pyx           | 9 +++++++--
 python/kudu/libkudu_client.pxd   | 1 +
 python/kudu/tests/test_client.py | 1 +
 3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/fa1a48fe/python/kudu/client.pyx
----------------------------------------------------------------------
diff --git a/python/kudu/client.pyx b/python/kudu/client.pyx
index a555ed6..3cfd92a 100644
--- a/python/kudu/client.pyx
+++ b/python/kudu/client.pyx
@@ -650,13 +650,18 @@ cdef class Table:
         return Column(self, spec)
 
     property name:
-
+        """Name of the table."""
         def __get__(self):
             return frombytes(self.ptr().name())
 
+    property id:
+        """Identifier string for the table."""
+        def __get__(self):
+            return frombytes(self.ptr().id())
+
     # XXX: don't love this name
     property num_columns:
-
+        """Number of columns in the table's schema."""
         def __get__(self):
             return len(self.schema)
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/fa1a48fe/python/kudu/libkudu_client.pxd
----------------------------------------------------------------------
diff --git a/python/kudu/libkudu_client.pxd b/python/kudu/libkudu_client.pxd
index 4d58a20..b56cc11 100644
--- a/python/kudu/libkudu_client.pxd
+++ b/python/kudu/libkudu_client.pxd
@@ -551,6 +551,7 @@ cdef extern from "kudu/client/client.h" namespace "kudu::client" nogil:
     cdef cppclass KuduTable:
 
         string& name()
+        string& id()
         KuduSchema& schema()
         int num_replicas()
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/fa1a48fe/python/kudu/tests/test_client.py
----------------------------------------------------------------------
diff --git a/python/kudu/tests/test_client.py b/python/kudu/tests/test_client.py
index b5159ee..0c97ee9 100644
--- a/python/kudu/tests/test_client.py
+++ b/python/kudu/tests/test_client.py
@@ -34,6 +34,7 @@ class TestClient(KuduTestBase, unittest.TestCase):
 
         self.assertEqual(table.name, self.ex_table)
         self.assertEqual(table.num_columns, len(self.schema))
+        self.assertIsNotNone(table.id)
 
     def test_table_column(self):
         table = self.client.table(self.ex_table)


Mime
View raw message