浏览代码

HUE-9191 [hive] API to retrieve table Foreign Keys

Romain 5 年之前
父节点
当前提交
cbf25fe35f

+ 1 - 1
apps/beeswax/src/beeswax/server/hive_server2_lib.py

@@ -168,7 +168,7 @@ class HiveServerTable(Table):
         row['col_name'].strip().split(':', 1)[1],  # to: Parent Column Name:default.persons.id
         row['col_name'].strip().split(':', 1)[1],  # to: Parent Column Name:default.persons.id
         row['comment']
         row['comment']
       )
       )
-      for row in self._parse_keys(key_name='# Foreign Key')
+      for row in self._parse_keys(key_name='# Foreign Keys')
     ]
     ]
 
 
   @property
   @property

+ 1 - 1
apps/beeswax/src/beeswax/server/hive_server2_lib_tests.py

@@ -426,7 +426,7 @@ class TestHiveServerTable():
           Mock(
           Mock(
             stringVal=Mock(values=['# col_name', '', 'code', 'description', 'total_emp', 'salary', '', '# Partition Information', '# col_name', 'date', '', '# Detailed Table Information', 'Database:', 'OwnerType:', 'Owner:', 'CreateTime:', 'LastAccessTime:', 'Retention:', 'Location:', 'Table Type:', 'Table Parameters:', '', '', '', '', '', '', '', '', '', '', '# Storage Information', 'SerDe Library:', 'InputFormat:', 'OutputFormat:', 'Compressed:', 'Num Buckets:', 'Bucket Columns:', 'Sort Columns:', 'Storage Desc Params:', '', '', '# Constraints', '',
             stringVal=Mock(values=['# col_name', '', 'code', 'description', 'total_emp', 'salary', '', '# Partition Information', '# col_name', 'date', '', '# Detailed Table Information', 'Database:', 'OwnerType:', 'Owner:', 'CreateTime:', 'LastAccessTime:', 'Retention:', 'Location:', 'Table Type:', 'Table Parameters:', '', '', '', '', '', '', '', '', '', '', '# Storage Information', 'SerDe Library:', 'InputFormat:', 'OutputFormat:', 'Compressed:', 'Num Buckets:', 'Bucket Columns:', 'Sort Columns:', 'Storage Desc Params:', '', '', '# Constraints', '',
                 '# Primary Key', 'Table:', 'Constraint Name:', 'Column Name:', '',
                 '# Primary Key', 'Table:', 'Constraint Name:', 'Column Name:', '',
-                '# Foreign Key', 'Table:', 'Constraint Name:', 'Parent Column Name:default.persons.id', ''
+                '# Foreign Keys', 'Table:', 'Constraint Name:', 'Parent Column Name:default.persons.id', ''
               ],
               ],
               nulls=''
               nulls=''
             )
             )