Unverified Commit 6661903f authored by Robert Yi's avatar Robert Yi Committed by GitHub

Fix broken HiveTableMetadataExtractor. (#201)

* Fix.

* Update corresponding tests.

* Replace schema_name with  and fix presto as well.

* Replace unit test with schema, since we renamed schema_name back to .

* Update setup.py
Co-authored-by: 's avatarTao Feng <tfeng@lyft.com>
parent 6d5ffa49
...@@ -27,7 +27,7 @@ class HiveTableMetadataExtractor(Extractor): ...@@ -27,7 +27,7 @@ class HiveTableMetadataExtractor(Extractor):
# Using UNION to combine above two statements and order by table & partition identifier. # Using UNION to combine above two statements and order by table & partition identifier.
SQL_STATEMENT = """ SQL_STATEMENT = """
SELECT source.* FROM SELECT source.* FROM
(SELECT t.TBL_ID, d.NAME as schema, t.TBL_NAME name, t.TBL_TYPE, tp.PARAM_VALUE as description, (SELECT t.TBL_ID, d.NAME as `schema`, t.TBL_NAME name, t.TBL_TYPE, tp.PARAM_VALUE as description,
p.PKEY_NAME as col_name, p.INTEGER_IDX as col_sort_order, p.PKEY_NAME as col_name, p.INTEGER_IDX as col_sort_order,
p.PKEY_TYPE as col_type, p.PKEY_COMMENT as col_description, 1 as "is_partition_col" p.PKEY_TYPE as col_type, p.PKEY_COMMENT as col_description, 1 as "is_partition_col"
FROM TBLS t FROM TBLS t
...@@ -36,7 +36,7 @@ class HiveTableMetadataExtractor(Extractor): ...@@ -36,7 +36,7 @@ class HiveTableMetadataExtractor(Extractor):
LEFT JOIN TABLE_PARAMS tp ON (t.TBL_ID = tp.TBL_ID AND tp.PARAM_KEY='comment') LEFT JOIN TABLE_PARAMS tp ON (t.TBL_ID = tp.TBL_ID AND tp.PARAM_KEY='comment')
{where_clause_suffix} {where_clause_suffix}
UNION UNION
SELECT t.TBL_ID, d.NAME as schema, t.TBL_NAME name, t.TBL_TYPE, tp.PARAM_VALUE as description, SELECT t.TBL_ID, d.NAME as `schema`, t.TBL_NAME name, t.TBL_TYPE, tp.PARAM_VALUE as description,
c.COLUMN_NAME as col_name, c.INTEGER_IDX as col_sort_order, c.COLUMN_NAME as col_name, c.INTEGER_IDX as col_sort_order,
c.TYPE_NAME as col_type, c.COMMENT as col_description, 0 as "is_partition_col" c.TYPE_NAME as col_type, c.COMMENT as col_description, 0 as "is_partition_col"
FROM TBLS t FROM TBLS t
......
...@@ -22,7 +22,7 @@ class PrestoViewMetadataExtractor(Extractor): ...@@ -22,7 +22,7 @@ class PrestoViewMetadataExtractor(Extractor):
# SQL statement to extract View metadata # SQL statement to extract View metadata
# {where_clause_suffix} could be used to filter schemas # {where_clause_suffix} could be used to filter schemas
SQL_STATEMENT = """ SQL_STATEMENT = """
SELECT t.TBL_ID, d.NAME as schema, t.TBL_NAME name, t.TBL_TYPE, t.VIEW_ORIGINAL_TEXT as view_original_text SELECT t.TBL_ID, d.NAME as `schema`, t.TBL_NAME name, t.TBL_TYPE, t.VIEW_ORIGINAL_TEXT as view_original_text
FROM TBLS t FROM TBLS t
JOIN DBS d ON t.DB_ID = d.DB_ID JOIN DBS d ON t.DB_ID = d.DB_ID
WHERE t.VIEW_EXPANDED_TEXT = '/* Presto View */' WHERE t.VIEW_EXPANDED_TEXT = '/* Presto View */'
......
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
__version__ = '2.0.0' __version__ = '2.0.1'
requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt') requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment