Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Populate is_view property in AtlasProxy #155

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions metadata_service/proxy/atlas_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ def get_table(self, *, table_uri: str) -> Table:

reports_guids = [report.get("guid") for report in attrs.get("reports") or list()]

is_view = True if attrs.get('tableType', '').lower().find('view') != -1 else False

table = Table(
database=table_details.get('typeName'),
cluster=table_qn.get('cluster_name', ''),
Expand All @@ -421,6 +423,7 @@ def get_table(self, *, table_uri: str) -> Table:
owners=[User(email=attrs.get('owner'))],
resource_reports=self._get_reports(guids=reports_guids),
columns=columns,
is_view=is_view,
table_readers=self._get_readers(attrs.get(self.QN_KEY)),
last_updated_timestamp=self._parse_date(table_details.get('updateTime')),
programmatic_descriptions=programmatic_descriptions)
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/proxy/fixtures/atlas_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class Data:
'testParameterKeyA': 'testParameterValueA',
'spark.sql.param': 1
},
'reports': [{'guid': '23'}, {'guid': '121212'}, {'guid': '2344'}]
'reports': [{'guid': '23'}, {'guid': '121212'}, {'guid': '2344'}],
'tableType': 'MANAGED_TABLE'
},
'relationshipAttributes': {
'db': db_entity,
Expand All @@ -131,7 +132,8 @@ class Data:
'owner': '[email protected]',
'db': db_entity,
'popularityScore': 100,
'partitions': list()
'partitions': list(),
'tableType': 'VIRTUAL_VIEW'
},
'relationshipAttributes': {
'db': db_entity
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/proxy/test_atlas_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def _get_table(self, custom_stats_format: bool = False) -> None:
text='testParameterValueA'),
ProgrammaticDescription(source='test parameter key b',
text='testParameterValueB')
])
],
is_view=False)

self.assertEqual(str(expected), str(response))

Expand Down