def get(self, id: str) -> Iterable[Union[Mapping, int, None]]: args = self.parser.parse_args() direction = args.get('direction') depth = args.get('depth') try: lineage = self.client.get_lineage( id=id, resource_type=ResourceType.Feature, direction=direction, depth=depth) schema = LineageSchema() return schema.dump(lineage), HTTPStatus.OK except NotFoundException: LOGGER.error( f'NotFoundException: feature_uri {id} lineage does not exist') return { 'message': f'feature_uri {id} lineage does not exist' }, HTTPStatus.NOT_FOUND except Exception as e: LOGGER.error( f'Internal server error occurred when getting feature lineage: {e}' ) return { 'message': f'Exception raised when getting lineage: {e}' }, HTTPStatus.INTERNAL_SERVER_ERROR
def get(self, table_uri: str, column_name: str) -> Iterable[Union[Mapping, int, None]]: args = self.parser.parse_args() direction = args.get('direction', 'both') depth = args.get('depth', 0) try: lineage = self.client.get_lineage(id=f"{table_uri}/{column_name}", resource_type=ResourceType.Column, direction=direction, depth=depth) schema = LineageSchema() return schema.dump(lineage), HTTPStatus.OK except Exception as e: return {'message': f'Exception raised when getting lineage: {e}'}, HTTPStatus.NOT_FOUND
def get(self, id: str) -> Iterable[Union[Mapping, int, None]]: args = self.parser.parse_args() direction = args.get('direction') depth = args.get('depth') try: lineage = self.client.get_lineage(id=id, resource_type=ResourceType.Table, direction=direction, depth=depth) schema = LineageSchema() return schema.dump(lineage), HTTPStatus.OK except Exception as e: return { 'message': f'Exception raised when getting lineage: {e}' }, HTTPStatus.NOT_FOUND