Unverified Commit 240dcf39 authored by Jacob Kim's avatar Jacob Kim Committed by GitHub

fix: Properly request number of entries for popular tables (#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
parent b382de50
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment