Skip to content

Commit

Permalink
fix: Properly request number of entries for popular tables (amundsen-…
Browse files Browse the repository at this point in the history
…io#502)

* Allow minimum reader count to be configurable

* Update popular tables

* Revert adding POPULAR_TABLE_MINIMUM_READER_COUNT config

* dump dict to str

* Add unit test for popular tables

* GET request sends query strings not data

* Update tests

* Use url instead of request param for GET
  • Loading branch information
Jacob Kim authored and Hans Adriaans committed Jun 30, 2022
1 parent 4ccfbd8 commit ad463ab
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/amundsen_application/api/metadata/v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ def popular_tables() -> Response:
https://github.com/lyft/amundsenmetadatalibrary/blob/master/metadata_service/api/popular_tables.py
"""
try:
url = app.config['METADATASERVICE_BASE'] + POPULAR_TABLES_ENDPOINT
service_base = app.config['METADATASERVICE_BASE']
count = app.config['POPULAR_TABLE_COUNT']
url = f'{service_base}{POPULAR_TABLES_ENDPOINT}?limit={count}'

response = request_metadata(url=url)
status_code = response.status_code

if status_code == HTTPStatus.OK:
message = 'Success'
response_list = response.json().get('popular_tables')
top4 = response_list[0:min(len(response_list), app.config['POPULAR_TABLE_COUNT'])]
popular_tables = [marshall_table_partial(result) for result in top4]
popular_tables = [marshall_table_partial(result) for result in response_list]
else:
message = 'Encountered error: Request to metadata service failed with status code ' + str(status_code)
logging.error(message)
Expand Down

0 comments on commit ad463ab

Please sign in to comment.