Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AmendsenProject
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shaik Janipasha
AmendsenProject
Commits
524bc07b
Unverified
Commit
524bc07b
authored
Dec 10, 2020
by
Josh Howard
Committed by
GitHub
Dec 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added frontend configuration options for personalized popular tables. (#789)
Signed-off-by:
Josh Howard
<
joshthoward@gmail.com
>
parent
556b7ecd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
v0.py
amundsen_application/api/metadata/v0.py
+7
-2
config.py
amundsen_application/config.py
+3
-0
test_v0.py
tests/unit/api/metadata/test_v0.py
+12
-3
No files found.
amundsen_application/api/metadata/v0.py
View file @
524bc07b
...
...
@@ -26,7 +26,7 @@ metadata_blueprint = Blueprint('metadata', __name__, url_prefix='/api/metadata/v
TABLE_ENDPOINT
=
'/table'
LAST_INDEXED_ENDPOINT
=
'/latest_updated_ts'
POPULAR_TABLES_ENDPOINT
=
'/popular_tables
/
'
POPULAR_TABLES_ENDPOINT
=
'/popular_tables'
TAGS_ENDPOINT
=
'/tags/'
USER_ENDPOINT
=
'/user'
DASHBOARD_ENDPOINT
=
'/dashboard'
...
...
@@ -56,9 +56,14 @@ def popular_tables() -> Response:
https://github.com/lyft/amundsenmetadatalibrary/blob/master/metadata_service/api/popular_tables.py
"""
try
:
if
app
.
config
[
'AUTH_USER_METHOD'
]
and
app
.
config
[
'POPULAR_TABLE_PERSONALIZATION'
]:
user_id
=
app
.
config
[
'AUTH_USER_METHOD'
](
app
)
.
user_id
else
:
user_id
=
''
service_base
=
app
.
config
[
'METADATASERVICE_BASE'
]
count
=
app
.
config
[
'POPULAR_TABLE_COUNT'
]
url
=
f
'{service_base}{POPULAR_TABLES_ENDPOINT}?limit={count}'
url
=
f
'{service_base}{POPULAR_TABLES_ENDPOINT}
/{user_id}
?limit={count}'
response
=
request_metadata
(
url
=
url
)
status_code
=
response
.
status_code
...
...
amundsen_application/config.py
View file @
524bc07b
...
...
@@ -38,6 +38,8 @@ class Config:
# Number of popular tables to be displayed on the index/search page
POPULAR_TABLE_COUNT
=
4
# type: int
# Personalize the popular tables response for the current authenticated user
POPULAR_TABLE_PERSONALIZATION
=
False
# type: bool
# Request Timeout Configurations in Seconds
REQUEST_SESSION_TIMEOUT_SEC
=
3
...
...
@@ -155,6 +157,7 @@ class LocalConfig(Config):
class
TestConfig
(
LocalConfig
):
POPULAR_TABLE_PERSONALIZATION
=
True
AUTH_USER_METHOD
=
get_test_user
NOTIFICATIONS_ENABLED
=
True
ISSUE_TRACKER_URL
=
'test_url'
...
...
tests/unit/api/metadata/test_v0.py
View file @
524bc07b
...
...
@@ -476,7 +476,10 @@ class MetadataTest(unittest.TestCase):
Test successful popular_tables request
:return:
"""
responses
.
add
(
responses
.
GET
,
local_app
.
config
[
'METADATASERVICE_BASE'
]
+
POPULAR_TABLES_ENDPOINT
,
mock_url
=
local_app
.
config
[
'METADATASERVICE_BASE'
]
\
+
POPULAR_TABLES_ENDPOINT
\
+
f
'/{TEST_USER_ID}'
responses
.
add
(
responses
.
GET
,
mock_url
,
json
=
self
.
mock_popular_tables
,
status
=
HTTPStatus
.
OK
)
with
local_app
.
test_client
()
as
test
:
...
...
@@ -492,7 +495,10 @@ class MetadataTest(unittest.TestCase):
returned to the React application
:return:
"""
responses
.
add
(
responses
.
GET
,
local_app
.
config
[
'METADATASERVICE_BASE'
]
+
POPULAR_TABLES_ENDPOINT
,
mock_url
=
local_app
.
config
[
'METADATASERVICE_BASE'
]
\
+
POPULAR_TABLES_ENDPOINT
\
+
f
'/{TEST_USER_ID}'
responses
.
add
(
responses
.
GET
,
mock_url
,
json
=
self
.
mock_popular_tables
,
status
=
HTTPStatus
.
BAD_REQUEST
)
with
local_app
.
test_client
()
as
test
:
...
...
@@ -506,7 +512,10 @@ class MetadataTest(unittest.TestCase):
results from the metadata service
:return:
"""
responses
.
add
(
responses
.
GET
,
local_app
.
config
[
'METADATASERVICE_BASE'
]
+
POPULAR_TABLES_ENDPOINT
,
mock_url
=
local_app
.
config
[
'METADATASERVICE_BASE'
]
\
+
POPULAR_TABLES_ENDPOINT
\
+
f
'/{TEST_USER_ID}'
responses
.
add
(
responses
.
GET
,
mock_url
,
json
=
{
'popular_tables'
:
None
},
status
=
HTTPStatus
.
OK
)
with
local_app
.
test_client
()
as
test
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment