Skip to content

Commit

Permalink
migrate table, user to common models
Browse files Browse the repository at this point in the history
  • Loading branch information
friendtocephalopods committed Jan 18, 2020
1 parent 9c21831 commit 6e64970
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 194 deletions.
141 changes: 0 additions & 141 deletions metadata_service/entity/table_detail.py

This file was deleted.

24 changes: 0 additions & 24 deletions metadata_service/entity/user_detail.py

This file was deleted.

13 changes: 7 additions & 6 deletions metadata_service/proxy/atlas_proxy.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import logging
import re
from typing import Union, List, Dict, Any, Tuple
from random import randint
from typing import Any, Dict, List, Tuple, Union

from atlasclient.client import Atlas
from atlasclient.exceptions import BadRequest
from atlasclient.models import EntityUniqueAttribute
from atlasclient.utils import parse_table_qualified_name, make_table_qualified_name
from flask import current_app as app
from atlasclient.utils import (make_table_qualified_name,
parse_table_qualified_name)
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from random import randint
from flask import current_app as app

from amundsen_common.models.table import Column, Statistics, Table, Tag, User
from amundsen_common.models.user import User as UserEntity
from metadata_service.entity.popular_table import PopularTable
from metadata_service.entity.table_detail import Table, User, Tag, Column, Statistics
from metadata_service.entity.tag_detail import TagDetail
from metadata_service.entity.user_detail import User as UserEntity
from metadata_service.exception import NotFoundException
from metadata_service.proxy import BaseProxy
from metadata_service.util import UserResourceRel
Expand Down
7 changes: 3 additions & 4 deletions metadata_service/proxy/base_proxy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from abc import ABCMeta, abstractmethod
from typing import Any, Dict, List, Union

from typing import Union, List, Dict, Any

from amundsen_common.models.table import Table
from amundsen_common.models.user import User as UserEntity
from metadata_service.entity.popular_table import PopularTable
from metadata_service.entity.user_detail import User as UserEntity
from metadata_service.entity.table_detail import Table
from metadata_service.util import UserResourceRel


Expand Down
10 changes: 5 additions & 5 deletions metadata_service/proxy/gremlin_proxy.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import json
import logging
from typing import (Any, Dict, List, Mapping, Optional, Union)
from typing import Any, Dict, List, Mapping, Optional, Union

import gremlin_python
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.driver.driver_remote_connection import \
DriverRemoteConnection
from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.process.graph_traversal import GraphTraversalSource

from amundsen_common.models.table import Table
from amundsen_common.models.user import User as UserEntity
from metadata_service.entity.popular_table import PopularTable
from metadata_service.entity.table_detail import Table
from metadata_service.entity.user_detail import User as UserEntity
from metadata_service.proxy import BaseProxy
from metadata_service.util import UserResourceRel


__all__ = ['AbstractGremlinProxy', 'GenericGremlinProxy']

LOGGER = logging.getLogger(__name__)
Expand Down
15 changes: 8 additions & 7 deletions metadata_service/proxy/neo4j_proxy.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import logging
import textwrap
import time
from random import randint
from typing import Dict, Any, no_type_check, List, Tuple, Union, Optional # noqa: F401
from typing import (Any, Dict, List, Optional, Tuple, Union, # noqa: F401
no_type_check)

import time
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from neo4j.v1 import BoltStatementResult
from neo4j.v1 import GraphDatabase, Driver # noqa: F401
from neo4j.v1 import BoltStatementResult, Driver, GraphDatabase # noqa: F401

from amundsen_common.models.table import (Application, Column, Reader, Source,
Statistics, Table, Tag, User,
Watermark)
from amundsen_common.models.user import User as UserEntity
from metadata_service.entity.popular_table import PopularTable
from metadata_service.entity.table_detail import Application, Column, Reader, Source, \
Statistics, Table, Tag, User, Watermark
from metadata_service.entity.tag_detail import TagDetail
from metadata_service.entity.user_detail import User as UserEntity
from metadata_service.exception import NotFoundException
from metadata_service.proxy.base_proxy import BaseProxy
from metadata_service.proxy.statsd_utilities import timer_with_counter
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pytest-mock==1.1
typing==3.6.4


amundsen-common==0.1.3
flasgger==0.9.3
Flask-RESTful==0.3.6
Flask==1.0.2
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/proxy/test_atlas_proxy.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import copy
import unittest
from typing import Any, Dict, Optional, cast

from atlasclient.exceptions import BadRequest
from mock import patch, MagicMock
from typing import Any, cast, Dict, Optional
from mock import MagicMock, patch
from tests.unit.proxy.fixtures.atlas_test_data import Data

from amundsen_common.models.table import Column, Statistics, Table, Tag, User
from metadata_service import create_app
from metadata_service.entity.popular_table import PopularTable
from metadata_service.entity.table_detail import (Table, User, Tag, Column, Statistics)
from metadata_service.entity.tag_detail import TagDetail
from metadata_service.exception import NotFoundException
from metadata_service.util import UserResourceRel
from tests.unit.proxy.fixtures.atlas_test_data import Data


class TestAtlasProxy(unittest.TestCase, Data):
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/proxy/test_neo4j_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import unittest
from typing import Any, Dict # noqa: F401

from mock import patch, MagicMock
from mock import MagicMock, patch
from neo4j.v1 import GraphDatabase

from amundsen_common.models.table import (Application, Column, Source,
Statistics, Table, Tag, User,
Watermark)
from metadata_service import create_app
from metadata_service.entity.popular_table import PopularTable
from metadata_service.entity.table_detail import (Application, Column, Table, Tag,
Watermark, Source, Statistics, User)
from metadata_service.entity.tag_detail import TagDetail
from metadata_service.exception import NotFoundException
from metadata_service.proxy.neo4j_proxy import Neo4jProxy
Expand Down

0 comments on commit 6e64970

Please sign in to comment.