Unverified Commit 160406b0 authored by Jin Hyuk Chang's avatar Jin Hyuk Chang Committed by GitHub

Adding display_name field on Elasticsearch mapping for exa… (#186)

* [AMD-1157] Adding schema_table field on Elasticsearch mapping for exact match

* Use display_name

* Update
parent 84eeb29b
......@@ -20,12 +20,14 @@ class TableESDocument(ElasticsearchDocument):
total_usage, # type: int
unique_usage, # type: int
tags, # type: List[str]
display_name=None, # type: Optional[str]
):
# type: (...) -> None
self.database = database
self.cluster = cluster
self.schema_name = schema_name
self.name = name
self.display_name = display_name if display_name else '{schema}.{table}'.format(schema=schema_name, table=name)
self.key = key
self.description = description
# todo: use last_updated_timestamp to match the record in metadata
......
......@@ -60,6 +60,9 @@ class ElasticsearchPublisher(Publisher):
}
}
},
"display_name": {
"type": "keyword"
},
"last_updated_epoch": {
"type": "date",
"format": "epoch_second"
......
......@@ -2,7 +2,7 @@ import os
from setuptools import setup, find_packages
__version__ = '1.5.0'
__version__ = '1.5.1'
requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt')
......
......@@ -104,6 +104,7 @@ class TestNeo4jExtractor(unittest.TestCase):
cluster='test_cluster',
schema_name='test_schema',
name='test_table_name',
display_name='test_schema.test_table_name',
key='test_table_key',
description='test_table_description',
last_updated_epoch=123456789,
......
......@@ -108,7 +108,7 @@ class TestFSElasticsearchJSONLoader(unittest.TestCase):
('{"key": "test_table_key", "column_descriptions": ["test_comment1", "test_comment2"], '
'"schema_name": "test_schema", "database": "test_database", "cluster": "test_cluster", '
'"column_names": ["test_col1", "test_col2"], "name": "test_table", '
'"last_updated_epoch": 123456789,'
'"last_updated_epoch": 123456789, "display_name": "test_schema.test_table", '
'"description": "test_description", "unique_usage": 5, "total_usage": 10, '
'"tags": ["test_tag1", "test_tag2"]}')
]
......@@ -146,7 +146,7 @@ class TestFSElasticsearchJSONLoader(unittest.TestCase):
('{"key": "test_table_key", "column_descriptions": ["test_comment1", "test_comment2"], '
'"schema_name": "test_schema", "database": "test_database", "cluster": "test_cluster", '
'"column_names": ["test_col1", "test_col2"], "name": "test_table", '
'"last_updated_epoch": 123456789,'
'"last_updated_epoch": 123456789, "display_name": "test_schema.test_table", '
'"description": "test_description", "unique_usage": 5, "total_usage": 10, '
'"tags": ["test_tag1", "test_tag2"]}')
] * 5
......
......@@ -28,6 +28,7 @@ class TestTableElasticsearchDocument(unittest.TestCase):
"cluster": "test_cluster",
"schema_name": "test_schema",
"name": "test_table",
"display_name": "test_schema.test_table",
"key": "test_table_key",
"last_updated_epoch": 123456789,
"description": "test_table_description",
......
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