Commits

Peter Rudenko committed fc44a60

Hcatalog show tables aded

Comments (0)

Files changed (1)

templeton/src/templeton/api.py

         Make GET query to templeton url.
         """
         data = urllib.urlencode(data)
+        print TEMPLETON_URL + url + "?" + data
         response = urllib2.urlopen(TEMPLETON_URL + url + "?" + data)
         return json.loads(response.read())
 
         data = {'user.name': user}
         return self.get("queue/%s" % job_id, data)
 
+    def show_hcat_tables(self, user="hdfs", db="default"):
+        """
+        List the tables in an HCatalog database.
+        """
+        data = {'user.name': user}
+        return self.get("ddl/database/%s/table" % db, data)['tables']
+        
+            
+
 
 if __name__ == "__main__":
     t = Templeton()
-    pig_query = t.pig_query(user="hdfs", execute="pwd")
-    job = t.check_job(pig_query['id'])
-    print job
+    #pig_query = t.pig_query(user="hdfs", execute="pwd")
+    #job = t.check_job(pig_query['id'])
+    #print job
+    print t.show_hcat_tables()