diff --git a/metadata/metadata_service/api/feature.py b/metadata/metadata_service/api/feature.py index 4581a43553..46e842e477 100644 --- a/metadata/metadata_service/api/feature.py +++ b/metadata/metadata_service/api/feature.py @@ -4,7 +4,7 @@ import json import logging from http import HTTPStatus -from typing import Any, Iterable, Mapping, Union +from typing import Any, Iterable, Mapping, Union, no_type_check from amundsen_common.entity.resource_type import ResourceType from amundsen_common.models.feature import FeatureSchema @@ -78,6 +78,7 @@ class FeatureStatsAPI(Resource): def __init__(self) -> None: self.client = get_proxy_client() + @no_type_check @swag_from('swagger_doc/feature/detail_get.yml') def get(self, feature_uri: str) -> Iterable[Union[Mapping, int, None]]: pass @@ -111,6 +112,7 @@ class FeatureSampleAPI(Resource): def __init__(self) -> None: self.client = get_proxy_client() + @no_type_check @swag_from('swagger_doc/feature/detail_get.yml') def get(self, feature_uri: str) -> Iterable[Union[Mapping, int, None]]: pass diff --git a/metadata/metadata_service/proxy/atlas_proxy.py b/metadata/metadata_service/proxy/atlas_proxy.py index 520c01d8b8..9c697d3424 100644 --- a/metadata/metadata_service/proxy/atlas_proxy.py +++ b/metadata/metadata_service/proxy/atlas_proxy.py @@ -8,7 +8,7 @@ from operator import attrgetter from random import randint from typing import (Any, Dict, Generator, List, Optional, Set, Tuple, Type, - Union) + Union, no_type_check) from amundsen_common.entity.resource_type import ResourceType from amundsen_common.models.dashboard import DashboardSummary @@ -394,9 +394,11 @@ def _get_owners(self, data_owners: list, fallback_owner: Optional[str] = None) - def get_user(self, *, id: str) -> Union[UserEntity, None]: pass + @no_type_check def create_update_user(self, *, user: User) -> Tuple[User, bool]: pass + @no_type_check def get_users(self) -> List[UserEntity]: pass @@ -843,6 +845,7 @@ def get_latest_updated_ts(self) -> int: return date or 0 + @no_type_check def get_statistics(self) -> Dict[str, Any]: # Not implemented pass @@ -1675,9 +1678,11 @@ def get_lineage(self, *, id: str, resource_type: ResourceType, direction: str, d return lineage + @no_type_check def get_feature(self, *, feature_uri: str) -> Feature: pass + @no_type_check def get_resource_description(self, *, resource_type: ResourceType, uri: str) -> Description: @@ -1701,6 +1706,7 @@ def delete_resource_owner(self, *, owner: str) -> None: pass + @no_type_check def get_resource_generation_code(self, *, uri: str, resource_type: ResourceType) -> GenerationCode: diff --git a/metadata/metadata_service/proxy/gremlin_proxy.py b/metadata/metadata_service/proxy/gremlin_proxy.py index 81c190e07f..bbd0279b1c 100644 --- a/metadata/metadata_service/proxy/gremlin_proxy.py +++ b/metadata/metadata_service/proxy/gremlin_proxy.py @@ -1019,6 +1019,7 @@ def _get_user(self, *, id: str, executor: ExecuteQuery) -> Union[User, None]: user.manager_fullname = _safe_get(managers[0], 'full_name', default=None) if managers else None return user + @no_type_check def create_update_user(self, *, user: User) -> Tuple[User, bool]: pass @@ -1471,6 +1472,7 @@ def get_latest_updated_ts(self) -> int: key=AMUNDSEN_TIMESTAMP_KEY).values('latest_timestamp').toList() return _safe_get(results, transform=int) + @no_type_check def get_statistics(self) -> Dict[str, Any]: # Not implemented pass @@ -1490,6 +1492,7 @@ def get_tags(self) -> List: counts = self.query_executor()(query=g, get=FromResultSet.getOnly) return [TagDetail(tag_name=name, tag_count=value) for name, value in counts.items()] + @no_type_check def get_badges(self) -> List: pass @@ -1553,6 +1556,7 @@ def get_table_by_user_relation(self, *, user_email: str, relation_type: UserReso # this is weird but the convention return {'table': popular_tables} + @no_type_check @timer_with_counter @overrides def get_dashboard_by_user_relation(self, *, user_email: str, relation_type: UserResourceRel) \ @@ -1560,6 +1564,7 @@ def get_dashboard_by_user_relation(self, *, user_email: str, relation_type: User pass # TODO: impl + @no_type_check @timer_with_counter @overrides def get_frequently_used_tables(self, *, user_email: str) -> Dict[str, Any]: @@ -1816,6 +1821,7 @@ def get_dashboard(self, tables=tables ) + @no_type_check @timer_with_counter @overrides def get_dashboard_description(self, *, @@ -2074,9 +2080,11 @@ def get_lineage(self, *, return Lineage(key=id, upstream_entities=upstream_tables, downstream_entities=downstream_tables, direction=direction, depth=depth) + @no_type_check def get_feature(self, *, feature_uri: str) -> Feature: pass + @no_type_check def get_resource_description(self, *, resource_type: ResourceType, uri: str) -> Description: @@ -2100,6 +2108,7 @@ def delete_resource_owner(self, *, owner: str) -> None: pass + @no_type_check def get_resource_generation_code(self, *, uri: str, resource_type: ResourceType) -> GenerationCode: diff --git a/metadata/metadata_service/proxy/mysql_proxy.py b/metadata/metadata_service/proxy/mysql_proxy.py index 5591e0d74f..fe15623535 100644 --- a/metadata/metadata_service/proxy/mysql_proxy.py +++ b/metadata/metadata_service/proxy/mysql_proxy.py @@ -5,7 +5,7 @@ import time from collections import namedtuple from random import randint -from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union +from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union, no_type_check from amundsen_common.entity.resource_type import ResourceType, to_resource_type from amundsen_common.models.dashboard import DashboardSummary @@ -1605,12 +1605,15 @@ def get_next_edge(node: str) -> Iterator[Edge]: lineage_item_sorted.reverse() return lineage_item_sorted + @no_type_check def get_statistics(self) -> Dict[str, Any]: pass + @no_type_check def get_feature(self, *, feature_uri: str) -> Feature: pass + @no_type_check def get_resource_description(self, *, resource_type: ResourceType, uri: str) -> Description: pass @@ -1623,6 +1626,7 @@ def add_resource_owner(self, *, uri: str, resource_type: ResourceType, owner: st def delete_resource_owner(self, *, uri: str, resource_type: ResourceType, owner: str) -> None: pass + @no_type_check def get_resource_generation_code(self, *, uri: str, resource_type: ResourceType) -> GenerationCode: pass diff --git a/metadata/tests/unit/proxy/fixtures/atlas_test_data.py b/metadata/tests/unit/proxy/fixtures/atlas_test_data.py index 458b952897..8e962c5adb 100644 --- a/metadata/tests/unit/proxy/fixtures/atlas_test_data.py +++ b/metadata/tests/unit/proxy/fixtures/atlas_test_data.py @@ -44,14 +44,14 @@ class Data: {'attributes': { 'stat_name': 'max', 'stat_val': 100.1234, - 'start_epoch': 100, - 'end_epoch': 200, + 'start_epoch': '100', + 'end_epoch': '200', }}, {'attributes': { 'stat_name': 'min', 'stat_val': 0.5678, - 'start_epoch': 100, - 'end_epoch': 200, + 'start_epoch': '100', + 'end_epoch': '200', }}, ] }, @@ -74,14 +74,14 @@ class Data: {'attributes': { 'stat_name': 'max', 'stat_val': '100.1234', - 'start_epoch': 100, - 'end_epoch': 200, + 'start_epoch': '100', + 'end_epoch': '200', }}, {'attributes': { 'stat_name': 'min', 'stat_val': '0.5678', - 'start_epoch': 100, - 'end_epoch': 200, + 'start_epoch': '100', + 'end_epoch': '200', }}, ] @@ -89,8 +89,8 @@ class Data: {'attributes': { 'stat_name': 'minimum', 'stat_val': '0.57', - 'start_epoch': 100, - 'end_epoch': 200, + 'start_epoch': '100', + 'end_epoch': '200', }}, ] diff --git a/metadata/tests/unit/proxy/test_atlas_proxy.py b/metadata/tests/unit/proxy/test_atlas_proxy.py index aca6866641..de4123ebb1 100644 --- a/metadata/tests/unit/proxy/test_atlas_proxy.py +++ b/metadata/tests/unit/proxy/test_atlas_proxy.py @@ -132,8 +132,8 @@ def _get_table(self, custom_stats_format: bool = False) -> None: Stat( stat_type=stats['attributes']['stat_name'], stat_val=stats['attributes']['stat_val'], - start_epoch=int(stats['attributes']['start_epoch']), - end_epoch=int(stats['attributes']['end_epoch']), + start_epoch=stats['attributes']['start_epoch'], + end_epoch=stats['attributes']['end_epoch'], ) )